message

package
v0.0.0-...-c772d2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpReply        = OpCode(1)
	OpUpdate       = OpCode(2001)
	OpInsert       = OpCode(2002)
	Reserved       = OpCode(2003)
	OpQuery        = OpCode(2004)
	OpGetMore      = OpCode(2005)
	OpDelete       = OpCode(2006)
	OpKillCursors  = OpCode(2007)
	OpCommand      = OpCode(2010)
	OpCommandReply = OpCode(2011)
	OpMsg          = OpCode(2013)
)
View Source
const (
	HeaderLen = 16
)

Variables

View Source
var FlagIntSet [32]int32
View Source
var FlagUIntSet [32]uint32

Functions

This section is empty.

Types

type CommandMessage

type CommandMessage struct {
	// contains filtered or unexported fields
}

func NewCommandMessage

func NewCommandMessage(header *MessageHeader, b []byte) (*CommandMessage, error)

func (*CommandMessage) ParseCommand

func (m *CommandMessage) ParseCommand() []*processors.LogEvent

type CommandReplyMessage

type CommandReplyMessage struct {
	// contains filtered or unexported fields
}

func NewCommandReplyMessage

func NewCommandReplyMessage(header *MessageHeader, b []byte) (*CommandReplyMessage, error)

func (*CommandReplyMessage) ParseCommand

func (m *CommandReplyMessage) ParseCommand() []*processors.LogEvent

type DeleteMessage

type DeleteMessage struct {
	// contains filtered or unexported fields
}

func NewDeleteMessage

func NewDeleteMessage(header *MessageHeader, b []byte) (*DeleteMessage, error)

func (*DeleteMessage) ParseCommand

func (m *DeleteMessage) ParseCommand() []*processors.LogEvent

type GetMoreMessage

type GetMoreMessage struct {
	// contains filtered or unexported fields
}

func NewGetMoreMessage

func NewGetMoreMessage(header *MessageHeader, b []byte) (*GetMoreMessage, error)

func (*GetMoreMessage) ParseCommand

func (m *GetMoreMessage) ParseCommand() []*processors.LogEvent

type InsertMessage

type InsertMessage struct {
	// contains filtered or unexported fields
}

func NewInsertMessage

func NewInsertMessage(header *MessageHeader, b []byte) (*InsertMessage, error)

func (*InsertMessage) ParseCommand

func (m *InsertMessage) ParseCommand() []*processors.LogEvent

type KillCursorsMessage

type KillCursorsMessage struct {
	// contains filtered or unexported fields
}

func NewKillCursorsMessage

func NewKillCursorsMessage(header *MessageHeader, b []byte) (*KillCursorsMessage, error)

func (*KillCursorsMessage) ParseCommand

func (m *KillCursorsMessage) ParseCommand() []*processors.LogEvent

type Message

type Message struct {
	DBUser     string       `json:"db_user"`
	DB         string       `json:"db"`
	Collection string       `json:"collection"`
	Op         string       `json:"op"`
	DocID      string       `json:"id"`
	MongoMsg   MongoMessage `json:"db_log"`
}

type MessageHeader

type MessageHeader struct {
	MessageSize uint32 `json:"size"`
	RequestID   uint32 `json:"req_id"`
	ResponseTo  uint32 `json:"resp_to"`
	OpCode      OpCode `json:"opcode"`
}

func DecodeHeader

func DecodeHeader(b []byte) (*MessageHeader, error)

type MongoMessage

type MongoMessage interface {
	ExtractBasic() (user, db, collection, op, docId string)
}

type MsgMessage

type MsgMessage struct {
	Header   *MessageHeader `json:"header"`
	Flags    msgFlags       `json:"flags"`
	Sections []section      `json:"sections"`
	CheckSum uint32         `json:"check_sum"`
}

func NewMsgMessage

func NewMsgMessage(header *MessageHeader, b []byte) (*MsgMessage, error)

func (*MsgMessage) ExtractBasic

func (mm *MsgMessage) ExtractBasic() (user, db, collection, op, docId string)

type OpCode

type OpCode uint32

func (*OpCode) String

func (op *OpCode) String() string

type QueryMessage

type QueryMessage struct {
	Header *MessageHeader `json:"header"`
	Flags  queryFlags     `json:"flags"`
	Coll   string         `json:"collection"`
	Skip   int32          `json:"skip"`
	Limit  int32          `json:"limit"`
	Query  bson.M         `json:"query"`
	Fields bson.M         `json:"fields"`
}

func NewQueryMessage

func NewQueryMessage(header *MessageHeader, b []byte) (*QueryMessage, error)

func (*QueryMessage) ExtractBasic

func (qm *QueryMessage) ExtractBasic() (user, db, collection, op, docId string)

type ReplyMessage

type ReplyMessage struct {
	Header    *MessageHeader `json:"header"`
	Flags     replyFlags     `json:"flags"`
	CursorID  int64          `json:"cursor_id"`
	StartFrom int32          `json:"start_from"`
	Number    int32          `json:"number"`
	Documents []bson.M       `json:"documents"`
}

func NewReplyMessage

func NewReplyMessage(header *MessageHeader, b []byte) (*ReplyMessage, error)

func (*ReplyMessage) ExtractBasic

func (rm *ReplyMessage) ExtractBasic() (user, db, collection, op, docId string)

type ReservedMessage

type ReservedMessage struct {
	// contains filtered or unexported fields
}

func NewReservedMessage

func NewReservedMessage(header *MessageHeader, b []byte) (*ReservedMessage, error)

func (*ReservedMessage) ParseCommand

func (m *ReservedMessage) ParseCommand() []*processors.LogEvent

type UpdateMessage

type UpdateMessage struct {
	// contains filtered or unexported fields
}

func NewUpdateMessage

func NewUpdateMessage(header *MessageHeader, b []byte) (*UpdateMessage, error)

func (*UpdateMessage) ParseCommand

func (m *UpdateMessage) ParseCommand() []*processors.LogEvent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL