MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / factory

Method factory

cassandra/connection.py:850–869  ·  view source on GitHub ↗

A factory function which returns connections which have succeeded in connecting and are ready for service (or raises an exception otherwise).

(cls, endpoint, timeout, *args, **kwargs)

Source from the content-addressed store, hash-verified

848
849 @classmethod
850 def factory(cls, endpoint, timeout, *args, **kwargs):
851 """
852 A factory function which returns connections which have
853 succeeded in connecting and are ready for service (or
854 raises an exception otherwise).
855 """
856 start = time.time()
857 kwargs['connect_timeout'] = timeout
858 conn = cls(endpoint, *args, **kwargs)
859 elapsed = time.time() - start
860 conn.connected_event.wait(timeout - elapsed)
861 if conn.last_error:
862 if conn.is_unsupported_proto_version:
863 raise ProtocolVersionUnsupported(endpoint, conn.protocol_version)
864 raise conn.last_error
865 elif not conn.connected_event.is_set():
866 conn.close()
867 raise OperationTimedOut("Timed out creating connection (%s seconds)" % timeout)
868 else:
869 return conn
870
871 def _build_ssl_context_from_options(self):
872

Callers 2

get_connectionMethod · 0.80
connection_factoryMethod · 0.80

Calls 5

OperationTimedOutClass · 0.90
timeMethod · 0.45
waitMethod · 0.45
closeMethod · 0.45

Tested by 1

get_connectionMethod · 0.64