def _apply_selector(self, selector):
     if self._description.topology_type == TOPOLOGY_TYPE.Single:
         # Ignore the selector.
         return self._description.known_servers
     elif self._description.topology_type == TOPOLOGY_TYPE.Sharded:
         return apply_local_threshold(self._settings.local_threshold_ms,
                                      self._description.known_servers)
     else:
         sds = selector(self._description.known_servers)
         return apply_local_threshold(
             self._settings.local_threshold_ms, sds)
Example #2
0
 def _apply_selector(self, selector):
     if self._description.topology_type == TOPOLOGY_TYPE.Single:
         # Ignore the selector.
         return self._description.known_servers
     elif self._description.topology_type == TOPOLOGY_TYPE.Sharded:
         return apply_local_threshold(self._settings.local_threshold_ms,
                                      self._description.known_servers)
     else:
         sds = selector(self._description.known_servers)
         return apply_local_threshold(self._settings.local_threshold_ms,
                                      sds)
Example #3
0
 def _apply_selector(self, selector, address):
     if self._description.topology_type == TOPOLOGY_TYPE.Single:
         # Ignore the selector.
         return self._description.known_servers
     elif address:
         sd = self._description.server_descriptions().get(address)
         return [sd] if sd else []
     elif self._description.topology_type == TOPOLOGY_TYPE.Sharded:
         return apply_local_threshold(self._settings.local_threshold_ms,
                                      self._description.known_servers)
     else:
         sds = selector(self._description.known_servers)
         return apply_local_threshold(self._settings.local_threshold_ms,
                                      sds)
Example #4
0
 def _apply_selector(self, selector, address):
     if self._description.topology_type == TOPOLOGY_TYPE.Single:
         # Ignore the selector.
         return self._description.known_servers
     elif address:
         sd = self._description.server_descriptions().get(address)
         return [sd] if sd else []
     elif self._description.topology_type == TOPOLOGY_TYPE.Sharded:
         return apply_local_threshold(self._settings.local_threshold_ms,
                                      self._description.known_servers)
     else:
         sds = selector(self._description.known_servers)
         return apply_local_threshold(
             self._settings.local_threshold_ms, sds)