quorum

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDialTimeout when resolving node id using TCP connection
	DefaultDialTimeout = 1000 * time.Millisecond
	// DefaultConnectionTimeout is a connection timeout when resolving node id using TCP connection
	DefaultConnectionTimeout = 1 * time.Second
)

Variables

This section is empty.

Functions

func NewTCPNodeIDResolver

func NewTCPNodeIDResolver() p2p.NodeIDResolver

NewTCPNodeIDResolver creates new NodeIDResolver that connects to remote host with p2p protocol and derives node ID from remote p2p public key.

func WithLogger

func WithLogger(logger log.Logger) func(vc *ValidatorConnExecutor) error

WithLogger sets a logger

func WithValidatorsSet

func WithValidatorsSet(valSet *types.ValidatorSet) func(vc *ValidatorConnExecutor) error

WithValidatorsSet sets the validators and quorum-hash as default values

Types

type ValidatorConnExecutor

type ValidatorConnExecutor struct {
	*service.BaseService

	// EventBusCapacity sets event bus buffer capacity, defaults to 10
	EventBusCapacity int
	// contains filtered or unexported fields
}

ValidatorConnExecutor retrieves validator update events and establishes new validator connections within the ValidatorSet. If it's already connected to a member of current validator set, it will keep that connection. Otherwise, it will randomly select some members of the active validator set and connect to them, to ensure it has connectivity with at least `NumConnections` members of the active validator set.

Note that we mark peers that are members of active validator set as Persistent, so p2p subsystem will retry the connection if it fails.

func NewValidatorConnExecutor

func NewValidatorConnExecutor(
	proTxHash types.ProTxHash,
	eventBus *eventbus.EventBus,
	connMgr p2p.DashDialer,
	opts ...optionFunc,
) (*ValidatorConnExecutor, error)

NewValidatorConnExecutor creates a Service that connects to other validators within the same Validator Set. Don't forget to Start() and Stop() the service.

func (*ValidatorConnExecutor) OnStart

func (vc *ValidatorConnExecutor) OnStart(ctx context.Context) error

OnStart implements Service to subscribe to Validator Update events

func (*ValidatorConnExecutor) OnStop

func (vc *ValidatorConnExecutor) OnStop()

OnStop implements Service to clean up (unsubscribe from all events, stop timers, etc.)

Directories

Path Synopsis
Package selectpeers is package contains algorithm that selects peers based on the deterministic connection selection algorithm described in DIP-6
Package selectpeers is package contains algorithm that selects peers based on the deterministic connection selection algorithm described in DIP-6

Jump to

Keyboard shortcuts

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