connections

package
v0.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 19 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 Client

type Client interface {
	ABCIQueryWithOptions(ctx context.Context, path string, data bytes.HexBytes, opts client.ABCIQueryOptions) (*core.ResultABCIQuery, 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)
}

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

type ConnectionContext

type ConnectionContext interface {
	GetNetworkGroup() NetworkGroup
	GetNodeType() config.NodeType
	GetMetrics() *NodeMetrics
	GetAddress() string
	SetNodeUrl(addr *url.URL)
	GetClient() Client
	IsHealthy() bool
	ReportError(err error)
	ReportErrorStatus(status NodeStatus)
	ClearErrors()
}

type ConnectionInitializer

type ConnectionInitializer interface {
	ConnectionManager
	InitClients(*local.Local, StatusChecker) error
	ConnectDirectly(other ConnectionManager) error
}

func NewConnectionManager

func NewConnectionManager(config *config.Config, logger log.Logger) ConnectionInitializer

type ConnectionManager

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

func NewFakeConnectionManager

func NewFakeConnectionManager(clients map[string]Client) ConnectionManager

type MockClient

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

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) ABCIQueryWithOptions

func (m *MockClient) ABCIQueryWithOptions(ctx context.Context, path string, data bytes.HexBytes, opts client.ABCIQueryOptions) (*coretypes.ResultABCIQuery, error)

ABCIQueryWithOptions mocks base method.

func (*MockClient) BroadcastTxAsync

func (m *MockClient) BroadcastTxAsync(arg0 context.Context, arg1 types.Tx) (*coretypes.ResultBroadcastTx, error)

BroadcastTxAsync mocks base method.

func (*MockClient) BroadcastTxSync

func (m *MockClient) BroadcastTxSync(arg0 context.Context, arg1 types.Tx) (*coretypes.ResultBroadcastTx, error)

BroadcastTxSync mocks base method.

func (*MockClient) CheckTx

func (m *MockClient) CheckTx(ctx context.Context, tx types.Tx) (*coretypes.ResultCheckTx, error)

CheckTx mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) ABCIQueryWithOptions

func (mr *MockClientMockRecorder) ABCIQueryWithOptions(ctx, path, data, opts interface{}) *gomock.Call

ABCIQueryWithOptions indicates an expected call of ABCIQueryWithOptions.

func (*MockClientMockRecorder) BroadcastTxAsync

func (mr *MockClientMockRecorder) BroadcastTxAsync(arg0, arg1 interface{}) *gomock.Call

BroadcastTxAsync indicates an expected call of BroadcastTxAsync.

func (*MockClientMockRecorder) BroadcastTxSync

func (mr *MockClientMockRecorder) BroadcastTxSync(arg0, arg1 interface{}) *gomock.Call

BroadcastTxSync indicates an expected call of BroadcastTxSync.

func (*MockClientMockRecorder) CheckTx

func (mr *MockClientMockRecorder) CheckTx(ctx, tx interface{}) *gomock.Call

CheckTx indicates an expected call of CheckTx.

type NetworkGroup

type NetworkGroup int
const (
	Local NetworkGroup = iota
	SameSubnet
	OtherSubnet
)

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