Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LeaderElectionAdapter ¶
type LeaderElectionAdapter interface { // Gossip gossips a message to other peers Gossip(Msg) // Accept returns a channel that emits messages Accept() <-chan Msg // CreateProposalMessage CreateMessage(isDeclaration bool) Msg // Peers returns a list of peers considered alive Peers() []Peer }
LeaderElectionAdapter is used by the leader election module to send and receive messages and to get membership information
func NewAdapter ¶
func NewAdapter(gossip gossip, self *discovery.NetworkMember, mcs MsgCrypto, channel common.ChainID) LeaderElectionAdapter
NewAdapter creates new leader election adapter
type LeaderElectionService ¶
type LeaderElectionService interface { // IsLeader returns whether this peer is a leader or not IsLeader() bool // Stop stops the LeaderElectionService Stop() }
LeaderElectionService is the object that runs the leader election algorithm
func NewLeaderElectionService ¶
func NewLeaderElectionService(adapter LeaderElectionAdapter, id string, callback leadershipCallback) LeaderElectionService
NewLeaderElectionService returns a new LeaderElectionService
type Msg ¶
type Msg interface { // SenderID returns the ID of the peer sent the message SenderID() string // IsProposal returns whether this message is a leadership proposal IsProposal() bool // IsDeclaration returns whether this message is a leadership declaration IsDeclaration() bool }
Msg describes a message sent from a remote peer
type MsgCrypto ¶
type MsgCrypto interface { // Sign signs a message, returns a signed message on success // or an error on failure Sign(msg []byte) ([]byte, error) // Verify verifies a signed message Verify(vkID, signature, message []byte) error // Get returns the identity of a given pkiID, or error if such an identity // isn't found Get(pkiID common.PKIidType) (api.PeerIdentityType, error) }
MsgCrypto used to sign messages and verify received messages signatures
Click to show internal directories.
Click to hide internal directories.