Documentation ¶
Overview ¶
Package drivertest is intended for internal use only. It is made available to facilitate use cases that require access to internal MongoDB driver functionality and state. The API of this package is not stable and there is no backward compatibility guarantee.
WARNING: THIS PACKAGE IS EXPERIMENTAL AND MAY BE MODIFIED OR REMOVED WITHOUT NOTICE! USE WITH EXTREME CAUTION!
Index ¶
- func GetCommandFromMsgWireMessage(wm []byte) (bsoncore.Document, error)
- func GetCommandFromQueryWireMessage(wm []byte) (bsoncore.Document, error)
- func MakeReply(doc bsoncore.Document) []byte
- type ChannelConn
- func (c *ChannelConn) Address() address.Address
- func (c *ChannelConn) Close() error
- func (c *ChannelConn) Description() description.Server
- func (c *ChannelConn) DriverConnectionID() uint64
- func (c *ChannelConn) ID() string
- func (c *ChannelConn) ReadWireMessage(ctx context.Context) ([]byte, error)
- func (c *ChannelConn) ServerConnectionID() *int64
- func (c *ChannelConn) Stale() bool
- func (c *ChannelConn) WriteWireMessage(ctx context.Context, wm []byte) error
- type ChannelNetConn
- func (c *ChannelNetConn) AddResponse(resp []byte) error
- func (c *ChannelNetConn) Close() error
- func (c *ChannelNetConn) GetWrittenMessage() []byte
- func (c *ChannelNetConn) LocalAddr() net.Addr
- func (c *ChannelNetConn) Read(b []byte) (int, error)
- func (c *ChannelNetConn) RemoteAddr() net.Addr
- func (c *ChannelNetConn) SetDeadline(_ time.Time) error
- func (c *ChannelNetConn) SetReadDeadline(_ time.Time) error
- func (c *ChannelNetConn) SetWriteDeadline(_ time.Time) error
- func (c *ChannelNetConn) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCommandFromMsgWireMessage ¶ added in v1.4.0
GetCommandFromMsgWireMessage returns the command document sent in an OP_MSG wire message.
func GetCommandFromQueryWireMessage ¶ added in v1.3.3
GetCommandFromQueryWireMessage returns the command sent in an OP_QUERY wire message.
Types ¶
type ChannelConn ¶
type ChannelConn struct { WriteErr error Written chan []byte ReadResp chan []byte ReadErr chan error Desc description.Server }
ChannelConn implements the driver.Connection interface by reading and writing wire messages to a channel
func (*ChannelConn) Address ¶
func (c *ChannelConn) Address() address.Address
Address implements the driver.Connection interface.
func (*ChannelConn) Close ¶
func (c *ChannelConn) Close() error
Close implements the driver.Connection interface.
func (*ChannelConn) Description ¶
func (c *ChannelConn) Description() description.Server
Description implements the driver.Connection interface.
func (*ChannelConn) DriverConnectionID ¶ added in v1.11.7
func (c *ChannelConn) DriverConnectionID() uint64
DriverConnectionID implements the driver.Connection interface. TODO(GODRIVER-2824): replace return type with int64.
func (*ChannelConn) ID ¶
func (c *ChannelConn) ID() string
ID implements the driver.Connection interface.
func (*ChannelConn) ReadWireMessage ¶
func (c *ChannelConn) ReadWireMessage(ctx context.Context) ([]byte, error)
ReadWireMessage implements the driver.Connection interface.
func (*ChannelConn) ServerConnectionID ¶ added in v1.8.0
func (c *ChannelConn) ServerConnectionID() *int64
ServerConnectionID implements the driver.Connection interface.
func (*ChannelConn) Stale ¶ added in v1.4.0
func (c *ChannelConn) Stale() bool
Stale implements the driver.Connection interface.
func (*ChannelConn) WriteWireMessage ¶
func (c *ChannelConn) WriteWireMessage(ctx context.Context, wm []byte) error
WriteWireMessage implements the driver.Connection interface.
type ChannelNetConn ¶
type ChannelNetConn struct { WriteErr error Written chan []byte ReadResp chan []byte ReadErr chan error }
ChannelNetConn implements the net.Conn interface by reading and writing wire messages to a channel.
func (*ChannelNetConn) AddResponse ¶
func (c *ChannelNetConn) AddResponse(resp []byte) error
AddResponse adds a response to the connection.
func (*ChannelNetConn) GetWrittenMessage ¶
func (c *ChannelNetConn) GetWrittenMessage() []byte
GetWrittenMessage gets the last wire message written to the connection
func (*ChannelNetConn) LocalAddr ¶
func (c *ChannelNetConn) LocalAddr() net.Addr
LocalAddr returns the local network address.
func (*ChannelNetConn) Read ¶
func (c *ChannelNetConn) Read(b []byte) (int, error)
Read reads data from the connection
func (*ChannelNetConn) RemoteAddr ¶
func (c *ChannelNetConn) RemoteAddr() net.Addr
RemoteAddr returns the remote network address.
func (*ChannelNetConn) SetDeadline ¶
func (c *ChannelNetConn) SetDeadline(_ time.Time) error
SetDeadline sets the read and write deadlines associated with the connection.
func (*ChannelNetConn) SetReadDeadline ¶
func (c *ChannelNetConn) SetReadDeadline(_ time.Time) error
SetReadDeadline sets the read and write deadlines associated with the connection.
func (*ChannelNetConn) SetWriteDeadline ¶
func (c *ChannelNetConn) SetWriteDeadline(_ time.Time) error
SetWriteDeadline sets the read and write deadlines associated with the connection.