Documentation ¶
Overview ¶
Package consensus provides BFT-like algorithm to distribute list of records between participants
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Communicator ¶
type Communicator interface { // ExchangeData used in first consensus step to exchange data between participants ExchangeData(ctx context.Context, p Participant, data []*core.ActiveNode) ([]*core.ActiveNode, error) // ExchangeHash used in second consensus step to exchange only hashes of merged data vectors ExchangeHash(ctx context.Context, p Participant, data []byte) ([]byte, error) }
Communicator interface is used to exchange messages between participants
type Consensus ¶
type Consensus interface { // DoConsensus is sync method, it make all consensus steps and returns boolean result // method should be executed in goroutine DoConsensus(ctx context.Context, self Participant, allParticipants []*Participant) (bool, error) }
Consensus interface provides method to make consensus between participants
func NewConsensus ¶
func NewConsensus(provider DataProvider, communicator Communicator) (Consensus, error)
NewConsensus creates consensus
type DataProvider ¶
type DataProvider interface { GetDataList() []*core.ActiveNode MergeDataList([]*core.ActiveNode) error }
DataProvider for data manipulation
type Participant ¶
type Participant interface {
GetActiveNode() *core.ActiveNode
}
Participant describes one consensus participant
Click to show internal directories.
Click to hide internal directories.