Documentation
¶
Index ¶
- Constants
- Variables
- type AppConnConsensus
- type AppConnMempool
- type AppConnQuery
- type AppConnSnapshot
- type AppConns
- type ChainConns
- type ClientCreator
- func DefaultClientCreator(addr, transport, dbDir string) ClientCreator
- func NewConnSyncLocalClientCreator(app types.Application) ClientCreator
- func NewConsensusSyncLocalClientCreator(app types.Application) ClientCreator
- func NewLocalClientCreator(app types.Application) ClientCreator
- func NewRemoteClientCreator(addr, transport string, mustConnect bool) ClientCreator
- func NewUnsyncLocalClientCreator(app types.Application) ClientCreator
- type Metrics
Constants ¶
const ( // MetricsSubsystem is a subsystem shared by all metrics exposed by this // package. MetricsSubsystem = "abci_connection" )
Variables ¶
var InfoRequest = &abci.InfoRequest{ Version: version.CMTSemVer, BlockVersion: version.BlockProtocol, P2PVersion: version.P2PProtocol, AbciVersion: version.ABCIVersion, }
InfoRequest contains all the information for sending the abci.InfoRequest message during handshake with the app. It contains only compile-time version information.
Functions ¶
This section is empty.
Types ¶
type AppConnConsensus ¶
type AppConnConsensus interface {
Error() error
InitChain(ctx context.Context, req *abcitypes.InitChainRequest) (*abcitypes.InitChainResponse, error)
PrepareProposal(ctx context.Context, req *abcitypes.PrepareProposalRequest) (*abcitypes.PrepareProposalResponse, error)
ProcessProposal(ctx context.Context, req *abcitypes.ProcessProposalRequest) (*abcitypes.ProcessProposalResponse, error)
ExtendVote(ctx context.Context, req *abcitypes.ExtendVoteRequest) (*abcitypes.ExtendVoteResponse, error)
VerifyVoteExtension(ctx context.Context, req *abcitypes.VerifyVoteExtensionRequest) (*abcitypes.VerifyVoteExtensionResponse, error)
FinalizeBlock(ctx context.Context, req *abcitypes.FinalizeBlockRequest) (*abcitypes.FinalizeBlockResponse, error)
Commit(ctx context.Context) (*abcitypes.CommitResponse, error)
}
func NewAppConnConsensus ¶
func NewAppConnConsensus(appConn abcicli.Client, metrics *Metrics) AppConnConsensus
func NewChainConnConsensus ¶
func NewChainConnConsensus( chainID string, appConn abcicli.Client, metrics *Metrics, ) AppConnConsensus
type AppConnMempool ¶
type AppConnMempool interface {
SetResponseCallback(cb abcicli.Callback)
Error() error
CheckTx(ctx context.Context, req *abcitypes.CheckTxRequest) (*abcitypes.CheckTxResponse, error)
CheckTxAsync(ctx context.Context, req *abcitypes.CheckTxRequest) (*abcicli.ReqRes, error)
Flush(ctx context.Context) error
}
func NewAppConnMempool ¶
func NewAppConnMempool(appConn abcicli.Client, metrics *Metrics) AppConnMempool
func NewChainConnMempool ¶
func NewChainConnMempool( chainID string, appConn abcicli.Client, metrics *Metrics, ) AppConnMempool
type AppConnQuery ¶
type AppConnQuery interface {
Error() error
Echo(ctx context.Context, echo string) (*abcitypes.EchoResponse, error)
Info(ctx context.Context, req *abcitypes.InfoRequest) (*abcitypes.InfoResponse, error)
Query(ctx context.Context, req *abcitypes.QueryRequest) (*abcitypes.QueryResponse, error)
}
func NewAppConnQuery ¶
func NewAppConnQuery(appConn abcicli.Client, metrics *Metrics) AppConnQuery
func NewChainConnQuery ¶
func NewChainConnQuery( chainID string, appConn abcicli.Client, metrics *Metrics, ) AppConnQuery
type AppConnSnapshot ¶
type AppConnSnapshot interface {
Error() error
ListSnapshots(ctx context.Context, req *abcitypes.ListSnapshotsRequest) (*abcitypes.ListSnapshotsResponse, error)
OfferSnapshot(ctx context.Context, req *abcitypes.OfferSnapshotRequest) (*abcitypes.OfferSnapshotResponse, error)
LoadSnapshotChunk(ctx context.Context, req *abcitypes.LoadSnapshotChunkRequest) (*abcitypes.LoadSnapshotChunkResponse, error)
ApplySnapshotChunk(ctx context.Context, req *abcitypes.ApplySnapshotChunkRequest) (*abcitypes.ApplySnapshotChunkResponse, error)
}
func NewAppConnSnapshot ¶
func NewAppConnSnapshot(appConn abcicli.Client, metrics *Metrics) AppConnSnapshot
func NewChainConnSnapshot ¶
func NewChainConnSnapshot( chainID string, appConn abcicli.Client, metrics *Metrics, ) AppConnSnapshot
type AppConns ¶
type AppConns interface {
service.Service
// Mempool connection
Mempool() AppConnMempool
// Consensus connection
Consensus() AppConnConsensus
// Query connection
Query() AppConnQuery
// Snapshot connection
Snapshot() AppConnSnapshot
}
AppConns is the CometBFT's interface to the application that consists of multiple connections.
func NewAppConns ¶
func NewAppConns(clientCreator ClientCreator, metrics *Metrics) AppConns
NewAppConns calls NewMultiAppConn.
func NewMultiAppConn ¶
func NewMultiAppConn(clientCreator ClientCreator, metrics *Metrics) AppConns
NewMultiAppConn makes all necessary abci connections to the application.
type ChainConns ¶
type ChainConns interface {
service.Service
// Add a network connection pool
AddNetwork(chainID string)
// Mempool connection
Mempool(chainID string) AppConnMempool
// Consensus connection
Consensus(chainID string) AppConnConsensus
// Query connection
Query(chainID string) AppConnQuery
// Snapshot connection
Snapshot(chainID string) AppConnSnapshot
// Convert to be AppConns compatible
ToAppConns(chainID string) AppConns
}
ChainConns is a breaking upgrade to AppConns which passes a ChainID to connection methods such that the right connections are used.
Note that only one shared ABCI client is used by all replicated chains. On the other hand, we create x connections with the client, one per replicated chain. Each of these connections injects the correct ChainID to ABCI requests sent through the shared client.
Return types of methods defined by this interface are compatible with AppConns to prevent breaking the ABCI integration.
func NewChainConns ¶
func NewChainConns( chainIds []string, clientCreator ClientCreator, metrics *Metrics, ) ChainConns
NewChainConns calls NewMultiplexAppConn.
func NewMultiplexAppConn ¶
func NewMultiplexAppConn( chainIds []string, clientCreator ClientCreator, metrics *Metrics, ) ChainConns
NewMultiplexAppConn makes all necessary abci connections to the application for a slice of replicated chains by ChainID.
type ClientCreator ¶
type ClientCreator interface {
// NewABCIConsensusClient creates an ABCI client for handling
// consensus-related queries.
NewABCIConsensusClient() (abcicli.Client, error)
// NewABCIMempoolClient creates an ABCI client for handling mempool-related
// queries.
NewABCIMempoolClient() (abcicli.Client, error)
// NewABCIQueryClient creates an ABCI client for handling
// query/info-related queries.
NewABCIQueryClient() (abcicli.Client, error)
// NewABCISnapshotClient creates an ABCI client for handling
// snapshot-related queries.
NewABCISnapshotClient() (abcicli.Client, error)
}
ClientCreator creates new ABCI clients based on the intended use of the client.
func DefaultClientCreator ¶
func DefaultClientCreator(addr, transport, dbDir string) ClientCreator
DefaultClientCreator returns a default ClientCreator, which will create a local client if addr is one of "kvstore", "persistent_kvstore", "e2e", "noop".
Otherwise a remote client will be created.
Each of "kvstore", "persistent_kvstore" and "e2e" also currently have an "_connsync" variant (i.e. "kvstore_connsync", etc.), which attempts to replicate the same concurrency model as the remote client.
func NewConnSyncLocalClientCreator ¶
func NewConnSyncLocalClientCreator(app types.Application) ClientCreator
NewConnSyncLocalClientCreator returns a local ClientCreator for the given app.
Unlike NewLocalClientCreator, this is a "connection-synchronized" local client creator, meaning each call to NewABCIClient returns an ABCI client that maintains its own mutex over the application (i.e. it is per-"connection" synchronized).
func NewConsensusSyncLocalClientCreator ¶
func NewConsensusSyncLocalClientCreator(app types.Application) ClientCreator
NewConsensusSyncLocalClientCreator returns a ClientCreator with a more advanced concurrency model than that provided by NewLocalClientCreator or NewConnSyncLocalClientCreator.
In this model (a "consensus-synchronized" model), only the consensus client has a mutex over it to serialize consensus interactions. With all other clients (mempool, query, snapshot), enforcing synchronization is left up to the app.
func NewLocalClientCreator ¶
func NewLocalClientCreator(app types.Application) ClientCreator
NewLocalClientCreator returns a ClientCreator for the given app, which will be running locally.
Maintains a single mutex over all new clients created with NewABCIClient.
func NewRemoteClientCreator ¶
func NewRemoteClientCreator(addr, transport string, mustConnect bool) ClientCreator
NewRemoteClientCreator returns a ClientCreator for the given address (e.g. "192.168.0.1") and transport (e.g. "tcp"). Set mustConnect to true if you want the client to connect before reporting success.
func NewUnsyncLocalClientCreator ¶
func NewUnsyncLocalClientCreator(app types.Application) ClientCreator
NewUnsyncLocalClientCreator returns a ClientCreator that is fully unsynchronized, meaning that all synchronization must be handled by the application. This is an advanced type of client creator, and requires special care on the application side to ensure that consensus concurrency is not violated.
type Metrics ¶
type Metrics struct {
// Timing for each ABCI method.
MethodTimingSeconds metrics.Histogram `metrics_bucketsizes:".0001,.0004,.002,.009,.02,.1,.65,2,6,25" metrics_labels:"method, type"`
}
Metrics contains the prometheus metrics exposed by the proxy package.
func NopMetrics ¶
func NopMetrics() *Metrics