Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compressor ¶
Compressor is an interface used to compress wire messages. If a Connection supports compression it should implement this interface as well. The CompressWireMessage method will be called during the execution of an operation if the wire message is allowed to be compressed.
type Connection ¶
type Connection struct { ReadWriteCloser Describer Streamer Compressor Pinner }
Connection represents a connection to a MongoDB server.
func NewConnection ¶
func NewConnection(component interface { ReadWriteCloser Describer }) *Connection
NewConnection creates a new Connection with the provided component. This constructor returns a component that is already a Connection to avoid mis-asserting the composite interfaces.
type Describer ¶
type Describer interface { Description() description.Server ID() string ServerConnectionID() *int64 DriverConnectionID() int64 Address() address.Address Stale() bool OIDCTokenGenID() uint64 SetOIDCTokenGenID(uint64) }
Describer represents a Connection that can be described.
type Pinner ¶
type Pinner interface { PinToCursor() error PinToTransaction() error UnpinFromCursor() error UnpinFromTransaction() error }
Pinner represents a Connection that can be pinned by one or more cursors or transactions. Implementations of this interface should maintain the following invariants:
- Each Pin* call should increment the number of references for the connection.
- Each Unpin* call should decrement the number of references for the connection.
- Calls to Close() should be ignored until all resources have unpinned the connection.
type ReadWriteCloser ¶
type ReadWriteCloser interface { Read(ctx context.Context) ([]byte, error) Write(ctx context.Context, wm []byte) error io.Closer }
ReadWriteCloser represents a Connection where server operations can read from, written to, and closed.
type Streamer ¶
Streamer represents a Connection that supports streaming wire protocol messages using the moreToCome and exhaustAllowed flags.
The SetStreaming and CurrentlyStreaming functions correspond to the moreToCome flag on server responses. If a response has moreToCome set, SetStreaming(true) will be called and CurrentlyStreaming() should return true.
CanStream corresponds to the exhaustAllowed flag. The operations layer will set exhaustAllowed on outgoing wire messages to inform the server that the driver supports streaming.