internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "local build"

Version is the current version of the driver.

Functions

func MakeReply added in v0.0.9

func MakeReply(doc bsonx.Doc) (wiremessage.WireMessage, error)

Create a OP_REPLY wiremessage from a BSON document

func MultiError

func MultiError(errors ...error) error

MultiError combines multiple errors into a single error. If there are no errors, nil is returned. If there is 1 error, it is returned. Otherwise, they are combined.

func RolledUpErrorMessage

func RolledUpErrorMessage(err error) string

RolledUpErrorMessage gets a flattened error message.

func UnwrapError

func UnwrapError(err error) error

UnwrapError attempts to unwrap the error down to its root cause.

func WrapError

func WrapError(inner error, message string) error

WrapError wraps an error with a message.

func WrapErrorf

func WrapErrorf(inner error, format string, args ...interface{}) error

WrapErrorf wraps an error with a message.

Types

type BuildInfoResult

type BuildInfoResult struct {
	OK           bool    `bson:"ok"`
	GitVersion   string  `bson:"gitVersion,omitempty"`
	Version      string  `bson:"version,omitempty"`
	VersionArray []uint8 `bson:"versionArray,omitempty"`
}

BuildInfoResult is the result of executing the buildInfo command.

type ChannelConn added in v0.0.9

type ChannelConn struct {
	WriteErr error
	Written  chan wiremessage.WireMessage
	ReadResp chan wiremessage.WireMessage
	ReadErr  chan error
}

Implements the connection.Connection interface by reading and writing wire messages to a channel

func (*ChannelConn) Alive added in v0.0.9

func (c *ChannelConn) Alive() bool

func (*ChannelConn) Close added in v0.0.9

func (c *ChannelConn) Close() error

func (*ChannelConn) Expired added in v0.0.9

func (c *ChannelConn) Expired() bool

func (*ChannelConn) ID added in v0.0.9

func (c *ChannelConn) ID() string

func (*ChannelConn) ReadWireMessage added in v0.0.9

func (c *ChannelConn) ReadWireMessage(ctx context.Context) (wiremessage.WireMessage, error)

func (*ChannelConn) WriteWireMessage added in v0.0.9

func (c *ChannelConn) WriteWireMessage(ctx context.Context, wm wiremessage.WireMessage) error

type GetLastErrorResult

type GetLastErrorResult struct {
	ConnectionID uint32 `bson:"connectionId"`
}

GetLastErrorResult is the result of executing the getLastError command.

type IsMasterResult

type IsMasterResult struct {
	Arbiters            []string           `bson:"arbiters,omitempty"`
	ArbiterOnly         bool               `bson:"arbiterOnly,omitempty"`
	ElectionID          primitive.ObjectID `bson:"electionId,omitempty"`
	Hidden              bool               `bson:"hidden,omitempty"`
	Hosts               []string           `bson:"hosts,omitempty"`
	IsMaster            bool               `bson:"ismaster,omitempty"`
	IsReplicaSet        bool               `bson:"isreplicaset,omitempty"`
	LastWriteTimestamp  time.Time          `bson:"lastWriteDate,omitempty"`
	MaxBSONObjectSize   uint32             `bson:"maxBsonObjectSize,omitempty"`
	MaxMessageSizeBytes uint32             `bson:"maxMessageSizeBytes,omitempty"`
	MaxWriteBatchSize   uint16             `bson:"maxWriteBatchSize,omitempty"`
	Me                  string             `bson:"me,omitempty"`
	MaxWireVersion      int32              `bson:"maxWireVersion,omitempty"`
	MinWireVersion      int32              `bson:"minWireVersion,omitempty"`
	Msg                 string             `bson:"msg,omitempty"`
	OK                  int32              `bson:"ok"`
	Passives            []string           `bson:"passives,omitempty"`
	ReadOnly            bool               `bson:"readOnly,omitempty"`
	Secondary           bool               `bson:"secondary,omitempty"`
	SetName             string             `bson:"setName,omitempty"`
	SetVersion          uint32             `bson:"setVersion,omitempty"`
	Tags                map[string]string  `bson:"tags,omitempty"`
}

IsMasterResult is the result of executing this ismaster command.

type Semaphore

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

Semaphore is a synchronization primitive that controls access to a common resource.

func NewSemaphore

func NewSemaphore(slots uint64) *Semaphore

NewSemaphore creates a new semaphore.

func (*Semaphore) Len

func (s *Semaphore) Len() uint64

Len gets the number of permits available.

func (*Semaphore) Release

func (s *Semaphore) Release() error

Release releases a resource back into the pool.

func (*Semaphore) Wait

func (s *Semaphore) Wait(ctx context.Context) error

Wait waits until a resource is available or until the context is done.

type WrappedError

type WrappedError interface {
	// Message gets the basic message of the error.
	Message() string
	// Inner gets the inner error if one exists.
	Inner() error
}

WrappedError represents an error that contains another error.

Directories

Path Synopsis
israce
Package israce reports if the Go race detector is enabled.
Package israce reports if the Go race detector is enabled.

Jump to

Keyboard shortcuts

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