Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncResult ¶
AsyncResult represents an asynchronous result.
Seq is the sequence number of the Command, Error != nil if something went wrong with the connection.
type Cmd ¶
type Cmd[T any] interface { Exec(ctx context.Context, seq Seq, at time.Time, receiver T, proxy Proxy) error }
Cmd defines the general Command interface.
The Exec method is invoked by the server's Invoker and is responsible for executing the Command with the following parameters:
- ctx: Execution context.
- seq: Sequence number uniquely identifying the Command.
- at: Timestamp when the server received the Command.
- receiver: The Receiver of type T, which handles the Command's execution logic.
- proxy: A server transport proxy used to send Results back to the client.
type Listener ¶
type Listener interface { Addr() net.Addr SetDeadline(time.Time) error Accept() (net.Conn, error) Close() error }
Listener is a server network listener.
On Close, it should not close already accepted connections.
type Proxy ¶
type Proxy interface { LocalAddr() net.Addr RemoteAddr() net.Addr Send(seq Seq, result Result) (n int, err error) SendWithDeadline(seq Seq, result Result, deadline time.Time) (n int, err error) }
Proxy represents a server transport proxy, enabling Commands to send Results back.
Implementation of this interface must be thread-safe.
Click to show internal directories.
Click to hide internal directories.