MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / __pack_message

Function __pack_message

pymongo/message.py:316–323  ·  view source on GitHub ↗

Takes message data and adds a message header based on the operation. Returns the resultant message string.

(operation: int, data: bytes)

Source from the content-addressed store, hash-verified

314
315
316def __pack_message(operation: int, data: bytes) -> tuple[int, bytes]:
317 """Takes message data and adds a message header based on the operation.
318
319 Returns the resultant message string.
320 """
321 rid = _randint()
322 message = _pack_header(16 + len(data), rid, 0, operation)
323 return rid, message + data
324
325
326_pack_int = struct.Struct("<i").pack

Callers 3

_op_msg_uncompressedFunction · 0.85
_query_uncompressedFunction · 0.85
_get_more_uncompressedFunction · 0.85

Calls 1

_randintFunction · 0.85

Tested by

no test coverage detected