Documentation ¶
Overview ¶
Package wiremessage is intended for internal use only. It is made available to facilitate use cases that require access to internal MongoDB driver functionality and state. The API of this package is not stable and there is no backward compatibility guarantee.
WARNING: THIS PACKAGE IS EXPERIMENTAL AND MAY BE MODIFIED OR REMOVED WITHOUT NOTICE! USE WITH EXTREME CAUTION!
Index ¶
- Constants
- func AppendCompressedCompressedMessage(dst []byte, msg []byte) []byte
- func AppendCompressedCompressorID(dst []byte, id CompressorID) []byte
- func AppendCompressedOriginalOpCode(dst []byte, opcode OpCode) []byte
- func AppendCompressedUncompressedSize(dst []byte, size int32) []byte
- func AppendGetMoreCursorID(dst []byte, cursorID int64) []byte
- func AppendGetMoreFullCollectionName(dst []byte, ns string) []byte
- func AppendGetMoreNumberToReturn(dst []byte, numToReturn int32) []byte
- func AppendGetMoreZero(dst []byte) []byte
- func AppendHeader(dst []byte, length, reqid, respto int32, opcode OpCode) []byte
- func AppendHeaderStart(dst []byte, reqid, respto int32, opcode OpCode) (index int32, b []byte)
- func AppendKillCursorsCursorIDs(dst []byte, cursors []int64) []byte
- func AppendKillCursorsNumberIDs(dst []byte, numIDs int32) []byte
- func AppendKillCursorsZero(dst []byte) []byte
- func AppendMsgFlags(dst []byte, flags MsgFlag) []byte
- func AppendMsgSectionType(dst []byte, stype SectionType) []byte
- func AppendQueryFlags(dst []byte, flags QueryFlag) []byte
- func AppendQueryFullCollectionName(dst []byte, ns string) []byte
- func AppendQueryNumberToReturn(dst []byte, nor int32) []byte
- func AppendQueryNumberToSkip(dst []byte, skip int32) []byte
- func AppendReplyCursorID(dst []byte, id int64) []byte
- func AppendReplyFlags(dst []byte, flags ReplyFlag) []byte
- func AppendReplyNumberReturned(dst []byte, nr int32) []byte
- func AppendReplyStartingFrom(dst []byte, sf int32) []byte
- func IsMsgMoreToCome(wm []byte) bool
- func NextRequestID() int32
- func ReadCompressedUncompressedSize(src []byte) (size int32, rem []byte, ok bool)
- func ReadKillCursorsCursorIDs(src []byte, numIDs int32) (cursorIDs []int64, rem []byte, ok bool)
- func ReadKillCursorsNumberIDs(src []byte) (numIDs int32, rem []byte, ok bool)
- func ReadKillCursorsZero(src []byte) (zero int32, rem []byte, ok bool)
- func ReadMsgChecksum(src []byte) (checksum uint32, rem []byte, ok bool)
- func ReadMsgSectionDocumentSequence(src []byte) (identifier string, docs []bsoncore.Document, rem []byte, ok bool)
- func ReadMsgSectionRawDocumentSequence(src []byte) (identifier string, data []byte, rem []byte, ok bool)
- func ReadMsgSectionSingleDocument(src []byte) (doc bsoncore.Document, rem []byte, ok bool)
- func ReadQueryFullCollectionName(src []byte) (collname string, rem []byte, ok bool)deprecated
- func ReadQueryNumberToReturn(src []byte) (ntr int32, rem []byte, ok bool)deprecated
- func ReadQueryNumberToSkip(src []byte) (nts int32, rem []byte, ok bool)deprecated
- func ReadQueryQuery(src []byte) (query bsoncore.Document, rem []byte, ok bool)deprecated
- func ReadQueryReturnFieldsSelector(src []byte) (rfs bsoncore.Document, rem []byte, ok bool)deprecated
- func ReadReplyCursorID(src []byte) (cursorID int64, rem []byte, ok bool)
- func ReadReplyDocument(src []byte) (doc bsoncore.Document, rem []byte, ok bool)
- func ReadReplyDocuments(src []byte) (docs []bsoncore.Document, rem []byte, ok bool)
- func ReadReplyNumberReturned(src []byte) (numberReturned int32, rem []byte, ok bool)
- func ReadReplyStartingFrom(src []byte) (startingFrom int32, rem []byte, ok bool)
- type CompressorID
- type MsgFlag
- type OpCode
- type QueryFlag
- type ReplyFlag
- type SectionType
- type WireMessage
Constants ¶
const ( // DefaultZlibLevel is the default level for zlib compression DefaultZlibLevel = 6 // DefaultZstdLevel is the default level for zstd compression. // Matches https://github.com/wiredtiger/wiredtiger/blob/f08bc4b18612ef95a39b12166abcccf207f91596/ext/compressors/zstd/zstd_compress.c#L299 DefaultZstdLevel = 6 )
Variables ¶
This section is empty.
Functions ¶
func AppendCompressedCompressedMessage ¶
AppendCompressedCompressedMessage appends the compressed wiremessage to dst.
func AppendCompressedCompressorID ¶
func AppendCompressedCompressorID(dst []byte, id CompressorID) []byte
AppendCompressedCompressorID appends the ID of the compressor to dst.
func AppendCompressedOriginalOpCode ¶
AppendCompressedOriginalOpCode appends the original opcode to dst.
func AppendCompressedUncompressedSize ¶
AppendCompressedUncompressedSize appends the uncompressed size of a compressed wiremessage to dst.
func AppendGetMoreCursorID ¶
AppendGetMoreCursorID appends the cursorID field to dst.
func AppendGetMoreFullCollectionName ¶
AppendGetMoreFullCollectionName appends the fullCollectionName field to dst.
func AppendGetMoreNumberToReturn ¶
AppendGetMoreNumberToReturn appends the numberToReturn field to dst.
func AppendGetMoreZero ¶
AppendGetMoreZero appends the zero field to dst.
func AppendHeader ¶
AppendHeader appends a header to dst.
func AppendHeaderStart ¶
AppendHeaderStart appends a header to the dst slice and returns an index where the wire message starts in dst and the updated slice.
func AppendKillCursorsCursorIDs ¶
AppendKillCursorsCursorIDs appends each the cursorIDs field to dst.
func AppendKillCursorsNumberIDs ¶
AppendKillCursorsNumberIDs appends the numberOfCursorIDs field to dst.
func AppendKillCursorsZero ¶
AppendKillCursorsZero appends the zero field to dst.
func AppendMsgFlags ¶
AppendMsgFlags appends the flags for an OP_MSG wire message.
func AppendMsgSectionType ¶
func AppendMsgSectionType(dst []byte, stype SectionType) []byte
AppendMsgSectionType appends the section type to dst.
func AppendQueryFlags ¶
AppendQueryFlags appends the flags for an OP_QUERY wire message.
func AppendQueryFullCollectionName ¶
AppendQueryFullCollectionName appends the full collection name to dst.
func AppendQueryNumberToReturn ¶
AppendQueryNumberToReturn appends the number to return to dst.
func AppendQueryNumberToSkip ¶
AppendQueryNumberToSkip appends the number to skip to dst.
func AppendReplyCursorID ¶
AppendReplyCursorID appends the cursor ID to dst.
func AppendReplyFlags ¶
AppendReplyFlags appends the flags for an OP_REPLY wire message.
func AppendReplyNumberReturned ¶
AppendReplyNumberReturned appends the number returned to dst.
func AppendReplyStartingFrom ¶
AppendReplyStartingFrom appends the starting from field to dst.
func IsMsgMoreToCome ¶
IsMsgMoreToCome returns if the provided wire message is an OP_MSG with the more to come flag set.
func ReadCompressedUncompressedSize ¶
ReadCompressedUncompressedSize reads the uncompressed size of a compressed wiremessage to dst.
func ReadKillCursorsCursorIDs ¶
ReadKillCursorsCursorIDs reads numIDs cursor IDs from src.
func ReadKillCursorsNumberIDs ¶
ReadKillCursorsNumberIDs reads the numberOfCursorIDs field from src.
func ReadKillCursorsZero ¶
ReadKillCursorsZero reads the zero field from src.
func ReadMsgChecksum ¶
ReadMsgChecksum reads a checksum from src.
func ReadMsgSectionDocumentSequence ¶
func ReadMsgSectionDocumentSequence(src []byte) (identifier string, docs []bsoncore.Document, rem []byte, ok bool)
ReadMsgSectionDocumentSequence reads an identifier and document sequence from src and returns the document sequence data parsed into a slice of BSON documents.
func ReadMsgSectionRawDocumentSequence ¶
func ReadMsgSectionRawDocumentSequence(src []byte) (identifier string, data []byte, rem []byte, ok bool)
ReadMsgSectionRawDocumentSequence reads an identifier and document sequence from src and returns the raw document sequence data.
func ReadMsgSectionSingleDocument ¶
ReadMsgSectionSingleDocument reads a single document from src.
func ReadQueryFullCollectionName
deprecated
func ReadQueryNumberToReturn
deprecated
func ReadQueryNumberToSkip
deprecated
func ReadQueryReturnFieldsSelector
deprecated
func ReadReplyCursorID ¶
ReadReplyCursorID reads a cursor ID from src.
func ReadReplyDocument ¶
ReadReplyDocument reads a reply document from src.
func ReadReplyDocuments ¶
ReadReplyDocuments reads as many documents as possible from src
func ReadReplyNumberReturned ¶
ReadReplyNumberReturned reads the numbered returned from src.
Types ¶
type CompressorID ¶
type CompressorID uint8
CompressorID is the ID for each type of Compressor.
const ( CompressorNoOp CompressorID = iota CompressorSnappy CompressorZLib CompressorZstd )
These constants represent the individual compressor IDs for an OP_COMPRESSED.
func ReadCompressedCompressorID ¶
func ReadCompressedCompressorID(src []byte) (id CompressorID, rem []byte, ok bool)
ReadCompressedCompressorID reads the ID of the compressor to dst.
func (CompressorID) String ¶
func (id CompressorID) String() string
String implements the fmt.Stringer interface.
type MsgFlag ¶
type MsgFlag uint32
MsgFlag represents the flags on an OP_MSG message.
These constants represent the individual flags on an OP_MSG message.
type OpCode ¶
type OpCode int32
OpCode represents a MongoDB wire protocol opcode.
const ( OpReply OpCode = 1 OpUpdate OpCode = 2001 OpInsert OpCode = 2002 // Deprecated: Use OpMsg instead. OpQuery OpCode = 2004 OpGetMore OpCode = 2005 OpDelete OpCode = 2006 OpKillCursors OpCode = 2007 OpCommand OpCode = 2010 OpCommandReply OpCode = 2011 OpCompressed OpCode = 2012 OpMsg OpCode = 2013 )
These constants are the valid opcodes for the version of the wireprotocol supported by this library. The skipped OpCodes are historical OpCodes that are no longer used.
func ReadCompressedOriginalOpCode ¶
ReadCompressedOriginalOpCode reads the original opcode from src.
type QueryFlag ¶
type QueryFlag int32
QueryFlag represents the flags on an OP_QUERY message.
const ( TailableCursor QueryFlag SecondaryOK OplogReplay NoCursorTimeout AwaitData Exhaust Partial )
These constants represent the individual flags on an OP_QUERY message.
func ReadQueryFlags
deprecated
type ReplyFlag ¶
type ReplyFlag int32
ReplyFlag represents the flags of an OP_REPLY message.
These constants represent the individual flags of an OP_REPLY message.
func ReadReplyFlags ¶
ReadReplyFlags reads OP_REPLY flags from src.
type SectionType ¶
type SectionType uint8
SectionType represents the type for 1 section in an OP_MSG
const ( SingleDocument SectionType = iota DocumentSequence )
These constants represent the individual section types for a section in an OP_MSG
func ReadMsgSectionType ¶
func ReadMsgSectionType(src []byte) (stype SectionType, rem []byte, ok bool)
ReadMsgSectionType reads the section type from src.
type WireMessage ¶
type WireMessage []byte
WireMessage represents a MongoDB wire message in binary form.