Documentation
¶
Index ¶
Constants ¶
const ( // MetricsSubsystem is a subsystem shared by all metrics exposed by this // package. MetricsSubsystem = "avsi_connection" )
Variables ¶
var RequestInfo = &avsi.RequestInfo{ Version: version.TMCoreSemVer, BlockVersion: version.BlockProtocol, P2PVersion: version.P2PProtocol, AbciVersion: version.AVSIVersion, }
RequestInfo contains all the information for sending the avsi.RequestInfo message during handshake with the app. It contains only compile-time version information.
Functions ¶
func NewAppConnDvs ¶
Types ¶
type AppConnDvs ¶
type AppConnDvs interface {
Error() error
ProcessDVSRequest(context.Context, *types.RequestProcessDVSRequest) (*types.ResponseProcessDVSRequest, error)
ProcessDVSResponse(context.Context, *types.RequestProcessDVSResponse) (*types.ResponseProcessDVSResponse, error)
}
type AppConnQuery ¶
type AppConnQuery interface {
Error() error
Echo(context.Context, string) (*types.ResponseEcho, error)
Info(context.Context, *types.RequestInfo) (*types.ResponseInfo, error)
Query(context.Context, *types.RequestQuery) (*types.ResponseQuery, error)
}
func NewAppConnQuery ¶
func NewAppConnQuery(appConn avsicli.Client, metrics *Metrics) AppConnQuery
type AppConns ¶
type AppConns interface {
service.Service
// Dvs connection
Dvs() AppConnDvs
// Query connection
Query() AppConnQuery
}
AppConns is the PellDVS'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 avsi connections to the application.
type ClientCreator ¶
type ClientCreator interface {
// NewAVSIClient returns a new avsi client.
NewAVSIClient() (avsicli.Client, error)
}
ClientCreator creates new avsi clients.
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 NewAVSIClient returns an avsi client that maintains its own mutex over the application (i.e. it is per-"connection" synchronized).
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 NewAVSIClient. For a local client creator that uses a single mutex per new client, rather use NewConnSyncLocalClientCreator.
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.
type Metrics ¶
type Metrics struct {
// Timing for each avsi 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