Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - func GetDurationOrDefault(key string, defVal time.Duration) time.Duration
 - func GetIntOrDefault(key string, defVal int) int
 - func GetLogger(module string, peerID string) *logging.Logger
 - func GetRandomIndices(indiceCount, highestIndex int) []int
 - func IndexInSlice(array interface{}, o interface{}, equals Equals) int
 - func PrintStackTrace()
 - func RandomInt(n int) int
 - func RandomUInt64() uint64
 - func SetDuration(key string, val time.Duration)
 - func SetupTestLogging()
 - type Equals
 - type MembershipStore
 - func (m *MembershipStore) MsgByID(pkiID common.PKIidType) *proto.SignedGossipMessage
 - func (m *MembershipStore) Put(pkiID common.PKIidType, msg *proto.SignedGossipMessage)
 - func (m *MembershipStore) Remove(pkiID common.PKIidType)
 - func (m *MembershipStore) Size() int
 - func (m *MembershipStore) ToSlice() []*proto.SignedGossipMessage
 
- type PubSub
 - type Set
 - type Subscription
 
Constants ¶
const ( LoggingChannelModule = "gossip/channel" LoggingCommModule = "gossip/comm" LoggingDiscoveryModule = "gossip/discovery" LoggingElectionModule = "gossip/election" LoggingGossipModule = "gossip/gossip" LoggingMockModule = "gossip/comm/mock" LoggingPullModule = "gossip/pull" LoggingServiceModule = "gossip/service" LoggingStateModule = "gossip/state" )
Module names for logger initialization.
Variables ¶
This section is empty.
Functions ¶
func GetDurationOrDefault ¶
GetDurationOrDefault returns the Duration value from config if present otherwise default value
func GetIntOrDefault ¶
GetIntOrDefault returns the int value from config if present otherwise default value
func GetLogger ¶
GetLogger returns a logger for given gossip module and peerID
func GetRandomIndices ¶
GetRandomIndices returns a slice of random indices from 0 to given highestIndex
func IndexInSlice ¶
IndexInSlice returns the index of given object o in array
func RandomInt ¶
RandomInt returns, as an int, a non-negative pseudo-random integer in [0,n) It panics if n <= 0
func SetDuration ¶
SetDuration stores duration key value to viper
func SetupTestLogging ¶
func SetupTestLogging()
SetupTestLogging sets the default log levels for gossip unit tests
Types ¶
type Equals ¶
type Equals func(a interface{}, b interface{}) bool
    Equals returns whether a and b are the same
type MembershipStore ¶
MembershipStore struct which encapsulates membership message store abstraction
func NewMembershipStore ¶
func NewMembershipStore() *MembershipStore
NewMembershipStore creates new membership store instance
func (*MembershipStore) MsgByID ¶
func (m *MembershipStore) MsgByID(pkiID common.PKIidType) *proto.SignedGossipMessage
MsgByID returns a message stored by a certain ID, or nil if such an ID isn't found
func (*MembershipStore) Put ¶
func (m *MembershipStore) Put(pkiID common.PKIidType, msg *proto.SignedGossipMessage)
Put associates msg with the given pkiID
func (*MembershipStore) Remove ¶
func (m *MembershipStore) Remove(pkiID common.PKIidType)
Remove removes a message with a given pkiID
func (*MembershipStore) ToSlice ¶
func (m *MembershipStore) ToSlice() []*proto.SignedGossipMessage
ToSlice returns a slice backed by the elements of the MembershipStore
type PubSub ¶
PubSub defines a struct that one can use to: - publish items to a topic to multiple subscribers - and subscribe to items from a topic The subscriptions have a TTL and are cleaned when it passes.
func NewPubSub ¶
func NewPubSub() *PubSub
NewPubSub creates a new PubSub with an empty set of subscriptions
func (*PubSub) Publish ¶
Publish publishes an item to all subscribers on the topic
      
      Source Files
      ¶
    
- logging.go
 - misc.go
 - msgs.go
 - pubsub.go