Documentation
¶
Index ¶
- func MakeClient[T any](codec cln.Codec[T], conn net.Conn, ops ...cln.SetOption) (client *ccln.Client[T], err error)
- func MakeClientGroup[T any](clientsCount int, codec cln.Codec[T], factory cln.ConnFactory, ...) (group grp.ClientGroup[T], err error)
- func MakeReconnectClient[T any](codec cln.Codec[T], factory cln.ConnFactory, ops ...cln.SetOption) (client *ccln.Client[T], err error)
- func MakeServer[T any](codec srv.Codec[T], invoker handler.Invoker[T], ops ...srv.SetOption) *csrv.Server
- func NewMakeClientsError(count int, cause error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeClient ¶ added in v0.4.1
func MakeClient[T any](codec cln.Codec[T], conn net.Conn, ops ...cln.SetOption) ( client *ccln.Client[T], err error)
MakeClient creates and initializes a new cmd-stream client.
It adapts the provided codec and applies optional configuration for transport, delegation, and keepalive behavior.
Parameters:
- codec: Codec used for encoding Commands / decoding Results.
- conn: The underlying network connection.
- ops: Optional configuration settings.
Returns an error if setup fails at any step (e.g., delegate creation).
func MakeClientGroup ¶ added in v0.4.1
func MakeClientGroup[T any](clientsCount int, codec cln.Codec[T], factory cln.ConnFactory, ops ...grp.SetOption[T], ) (group grp.ClientGroup[T], err error)
MakeClientGroup creates a new ClientGroup with the specified number of clients.
If the Reconnect option is enabled, reconnect-capable clients are created. The default dispatch strategy is round-robin.
Parameters:
- clientsCount: Number of clients to create.
- codec: Codec used for encoding Commands and decoding Results.
- factory: Connection factory for establishing client connections.
- ops: Optional group-level configuration (e.g., dispatch strategy, reconnect, client options).
If client creation fails, the function returns an error along with a group containing the successfully created clients.
func MakeReconnectClient ¶ added in v0.4.1
func MakeReconnectClient[T any](codec cln.Codec[T], factory cln.ConnFactory, ops ...cln.SetOption) (client *ccln.Client[T], err error)
MakeReconnectClient creates a new cmd-stream client with support for automatic reconnection (which occurs if the Codec.Decode method encounters a network error).
It sets up a reconnect-aware delegate using the provided codec, connection factory, and optional configuration settings.
Parameters:
- codec: Codec used for encoding Commands and decoding Results.
- factory: Connection factory used to establish new connections.
- ops: Optional client configuration settings.
Returns an error if setup fails at any step (e.g., during delegate creation).
func MakeServer ¶ added in v0.4.1
func MakeServer[T any](codec srv.Codec[T], invoker handler.Invoker[T], ops ...srv.SetOption) *csrv.Server
MakeServer creates a new cmd-stream server.
It applies optional configuration to initialize transport, handler, and delegate components before creating the server instance.
Parameters:
- codec: Codec used for decoding incoming Commands and encoding outgoing Results.
- invoker: Executes the Commands.
- ops: Optional server configuration (e.g., transport, handler, delegate, core settings).
Returns a fully initialized server.
func NewMakeClientsError ¶ added in v0.4.1
NewMakeClientsError creates an error indicating a failure to create the specified number of clients.
Types ¶
This section is empty.