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

Method send_msg

cassandra/connection.py:1071–1091  ·  view source on GitHub ↗
(self, msg, request_id, cb, encoder=ProtocolHandler.encode_message, decoder=ProtocolHandler.decode_message, result_metadata=None)

Source from the content-addressed store, hash-verified

1069 log.exception("Pushed event handler errored, ignoring:")
1070
1071 def send_msg(self, msg, request_id, cb, encoder=ProtocolHandler.encode_message, decoder=ProtocolHandler.decode_message, result_metadata=None):
1072 if self.is_defunct:
1073 raise ConnectionShutdown("Connection to %s is defunct" % self.endpoint)
1074 elif self.is_closed:
1075 raise ConnectionShutdown("Connection to %s is closed" % self.endpoint)
1076 elif not self._socket_writable:
1077 raise ConnectionBusy("Connection %s is overloaded" % self.endpoint)
1078
1079 # queue the decoder function with the request
1080 # this allows us to inject custom functions per request to encode, decode messages
1081 self._requests[request_id] = (cb, decoder, result_metadata)
1082 msg = encoder(msg, request_id, self.protocol_version, compressor=self.compressor,
1083 allow_beta_protocol_version=self.allow_beta_protocol_version)
1084
1085 if self._is_checksumming_enabled:
1086 buffer = io.BytesIO()
1087 self._segment_codec.encode(buffer, msg)
1088 msg = buffer.getvalue()
1089
1090 self.push(msg)
1091 return len(msg)
1092
1093 def wait_for_response(self, msg, timeout=None, **kwargs):
1094 return self.wait_for_responses(msg, timeout=timeout, **kwargs)[0]

Callers 10

wait_for_responsesMethod · 0.95
_send_options_messageMethod · 0.95
_send_startup_messageMethod · 0.95
_handle_auth_responseMethod · 0.95
set_keyspace_asyncMethod · 0.95
update_next_pagesMethod · 0.45
cancelMethod · 0.45
__init__Method · 0.45
_queryMethod · 0.45

Calls 4

ConnectionShutdownClass · 0.85
ConnectionBusyClass · 0.85
encodeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected