Documentation
¶
Overview ¶
Package wireclient provides low-level wire protocol client.
Index ¶
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Read(ctx context.Context) (*wire.MsgHeader, wire.MsgBody, error)
- func (c *Conn) Request(ctx context.Context, body wire.MsgBody) (*wire.MsgHeader, wire.MsgBody, error)
- func (c *Conn) Write(ctx context.Context, header *wire.MsgHeader, body wire.MsgBody) error
- func (c *Conn) WriteRaw(ctx context.Context, b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a single client connection.
It is not safe for concurrent use.
func Connect ¶
Connect creates a new connection for the given MongoDB URI.
Context can be used to cancel the connection attempt. Canceling the context after the connection is established has no effect.
The passed logger will be used only for debug-level messages.
func New ¶
New wraps the given connection.
The passed logger will be used only for debug-level messages.
func (*Conn) Read ¶
Read reads the next message from the connection.
Passed context's deadline is honored if set.
func (*Conn) Request ¶
func (c *Conn) Request(ctx context.Context, body wire.MsgBody) (*wire.MsgHeader, wire.MsgBody, error)
Request sends the given request to the connection and returns the response. The header is generated automatically.
Passed context's deadline is honored if set.
It returns errors only for request/response parsing or connection issues. All protocol-level errors are stored inside response.