local

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Local

type Local struct {
	*types.EventBus
	Logger log.Logger
	// contains filtered or unexported fields
}

Local is a Client implementation that directly executes the rpc functions on a given node, without going through HTTP or GRPC.

This implementation is useful for:

* Running tests against a node in-process without the overhead of going through an http server * Communication between an ABCI app and CometBFT when they are compiled in process.

For real clients, you probably want to use client.HTTP. For more powerful control during testing, you probably want the "client/mock" package.

You can subscribe for any event published by CometBFT using Subscribe method. Note delivery is best-effort. If you don't read events fast enough, CometBFT might cancel the subscription. The client will attempt to resubscribe (you don't need to do anything). It will keep trying indefinitely with exponential backoff (10ms -> 20ms -> 40ms) until successful.

func New

func New(node *nm.Node) *Local

NewLocal configures a client that calls the Node directly.

func (*Local) ABCIInfo

func (c *Local) ABCIInfo(context.Context) (*ctypes.ResultABCIInfo, error)

func (*Local) ABCIQuery

func (c *Local) ABCIQuery(ctx context.Context, path string, data bytes.HexBytes) (*ctypes.ResultABCIQuery, error)

func (*Local) ABCIQueryWithOptions

func (c *Local) ABCIQueryWithOptions(
	_ context.Context,
	path string,
	data bytes.HexBytes,
	opts rpcclient.ABCIQueryOptions,
) (*ctypes.ResultABCIQuery, error)

func (*Local) Block

func (c *Local) Block(_ context.Context, height *int64) (*ctypes.ResultBlock, error)

func (*Local) BlockByHash

func (c *Local) BlockByHash(_ context.Context, hash []byte) (*ctypes.ResultBlock, error)

func (*Local) BlockResults

func (c *Local) BlockResults(_ context.Context, height *int64) (*ctypes.ResultBlockResults, error)

func (*Local) BlockSearch

func (c *Local) BlockSearch(
	_ context.Context,
	query string,
	page, perPage *int,
	orderBy string,
) (*ctypes.ResultBlockSearch, error)

func (*Local) BlockchainInfo

func (c *Local) BlockchainInfo(_ context.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

func (*Local) BroadcastEvidence

func (c *Local) BroadcastEvidence(_ context.Context, ev types.Evidence) (*ctypes.ResultBroadcastEvidence, error)

func (*Local) BroadcastTxAsync

func (c *Local) BroadcastTxAsync(_ context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*Local) BroadcastTxCommit

func (c *Local) BroadcastTxCommit(_ context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

func (*Local) BroadcastTxSync

func (c *Local) BroadcastTxSync(_ context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*Local) CheckTx

func (c *Local) CheckTx(_ context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error)

func (*Local) Commit

func (c *Local) Commit(_ context.Context, height *int64) (*ctypes.ResultCommit, error)

func (*Local) ConsensusParams

func (c *Local) ConsensusParams(_ context.Context, height *int64) (*ctypes.ResultConsensusParams, error)

func (*Local) ConsensusState

func (c *Local) ConsensusState(context.Context) (*ctypes.ResultConsensusState, error)

func (*Local) DialPeers

func (c *Local) DialPeers(
	_ context.Context,
	peers []string,
	persistent,
	unconditional,
	private bool,
) (*ctypes.ResultDialPeers, error)

func (*Local) DialSeeds

func (c *Local) DialSeeds(_ context.Context, seeds []string) (*ctypes.ResultDialSeeds, error)

func (*Local) DumpConsensusState

func (c *Local) DumpConsensusState(context.Context) (*ctypes.ResultDumpConsensusState, error)

func (*Local) Genesis

func (c *Local) Genesis(context.Context) (*ctypes.ResultGenesis, error)

func (*Local) GenesisChunked

func (c *Local) GenesisChunked(_ context.Context, id uint) (*ctypes.ResultGenesisChunk, error)

func (*Local) Header

func (c *Local) Header(_ context.Context, height *int64) (*ctypes.ResultHeader, error)

func (*Local) HeaderByHash

func (c *Local) HeaderByHash(_ context.Context, hash bytes.HexBytes) (*ctypes.ResultHeader, error)

func (*Local) Health

func (c *Local) Health(context.Context) (*ctypes.ResultHealth, error)

func (*Local) NetInfo

func (c *Local) NetInfo(context.Context) (*ctypes.ResultNetInfo, error)

func (*Local) NumUnconfirmedTxs

func (c *Local) NumUnconfirmedTxs(context.Context) (*ctypes.ResultUnconfirmedTxs, error)

func (*Local) SetLogger

func (c *Local) SetLogger(l log.Logger)

SetLogger allows to set a logger on the client.

func (*Local) Status

func (c *Local) Status(context.Context) (*ctypes.ResultStatus, error)

func (*Local) Subscribe

func (c *Local) Subscribe(
	ctx context.Context,
	subscriber,
	query string,
	outCapacity ...int,
) (out <-chan ctypes.ResultEvent, err error)

func (*Local) Tx

func (c *Local) Tx(_ context.Context, hash []byte, prove bool) (*ctypes.ResultTx, error)

func (*Local) TxSearch

func (c *Local) TxSearch(
	_ context.Context,
	query string,
	prove bool,
	page,
	perPage *int,
	orderBy string,
) (*ctypes.ResultTxSearch, error)

func (*Local) UnconfirmedTxs

func (c *Local) UnconfirmedTxs(_ context.Context, limit *int) (*ctypes.ResultUnconfirmedTxs, error)

func (*Local) Unsubscribe

func (c *Local) Unsubscribe(ctx context.Context, subscriber, query string) error

func (*Local) UnsubscribeAll

func (c *Local) UnsubscribeAll(ctx context.Context, subscriber string) error

func (*Local) Validators

func (c *Local) Validators(_ context.Context, height *int64, page, perPage *int) (*ctypes.ResultValidators, error)

Jump to

Keyboard shortcuts

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