mongo

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIsMasterDoc

func IsIsMasterDoc(doc bsoncore.Document) bool

func IsIsMasterValueTruthy

func IsIsMasterValueTruthy(val bsoncore.Value) bool

func IsWrite

func IsWrite(command Command) bool

Types

type Command

type Command string
const (
	Unknown           Command = "unknown"
	AbortTransaction  Command = "abortTransaction"
	Aggregate         Command = "aggregate"
	CommitTransaction Command = "commitTransaction"
	Count             Command = "count"
	CreateIndexes     Command = "createIndexes"
	Delete            Command = "delete"
	Distinct          Command = "distinct"
	Drop              Command = "drop"
	DropDatabase      Command = "dropDatabase"
	DropIndexes       Command = "dropIndexes"
	EndSessions       Command = "endSessions"
	Find              Command = "find"
	FindAndModify     Command = "findAndModify"
	GetMore           Command = "getMore"
	Insert            Command = "insert"
	IsMaster          Command = "isMaster"
	Ismaster          Command = "ismaster"
	ListCollections   Command = "listCollections"
	ListIndexes       Command = "listIndexes"
	ListDatabases     Command = "listDatabases"
	MapReduce         Command = "mapReduce"
	Update            Command = "update"
)

func CommandAndCollection

func CommandAndCollection(msg bsoncore.Document) (Command, string)

type Message

type Message struct {
	Wm []byte
	Op Operation
}

func IsMasterResponse

func IsMasterResponse(responseTo int32, topologyKind description.TopologyKind) (*Message, error)

hard-coded response, emulating an upstream isMaster response from MongoDB

type Mongo

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

func Connect

func Connect(log *zap.Logger, sd *statsd.Client, opts *options.ClientOptions, ping bool) (*Mongo, error)

func (*Mongo) Close

func (m *Mongo) Close()

func (*Mongo) Description

func (m *Mongo) Description() description.Topology

func (*Mongo) RoundTrip

func (m *Mongo) RoundTrip(msg *Message, tags []string) (_ *Message, err error)

type Operation

type Operation interface {
	fmt.Stringer
	OpCode() wiremessage.OpCode
	Encode(responseTo int32) []byte
	IsIsMaster() bool
	CursorID() (cursorID int64, ok bool)
	RequestID() int32
	Error() error
	Unacknowledged() bool
	CommandAndCollection() (Command, string)
	TransactionDetails() *TransactionDetails
	ReadPref() (rpref *readpref.ReadPref, ok bool)
}

type TransactionDetails

type TransactionDetails struct {
	LsID               []byte
	TxnNumber          int64
	IsStartTransaction bool
}

Jump to

Keyboard shortcuts

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