mongo-driver: Index | Files

package wiremessage

import ""


Package Files



const (
    // DefaultZlibLevel is the default level for zlib compression
    DefaultZlibLevel = 6
    // DefaultZstdLevel is the default level for zstd compression.
    // Matches
    DefaultZstdLevel = 6
const OpmsgWireVersion = 6

OpmsgWireVersion is the minimum wire version needed to use OP_MSG

func AppendCompressedCompressedMessage Uses

func AppendCompressedCompressedMessage(dst []byte, msg []byte) []byte

AppendCompressedCompressedMessage appends the compressed wiremessage to dst.

func AppendCompressedCompressorID Uses

func AppendCompressedCompressorID(dst []byte, id CompressorID) []byte

AppendCompressedCompressorID appends the ID of the compressor to dst.

func AppendCompressedOriginalOpCode Uses

func AppendCompressedOriginalOpCode(dst []byte, opcode OpCode) []byte

AppendCompressedOriginalOpCode appends the original opcode to dst.

func AppendCompressedUncompressedSize Uses

func AppendCompressedUncompressedSize(dst []byte, size int32) []byte

AppendCompressedUncompressedSize appends the uncompressed size of a compressed wiremessage to dst.

func AppendGetMoreCursorID Uses

func AppendGetMoreCursorID(dst []byte, cursorID int64) []byte

AppendGetMoreCursorID appends the cursorID field to dst.

func AppendGetMoreFullCollectionName Uses

func AppendGetMoreFullCollectionName(dst []byte, ns string) []byte

AppendGetMoreFullCollectionName appends the fullCollectionName field to dst.

func AppendGetMoreNumberToReturn Uses

func AppendGetMoreNumberToReturn(dst []byte, numToReturn int32) []byte

AppendGetMoreNumberToReturn appends the numberToReturn field to dst.

func AppendGetMoreZero Uses

func AppendGetMoreZero(dst []byte) []byte

AppendGetMoreZero appends the zero field to dst.

func AppendHeader Uses

func AppendHeader(dst []byte, length, reqid, respto int32, opcode OpCode) []byte

AppendHeader appends a header to dst.

func AppendHeaderStart Uses

func AppendHeaderStart(dst []byte, reqid, respto int32, opcode OpCode) (index int32, b []byte)

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 Uses

func AppendKillCursorsCursorIDs(dst []byte, cursors []int64) []byte

AppendKillCursorsCursorIDs appends each the cursorIDs field to dst.

func AppendKillCursorsNumberIDs Uses

func AppendKillCursorsNumberIDs(dst []byte, numIDs int32) []byte

AppendKillCursorsNumberIDs appends the numberOfCursorIDs field to dst.

func AppendKillCursorsZero Uses

func AppendKillCursorsZero(dst []byte) []byte

AppendKillCursorsZero appends the zero field to dst.

func AppendMsgFlags Uses

func AppendMsgFlags(dst []byte, flags MsgFlag) []byte

AppendMsgFlags appends the flags for an OP_MSG wire message.

func AppendMsgSectionType Uses

func AppendMsgSectionType(dst []byte, stype SectionType) []byte

AppendMsgSectionType appends the section type to dst.

func AppendQueryFlags Uses

func AppendQueryFlags(dst []byte, flags QueryFlag) []byte

AppendQueryFlags appends the flags for an OP_QUERY wire message.

func AppendQueryFullCollectionName Uses

func AppendQueryFullCollectionName(dst []byte, ns string) []byte

AppendQueryFullCollectionName appends the full collection name to dst.

func AppendQueryNumberToReturn Uses

func AppendQueryNumberToReturn(dst []byte, nor int32) []byte

AppendQueryNumberToReturn appends the number to return to dst.

func AppendQueryNumberToSkip Uses

func AppendQueryNumberToSkip(dst []byte, skip int32) []byte

AppendQueryNumberToSkip appends the number to skip to dst.

func AppendReplyCursorID Uses

func AppendReplyCursorID(dst []byte, id int64) []byte

AppendReplyCursorID appends the cursor ID to dst.

func AppendReplyFlags Uses

func AppendReplyFlags(dst []byte, flags ReplyFlag) []byte

AppendReplyFlags appends the flags for an OP_REPLY wire message.

func AppendReplyNumberReturned Uses

func AppendReplyNumberReturned(dst []byte, nr int32) []byte

AppendReplyNumberReturned appends the number returned to dst.

func AppendReplyStartingFrom Uses

func AppendReplyStartingFrom(dst []byte, sf int32) []byte

AppendReplyStartingFrom appends the starting from field to dst.

func CurrentRequestID Uses

func CurrentRequestID() int32

CurrentRequestID returns the current request ID.

func IsMsgMoreToCome Uses

func IsMsgMoreToCome(wm []byte) bool

IsMsgMoreToCome returns if the provided wire message is an OP_MSG with the more to come flag set.

func NextRequestID Uses

func NextRequestID() int32

NextRequestID returns the next request ID.

func ReadCompressedCompressedMessage Uses

func ReadCompressedCompressedMessage(src []byte, length int32) (msg []byte, rem []byte, ok bool)

ReadCompressedCompressedMessage reads the compressed wiremessage to dst.

func ReadCompressedUncompressedSize Uses

func ReadCompressedUncompressedSize(src []byte) (size int32, rem []byte, ok bool)

ReadCompressedUncompressedSize reads the uncompressed size of a compressed wiremessage to dst.

func ReadKillCursorsCursorIDs Uses

func ReadKillCursorsCursorIDs(src []byte, numIDs int32) (cursorIDs []int64, rem []byte, ok bool)

ReadKillCursorsCursorIDs reads numIDs cursor IDs from src.

func ReadKillCursorsNumberIDs Uses

func ReadKillCursorsNumberIDs(src []byte) (numIDs int32, rem []byte, ok bool)

ReadKillCursorsNumberIDs reads the numberOfCursorIDs field from src.

func ReadKillCursorsZero Uses

func ReadKillCursorsZero(src []byte) (zero int32, rem []byte, ok bool)

ReadKillCursorsZero reads the zero field from src.

func ReadMsgChecksum Uses

func ReadMsgChecksum(src []byte) (checksum uint32, rem []byte, ok bool)

ReadMsgChecksum reads a checksum from src.

func ReadMsgSectionDocumentSequence Uses

func ReadMsgSectionDocumentSequence(src []byte) (identifier string, docs []bsoncore.Document, rem []byte, ok bool)

ReadMsgSectionDocumentSequence reads an identifier and document sequence from src.

func ReadMsgSectionSingleDocument Uses

func ReadMsgSectionSingleDocument(src []byte) (doc bsoncore.Document, rem []byte, ok bool)

ReadMsgSectionSingleDocument reads a single document from src.

func ReadQueryFullCollectionName Uses

func ReadQueryFullCollectionName(src []byte) (collname string, rem []byte, ok bool)

ReadQueryFullCollectionName reads the full collection name from src.

func ReadQueryNumberToReturn Uses

func ReadQueryNumberToReturn(src []byte) (ntr int32, rem []byte, ok bool)

ReadQueryNumberToReturn reads the number to return from src.

func ReadQueryNumberToSkip Uses

func ReadQueryNumberToSkip(src []byte) (nts int32, rem []byte, ok bool)

ReadQueryNumberToSkip reads the number to skip from src.

func ReadQueryQuery Uses

func ReadQueryQuery(src []byte) (query bsoncore.Document, rem []byte, ok bool)

ReadQueryQuery reads the query from src.

func ReadQueryReturnFieldsSelector Uses

func ReadQueryReturnFieldsSelector(src []byte) (rfs bsoncore.Document, rem []byte, ok bool)

ReadQueryReturnFieldsSelector reads a return fields selector document from src.

func ReadReplyCursorID Uses

func ReadReplyCursorID(src []byte) (cursorID int64, rem []byte, ok bool)

ReadReplyCursorID reads a cursor ID from src.

func ReadReplyDocument Uses

func ReadReplyDocument(src []byte) (doc bsoncore.Document, rem []byte, ok bool)

ReadReplyDocument reads a reply document from src.

func ReadReplyDocuments Uses

func ReadReplyDocuments(src []byte) (docs []bsoncore.Document, rem []byte, ok bool)

ReadReplyDocuments reads as many documents as possible from src

func ReadReplyNumberReturned Uses

func ReadReplyNumberReturned(src []byte) (numberReturned int32, rem []byte, ok bool)

ReadReplyNumberReturned reads the numbered returned from src.

func ReadReplyStartingFrom Uses

func ReadReplyStartingFrom(src []byte) (startingFrom int32, rem []byte, ok bool)

ReadReplyStartingFrom reads the starting from from src.

type CompressorID Uses

type CompressorID uint8

CompressorID is the ID for each type of Compressor.

const (
    CompressorNoOp CompressorID = iota

These constants represent the individual compressor IDs for an OP_COMPRESSED.

func ReadCompressedCompressorID Uses

func ReadCompressedCompressorID(src []byte) (id CompressorID, rem []byte, ok bool)

ReadCompressedCompressorID reads the ID of the compressor to dst.

type MsgFlag Uses

type MsgFlag uint32

MsgFlag represents the flags on an OP_MSG message.

const (
    ChecksumPresent MsgFlag = 1 << iota

    ExhaustAllowed MsgFlag = 1 << 16

These constants represent the individual flags on an OP_MSG message.

func ReadMsgFlags Uses

func ReadMsgFlags(src []byte) (flags MsgFlag, rem []byte, ok bool)

ReadMsgFlags reads the OP_MSG flags from src.

type OpCode Uses

type OpCode int32

OpCode represents a MongoDB wire protocol opcode.

const (
    OpReply OpCode = 1

    OpUpdate OpCode = 2001
    OpInsert OpCode = 2002

    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 Uses

func ReadCompressedOriginalOpCode(src []byte) (opcode OpCode, rem []byte, ok bool)

ReadCompressedOriginalOpCode reads the original opcode from src.

func ReadHeader Uses

func ReadHeader(src []byte) (length, requestID, responseTo int32, opcode OpCode, rem []byte, ok bool)

ReadHeader reads a wire message header from src.

func (OpCode) String Uses

func (oc OpCode) String() string

String implements the fmt.Stringer interface.

type QueryFlag Uses

type QueryFlag int32

QueryFlag represents the flags on an OP_QUERY message.

const (
    TailableCursor QueryFlag

These constants represent the individual flags on an OP_QUERY message.

func ReadQueryFlags Uses

func ReadQueryFlags(src []byte) (flags QueryFlag, rem []byte, ok bool)

ReadQueryFlags reads OP_QUERY flags from src.

func (QueryFlag) String Uses

func (qf QueryFlag) String() string

String implements the fmt.Stringer interface.

type ReplyFlag Uses

type ReplyFlag int32

ReplyFlag represents the flags of an OP_REPLY message.

const (
    CursorNotFound ReplyFlag = 1 << iota

These constants represent the individual flags of an OP_REPLY message.

func ReadReplyFlags Uses

func ReadReplyFlags(src []byte) (flags ReplyFlag, rem []byte, ok bool)

ReadReplyFlags reads OP_REPLY flags from src.

func (ReplyFlag) String Uses

func (rf ReplyFlag) String() string

String implements the fmt.Stringer interface.

type SectionType Uses

type SectionType uint8

SectionType represents the type for 1 section in an OP_MSG

const (
    SingleDocument SectionType = iota

These constants represent the individual section types for a section in an OP_MSG

func ReadMsgSectionType Uses

func ReadMsgSectionType(src []byte) (stype SectionType, rem []byte, ok bool)

ReadMsgSectionType reads the section type from src.

type WireMessage Uses

type WireMessage []byte

WireMessage represents a MongoDB wire message in binary form.

Package wiremessage imports 4 packages (graph) and is imported by 5 packages. Updated 2019-10-08. Refresh now. Tools for package owners.