abcicli

package
v0.38.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(*types.Request, *types.Response)

type Client

type Client interface {
	service.Service
	types.Application

	// TODO: remove as each method now returns an error
	Error() error
	// TODO: remove as this is not implemented
	Flush(context.Context) error
	Echo(context.Context, string) (*types.ResponseEcho, error)

	// FIXME: All other operations are run synchronously and rely
	// on the caller to dictate concurrency (i.e. run a go routine),
	// with the exception of `CheckTxAsync` which we maintain
	// for the v0 mempool. We should explore refactoring the
	// mempool to remove this vestige behavior.
	SetResponseCallback(Callback)
	CheckTxAsync(context.Context, *types.RequestCheckTx) (*ReqRes, 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

func NewClient(addr, transport string, mustConnect bool) (client Client, err error)

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

func NewGRPCClient(addr string, mustConnect bool) Client

func NewLocalClient

func NewLocalClient(mtx *cmtsync.Mutex, app types.Application) Client

NewLocalClient creates a local client, which wraps the application interface that Tendermint as the client will call to the application as the server. The only difference, is that the local client has a global mutex which enforces serialization of all the ABCI calls from Tendermint to the Application.

func NewSocketClient

func NewSocketClient(addr string, mustConnect bool) Client

NewSocketClient creates a new socket client, which connects to a given address. If mustConnect is true, the client will return an error upon start if it fails to connect else it will continue to retry.

type ReqRes

type ReqRes struct {
	*types.Request
	*sync.WaitGroup
	*types.Response // Not set atomically, so be sure to use WaitGroup.
	// contains filtered or unexported fields
}

func NewReqRes

func NewReqRes(req *types.Request) *ReqRes

func (*ReqRes) GetCallback

func (r *ReqRes) GetCallback() func(*types.Response)

GetCallback returns the configured callback of the ReqRes object which may be nil. Note, it is not safe to concurrently call this in cases where it is marked done and SetCallback is called before calling GetCallback as that will invoke the callback twice and create a potential race condition.

ref: https://github.com/tendermint/tendermint/issues/5439

func (*ReqRes) InvokeCallback

func (r *ReqRes) InvokeCallback()

InvokeCallback invokes a thread-safe execution of the configured callback if non-nil.

func (*ReqRes) SetCallback

func (r *ReqRes) SetCallback(cb func(res *types.Response))

Sets sets the callback. If reqRes is already done, it will call the cb immediately. Note, reqRes.cb should not change if reqRes.done and only one callback is supported.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL