Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExist = errors.New("exist")
View Source
var ErrNotExist = errors.New("not exist")
Functions ¶
func WithConnDatabase ¶
func WithConnDatabase(name string) func(*conn)
WithConnDatabase sets a database name.
func WithConnTracer ¶
WithConnTracer sets a tracer context.
Types ¶
type Conn ¶
type Conn interface {
net.Conn
tracer.Context
// Context returns the context.
Context() context.Context
// SetDatabase sets a database name.
SetDatabase(db string)
// Database returns the database name.
Database() string
// Timestamp returns the timestamp.
Timestamp() time.Time
// UUID returns the UUID.
UUID() uuid.UUID
// ID returns the ID.
ID() ConnID
// SetSpanContext sets a span context.
SetSpanContext(ctx tracer.Context)
// SpanContext returns a span context.
SpanContext() tracer.Context
}
Conn represents a connection.
func NewConnWith ¶
func NewConnWith(netConn net.Conn, opts ...ConnOption) Conn
NewConnWith returns a connection with a raw connection.
type ConnManager ¶
type ConnManager interface {
// AddConn adds the specified connection.
AddConn(c Conn) error
// UpdateConn updates the specified connection.
UpdateConn(from Conn, to Conn) error
// Conns returns the included connections.
Conns() []Conn
// LookupConnByUID returns a connection and true when the specified connection exists by the connection ID, otherwise nil and false.
LookupConnByUID(cid uint64) (Conn, bool)
// LookupConnByUUID returns the connection with the specified UUID.
LookupConnByUUID(uuid uuid.UUID) (Conn, bool)
// RemoveConn deletes the specified connection from the map.
RemoveConn(conn Conn) error
// RemoveConnByUID deletes the specified connection by the connection ID.
RemoveConnByUID(cid uint64)
// RemoveConnByUID deletes the specified connection by the connection ID.
RemoveConnByUUID(uuid uuid.UUID)
// Start starts the connection manager.
Start() error
// Close closes the connection manager.
Close() error
// Stop closes all connections.
Stop() error
}
ConnManager represents a connection manager interface.
Click to show internal directories.
Click to hide internal directories.