connections

package
v1.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const UnhealthyNodeCheckInterval = time.Minute * 10 // TODO Configurable in toml?

Variables

This section is empty.

Functions

This section is empty.

Types

type ABCIClient

type ABCIClient interface {
	ABCIQueryWithOptions(ctx context.Context, path string, data bytes.HexBytes, opts client.ABCIQueryOptions) (*core.ResultABCIQuery, error)
	Status(context.Context) (*core.ResultStatus, error)
	CheckTx(ctx context.Context, tx tm.Tx) (*core.ResultCheckTx, error)
	BroadcastTxAsync(context.Context, tm.Tx) (*core.ResultBroadcastTx, error)
	BroadcastTxSync(context.Context, tm.Tx) (*core.ResultBroadcastTx, error)
}

ABCIClient is a subset of from TM/rpc/client.ABCIClient.

type APIClient

type APIClient interface {
	RequestAPIv2(_ context.Context, method string, params, result interface{}) error
}

type ConnectionContext

type ConnectionContext interface {
	GetNetworkGroup() NetworkGroup
	GetNodeType() config.NodeType
	GetMetrics() *NodeMetrics
	GetAddress() string
	GetBasePort() int
	SetNodeUrl(addr *url.URL)
	GetABCIClient() ABCIClient
	GetAPIClient() APIClient
	IsHealthy() bool
	ReportError(err error)
	ReportErrorStatus(status NodeStatus)
	ClearErrors()
}

type ConnectionInitializer

type ConnectionInitializer interface {
	ConnectionManager
	InitClients(client.Client, StatusChecker) error
	ConnectDirectly(other ConnectionManager) error
}

func NewConnectionManager

func NewConnectionManager(config *config.Config, logger log.Logger, apiClientFactory func(string) (APIClient, error)) ConnectionInitializer

type ConnectionManager

type ConnectionManager interface {
	SelectConnection(partitionId string, allowFollower bool) (ConnectionContext, error)
}

type FakeClient

type FakeClient = struct {
	ABCI ABCIClient
	API  APIClient
}

type FakeConnectionManager

type FakeConnectionManager interface {
	ConnectionManager
	SetClients(clients map[string]FakeClient)
}

func NewFakeConnectionManager

func NewFakeConnectionManager(partitions []string) FakeConnectionManager

type NetworkGroup

type NetworkGroup int
const (
	Local NetworkGroup = iota
	SamePartition
	OtherPartition
)

type NodeMetrics

type NodeMetrics struct {
	// contains filtered or unexported fields
}

type NodeStatus

type NodeStatus int
const (
	Up           NodeStatus = iota // Healthy & ready to go
	Down                           // Not reachable
	OutOfService                   // Reachable but not ready to go (IE. still syncing up)
	Unknown                        // Not checked yet
)

type StatusChecker

type StatusChecker interface {
	IsStatusOk(connCtx ConnectionContext) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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