Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler[T any] struct { // contains filtered or unexported fields }
Handler implements the delegate.ServerTransportHandler interface.
It receives Commands sequentially and executes each in a separate goroutine using the Invoker.
If an error occurs, the Handler closes the transport connection.
type Invoker ¶
type Invoker[T any] interface { Invoke(ctx context.Context, seq core.Seq, at time.Time, bytesRead int, cmd core.Cmd[T], proxy core.Proxy) error }
Invoker executes Commands on the server.
A single Invoker instance handles Commands concurrently in separate goroutines, so it must be thread-safe. The Invoke method can act as a central handler for common operations across multiple Commands, such as logging.
type InvokerFn ¶
type InvokerFn[T any] func(ctx context.Context, seq core.Seq, at time.Time, bytesRead int, cmd core.Cmd[T], proxy core.Proxy) error
InvokerFn is a functional implementation of the Invoker interface.
type Proxy ¶
type Proxy[T any] struct { // contains filtered or unexported fields }
Proxy implemets the core.Proxy interface.
func (Proxy[T]) RemoteAddr ¶
type SetOption ¶
type SetOption func(o *Options)
func WithAt ¶
func WithAt() SetOption
WithAt enables the "at" flag. When enabled, the Handler passes the command's received timestamp to Invoker.Invoke().
func WithCmdReceiveDuration ¶
WithCmdReceiveDuration sets the maximum time the Handler will wait for a command. If no command arrives within this duration, the connection is closed. A duration of 0 means the Handler will wait indefinitely.