Documentation
¶
Index ¶
- func IsClientNetworkError(err error) bool
- func IsTCPHealthcheck(err error) bool
- func IsTimeoutNetworkError(err error) bool
- type BufferedConn
- func VMInsertClientWithDialer(dial func() (net.Conn, error), compressionLevel int) (*BufferedConn, error)
- func VMInsertClientWithHello(c net.Conn, helloMsg string, compressionLevel int) (*BufferedConn, error)
- func VMInsertServer(c net.Conn, compressionLevel int) (*BufferedConn, error)
- func VMInsertServerWithLegacyHello(c net.Conn, compressionLevel int) (*BufferedConn, error)
- func VMSelectClient(c net.Conn, compressionLevel int) (*BufferedConn, error)
- func VMSelectServer(c net.Conn, compressionLevel int) (*BufferedConn, error)
- func (bc *BufferedConn) Close() error
- func (bc *BufferedConn) Flush() error
- func (bc *BufferedConn) Read(p []byte) (int, error)
- func (bc *BufferedConn) SetDeadline(t time.Time) error
- func (bc *BufferedConn) SetReadDeadline(t time.Time) error
- func (bc *BufferedConn) SetWriteDeadline(t time.Time) error
- func (bc *BufferedConn) Write(p []byte) (int, error)
- type Func
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsClientNetworkError ¶
IsClientNetworkError determines whether the provided error is a client-side network error, such as io.EOF, io.ErrUnexpectedEOF, or a timeout. These errors typically occur when a client disconnects abruptly or fails during the handshake, and are generally non-actionable from the server point of view. This function helps distinguish such errors from critical ones during the handshake process and adjust logging accordingly.
See: https://github.com/VictoriaMetrics/VictoriaMetrics-enterprise/pull/880
func IsTCPHealthcheck ¶
IsTCPHealthcheck determines whether the provided error is a TCP health check
func IsTimeoutNetworkError ¶
IsTimeoutNetworkError determines whether the provided error is a network error with a timeout.
Types ¶
type BufferedConn ¶
type BufferedConn struct {
net.Conn
// IsLegacy defines if BufferedConn operates in legacy mode
// and doesn't support RPC protocol
IsLegacy bool
// contains filtered or unexported fields
}
BufferedConn is a net.Conn with Flush suport.
func VMInsertClientWithDialer ¶
func VMInsertClientWithDialer(dial func() (net.Conn, error), compressionLevel int) (*BufferedConn, error)
VMInsertClientWithDialer performs client-side handshake for vminsert protocol.
it uses provided dial func to establish connection to the server. compressionLevel is a legacy option which defines the level used for compression of the data sent to the server. compressionLevel <= 0 means 'no compression'
func VMInsertClientWithHello ¶
func VMInsertClientWithHello(c net.Conn, helloMsg string, compressionLevel int) (*BufferedConn, error)
VMInsertClientWithHello performs client-side handshake for vminsert protocol.
should be used for testing only
func VMInsertServer ¶
func VMInsertServer(c net.Conn, compressionLevel int) (*BufferedConn, error)
VMInsertServer performs server-side handshake for vminsert protocol.
compressionLevel is the level used for compression of the data sent to the client. compressionLevel <= 0 means 'no compression'
func VMInsertServerWithLegacyHello ¶
func VMInsertServerWithLegacyHello(c net.Conn, compressionLevel int) (*BufferedConn, error)
VMInsertServerWithLegacyHello performs server-side handshake for vminsert protocol with legacy hello message
should be used for testing only
func VMSelectClient ¶
func VMSelectClient(c net.Conn, compressionLevel int) (*BufferedConn, error)
VMSelectClient performs client-side handshake for vmselect protocol.
compressionLevel is the level used for compression of the data sent to the server. compressionLevel <= 0 means 'no compression'
func VMSelectServer ¶
func VMSelectServer(c net.Conn, compressionLevel int) (*BufferedConn, error)
VMSelectServer performs server-side handshake for vmselect protocol.
compressionLevel is the level used for compression of the data sent to the client. compressionLevel <= 0 means 'no compression'
func (*BufferedConn) Flush ¶
func (bc *BufferedConn) Flush() error
Flush flushes internal write buffers to the underlying conn.
func (*BufferedConn) Read ¶
func (bc *BufferedConn) Read(p []byte) (int, error)
Read reads up to len(p) from bc to p.
func (*BufferedConn) SetDeadline ¶
func (bc *BufferedConn) SetDeadline(t time.Time) error
SetDeadline sets read and write deadlines for bc to t.
Deadline is checked on each Read and Write call.
func (*BufferedConn) SetReadDeadline ¶
func (bc *BufferedConn) SetReadDeadline(t time.Time) error
SetReadDeadline sets read deadline for bc to t.
Deadline is checked on each Read call.
func (*BufferedConn) SetWriteDeadline ¶
func (bc *BufferedConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets write deadline for bc to t.
Deadline is checked on each Write call.