MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / DefaultEndPointFactory

Class DefaultEndPointFactory

cassandra/connection.py:219–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217
218
219class DefaultEndPointFactory(EndPointFactory):
220
221 port = None
222 """
223 If no port is discovered in the row, this is the default port
224 used for endpoint creation.
225 """
226
227 def __init__(self, port=None):
228 self.port = port
229
230 def create(self, row):
231 # TODO next major... move this class so we don't need this kind of hack
232 from cassandra.metadata import _NodeInfo
233 addr = _NodeInfo.get_broadcast_rpc_address(row)
234 port = _NodeInfo.get_broadcast_rpc_port(row)
235 if port is None:
236 port = self.port if self.port else 9042
237
238 # create the endpoint with the translated address
239 # TODO next major, create a TranslatedEndPoint type
240 return DefaultEndPoint(
241 self.cluster.address_translator.translate(addr),
242 port)
243
244
245@total_ordering

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by 1

__init__Method · 0.72