Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdaptCodec ¶ added in v0.4.1
AdaptCodec adapts the provided Codec.
Types ¶
type Codec ¶
Codec defines a generic client codec interface for encoding Commands and decoding Results.
- Encode is used by the client to send Commands to the server. If encoding fails, Client.Send returns the corresponding error.
- Decode is used by the client to receive Results from the server. If decoding fails, the client is closed automatically.
type ConnFactory ¶
ConnFactory establishes a new connection to the server.
type ConnFactoryFn ¶ added in v0.4.1
ConnFactoryFn is a function implementation of the ConnFactory.
type Options ¶ added in v0.4.0
type Options struct { Info delegate.ServerInfo Base []ccln.SetOption Transport []transport.SetOption Delegate []dcln.SetOption Keepalive []dcln.SetKeepaliveOption }
Options defines the configuration settings for initializing a client.
These options are composed of modular components that configure different layers of the client, including transport, keepalive, delegate behavior, and base client setup.
type SetOption ¶ added in v0.4.0
type SetOption func(o *Options)
func WithDelegate ¶ added in v0.4.0
WithDelegate applies delegate-specific options.
These options customize the behavior of the client delegate.
func WithKeepalive ¶ added in v0.4.0
func WithKeepalive(ops ...dcln.SetKeepaliveOption) SetOption
WithKeepalive applies keepalive-specific options.
These options configure how the client maintains an active connection, including Ping intervals and timeout settings.
func WithServerInfo ¶ added in v0.4.0
func WithServerInfo(info delegate.ServerInfo) SetOption
WithServerInfo sets the ServerInfo for the client.
ServerInfo helps the client identify a compatible server.
func WithTransport ¶ added in v0.4.0
func WithTransport(ops ...transport.SetOption) SetOption
WithTransport applies transport-specific options.
These options configure the transport layer.
type TransportFactory ¶ added in v0.4.1
type TransportFactory[T any] struct { // contains filtered or unexported fields }
TransportFactory creates new Transport instances.
It encapsulates the logic for establishing a new connection and applying optional transport-level configuration.
func NewTransportFactory ¶ added in v0.4.1
func NewTransportFactory[T any](codec transport.Codec[core.Cmd[T], core.Result], factory ConnFactory, ops ...transport.SetOption, ) *TransportFactory[T]
NewTransportFactory creates a new TransportFactory.