Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ServerInfo = []byte("default")
ServerInfo is the default ServerInfo.
Functions ¶
func AdaptCodec ¶ added in v0.4.1
AdaptCodec adapts the provided Codec.
Types ¶
type Codec ¶
Codec defines a generic server codec interface for encoding Results and decoding Commands.
- Encode is used by the server to send Results back to the client. If encoding fails, the server closes the corresponding client connection.
- Decode is used by the server to receive Commands. If decoding fails, the server closes the corresponding client connection.
type Invoker ¶ added in v0.1.1
type Invoker[T any] struct { // contains filtered or unexported fields }
Invoker is the default implementation of the handler.Invoker interface.
It performs no additional actions other than executing the provided Command.
func NewInvoker ¶ added in v0.4.0
NewInvoker creates a new Invoker.
type Options ¶ added in v0.4.0
type Options struct { Info delegate.ServerInfo Base []csrv.SetOption Delegate []dsrv.SetOption Handler []handler.SetOption Transport []transport.SetOption }
Options defines the configuration settings for initializing a server.
These options are composed of modular components that configure different layers of the server, including transport, handler logic, delegate behavior, and base server 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 server delegate.
func WithHandler ¶ added in v0.4.0
func WithHandler(ops ...handler.SetOption) SetOption
WithHandler sets options for the connection handler.
These options customize the behavior of the connection handler.
func WithServerInfo ¶ added in v0.4.0
func WithServerInfo(info delegate.ServerInfo) SetOption
WithServerInfo sets the ServerInfo for the server.
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 ¶
type TransportFactory[T any] struct { // contains filtered or unexported fields }
TransportFactory implements the delegate.ServerTransportFactory interface.
It creates Transports that handle encoding Results / decoding Commands over a network connection.
func NewTransportFactory ¶ added in v0.4.1
func NewTransportFactory[T any](codec transport.Codec[core.Result, core.Cmd[T]], ops ...transport.SetOption, ) *TransportFactory[T]
NewTransportFactory creates a new TransportFactory using the provided codec and optional transport-level configuration options.