Documentation ¶
Overview ¶
Package abciclient provides an ABCI implementation in Go.
There are 3 clients available:
- socket (unix or TCP)
- local (in memory)
- gRPC
## Socket client
The client blocks for enqueuing the request, for enqueuing the Flush to send the request, and for the Flush response to return.
## Local client
The global mutex is locked during each call ¶
## gRPC client
The client waits for all calls to complete.
Index ¶
- type Client
- func NewClient(logger log.Logger, addr, transport string, mustConnect bool) (Client, error)
- func NewGRPCClient(logger log.Logger, addr string, mustConnect bool) Client
- func NewLocalClient(logger log.Logger, app types.Application) Client
- func NewRoutedClient(logger log.Logger, defaultClient Client, routing Routing) (Client, error)
- func NewRoutedClientWithAddr(logger log.Logger, addr string, mustConnect bool) (Client, error)
- func NewSocketClient(logger log.Logger, addr string, mustConnect bool) Client
- type ClientInfo
- type RequestType
- type Routing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { service.Service types.Application Error() error Flush(context.Context) error Echo(context.Context, string) (*types.ResponseEcho, error) }
Client defines the interface for an ABCI client.
NOTE these are client errors, eg. ABCI socket connectivity issues. Application-related errors are reflected in response via ABCI error codes and (potentially) error response.
func NewClient ¶
NewClient returns a new ABCI client of the specified transport type. It returns an error if the transport is not "socket" or "grpc"
func NewGRPCClient ¶
NewGRPCClient creates a gRPC client, which will connect to addr upon the start. Note Client#Start returns an error if connection is unsuccessful and mustConnect is true.
func NewLocalClient ¶
func NewLocalClient(logger log.Logger, app types.Application) Client
NewLocalClient creates a local client, which will be directly calling the methods of the given app.
The client methods ignore their context argument.
func NewRoutedClient ¶ added in v1.0.0
NewRoutedClient returns a new ABCI client that routes requests to the appropriate underlying client based on the request type.
Arguments ¶
- `logger` - The logger to use for the client.
- `defaultClient` - The default client to use when no specific client is configured for a request type.
- `routing` - The clients to route requests to.
See docs of routedClient.delegate() for more details about implemented logic.
func NewRoutedClientWithAddr ¶ added in v1.0.0
NewRoutedClientWithAddr returns a new ABCI client that routes requests to multiple underlying clients based on the request type.
It takes a comma-separated list of routing rules, consisting of colon-separated: request type, transport, address. Special request type "*" is used for default client.
Example:
```
"Info:socket:unix:///tmp/socket.1,Info:socket:unix:///tmp/socket.2,CheckTx:socket:unix:///tmp/socket.1,*:socket:unix:///tmp/socket.3"
```
Arguments ¶
- `logger` - The logger to use for the client.
- `addr` - comma-separated list of routing rules, consisting of request type, transport name and client address separated with colon. Special request type "*" is used for default client.
type ClientInfo ¶ added in v1.0.0
type RequestType ¶ added in v1.0.0
type RequestType string
type Routing ¶ added in v1.0.0
type Routing map[RequestType][]ClientInfo