Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAliveExpirationCheckInterval ¶
SetAliveExpirationCheckInterval sets the expiration check interval
func SetAliveTimeInternal ¶
SetAliveTimeInternal sets the alive time interval
func SetExpirationTimeout ¶
SetExpirationTimeout sets the expiration timeout
func SetReconnectInterval ¶
SetReconnectInterval sets the reconnect interval
Types ¶
type CommService ¶
type CommService interface { // Gossip gossips a message Gossip(msg *proto.GossipMessage) // SendToPeer sends to a given peer a message. // The nonce can be anything since the communication module handles the nonce itself SendToPeer(peer *NetworkMember, msg *proto.GossipMessage) // Ping probes a remote peer and returns if it's responsive or not Ping(peer *NetworkMember) bool // Accept returns a read-only channel for membership messages sent from remote peers Accept() <-chan *proto.GossipMessage // PresumedDead returns a read-only channel for peers that are presumed to be dead PresumedDead() <-chan common.PKIidType // CloseConn orders to close the connection with a certain peer CloseConn(peer *NetworkMember) }
CommService is an interface that the discovery expects to be implemented and passed on creation
type CryptoService ¶
type CryptoService interface { // ValidateAliveMsg validates that an Alive message is authentic ValidateAliveMsg(*proto.GossipMessage) bool // SignMessage signs a message SignMessage(m *proto.GossipMessage) *proto.GossipMessage }
CryptoService is an interface that the discovery expects to be implemented and passed on creation
type Discovery ¶
type Discovery interface { // Self returns this instance's membership information Self() NetworkMember // UpdateMetadata updates this instance's metadata UpdateMetadata([]byte) // UpdateEndpoint updates this instance's endpoint UpdateEndpoint(string) // Stops this instance Stop() // GetMembership returns the alive members in the view GetMembership() []NetworkMember // InitiateSync makes the instance ask a given number of peers // for their membership information InitiateSync(peerNum int) // Connect makes this instance to connect to a remote instance Connect(NetworkMember) }
Discovery is the interface that represents a discovery module
func NewDiscoveryService ¶
func NewDiscoveryService(bootstrapPeers []string, self NetworkMember, comm CommService, crypt CryptoService) Discovery
NewDiscoveryService returns a new discovery service with the comm module passed and the crypto service passed
Click to show internal directories.
Click to hide internal directories.