Documentation
¶
Index ¶
- Constants
- Variables
- func MessageOriginatorPid(msg MessageP2P) string
- func MessageOriginatorSeq(msg MessageP2P) string
- func PeerIdToShortString(pid core.PeerID) string
- type ChannelLoadBalancer
- type ConnectedPeersInfo
- type IdentityGenerator
- type MessageP2P
- type MessageProcessor
- type Messenger
- type NetworkShardingCollector
- type NodeOperation
- type PeerDenialEvaluator
- type PeerShardResolver
- type PeerTopicNotifier
- type PeersRatingHandler
- type PreferredPeersHolderHandler
- type SendableData
- type SyncTimer
Constants ¶
const ConnectionWatcherTypePrint = p2p.ConnectionWatcherTypePrint
ConnectionWatcherTypePrint - new connection found will be printed in the log file
const FullArchiveMode = p2p.FullArchiveMode
FullArchiveMode defines the node operation as a full archive mode
const ListsSharder = p2p.ListsSharder
ListsSharder is the variant that uses lists
const LocalHostListenAddrWithIp4AndTcp = p2p.LocalHostListenAddrWithIp4AndTcp
LocalHostListenAddrWithIp4AndTcp defines the local host listening ip v.4 address and TCP
const NilListSharder = p2p.NilListSharder
NilListSharder is the variant that will not do connection trimming
const NormalOperation = p2p.NormalOperation
NormalOperation defines the normal mode operation: either seeder, observer or validator
Variables ¶
var ErrNilMessage = p2p.ErrNilMessage
ErrNilMessage signals that a nil message has been received
var ErrNilPreferredPeersHolder = p2p.ErrNilPreferredPeersHolder
ErrNilPreferredPeersHolder signals that a nil preferred peers holder was provided
var ErrNilStatusHandler = errors.New("nil status handler")
ErrNilStatusHandler signals that a nil status handler has been provided
Functions ¶
func MessageOriginatorPid ¶
func MessageOriginatorPid(msg MessageP2P) string
MessageOriginatorPid will output the message peer id in a pretty format If it can, it will display the last displayLastPidChars (12) characters from the pid
func MessageOriginatorSeq ¶
func MessageOriginatorSeq(msg MessageP2P) string
MessageOriginatorSeq will output the sequence number as hex
func PeerIdToShortString ¶
PeerIdToShortString trims the first displayLastPidChars characters of the provided peer ID after converting the peer ID to string using the Pretty functionality
Types ¶
type ChannelLoadBalancer ¶
type ChannelLoadBalancer interface {
AddChannel(channel string) error
RemoveChannel(channel string) error
GetChannelOrDefault(channel string) chan *SendableData
CollectOneElementFromChannels() *SendableData
Close() error
IsInterfaceNil() bool
}
ChannelLoadBalancer defines what a load balancer that uses chans should do
type ConnectedPeersInfo ¶
type ConnectedPeersInfo = p2p.ConnectedPeersInfo
ConnectedPeersInfo represents the DTO structure used to output the metrics for connected peers
type IdentityGenerator ¶
type IdentityGenerator interface {
CreateRandomP2PIdentity() ([]byte, core.PeerID, error)
IsInterfaceNil() bool
}
IdentityGenerator represent an entity able to create a random p2p identity
type MessageP2P ¶
type MessageP2P = p2p.MessageP2P
MessageP2P defines what a p2p message can do (should return)
type MessageProcessor ¶
type MessageProcessor = p2p.MessageProcessor
MessageProcessor is the interface used to describe what a receive message processor should do All implementations that will be called from Messenger implementation will need to satisfy this interface If the function returns a non nil value, the received message will not be propagated to its connected peers
type NetworkShardingCollector ¶
type NetworkShardingCollector interface {
UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32)
IsInterfaceNil() bool
}
NetworkShardingCollector defines the updating methods used by the network sharding component The interface assures that the collected data will be used by the p2p network sharding components
type NodeOperation ¶
type NodeOperation = p2p.NodeOperation
NodeOperation defines the p2p node operation
type PeerDenialEvaluator ¶
type PeerDenialEvaluator = p2p.PeerDenialEvaluator
PeerDenialEvaluator defines the behavior of a component that is able to decide if a peer ID is black listed or not TODO merge this interface with the PeerShardResolver => P2PProtocolHandler ? TODO move antiflooding inside network messenger
type PeerShardResolver ¶
type PeerShardResolver = p2p.PeerShardResolver
PeerShardResolver is able to resolve the link between the provided PeerID and the shardID
type PeerTopicNotifier ¶
type PeerTopicNotifier = p2p.PeerTopicNotifier
PeerTopicNotifier represent an entity able to handle new notifications on a new peer on a topic
type PeersRatingHandler ¶
type PeersRatingHandler interface {
AddPeer(pid core.PeerID)
IncreaseRating(pid core.PeerID)
DecreaseRating(pid core.PeerID)
GetTopRatedPeersFromList(peers []core.PeerID, minNumOfPeersExpected int) []core.PeerID
IsInterfaceNil() bool
}
PeersRatingHandler represent an entity able to handle peers ratings
type PreferredPeersHolderHandler ¶
type PreferredPeersHolderHandler interface {
PutConnectionAddress(peerID core.PeerID, address string)
PutShardID(peerID core.PeerID, shardID uint32)
Get() map[uint32][]core.PeerID
Contains(peerID core.PeerID) bool
Remove(peerID core.PeerID)
Clear()
IsInterfaceNil() bool
}
PreferredPeersHolderHandler defines the behavior of a component able to handle preferred peers operations
type SendableData ¶
SendableData represents the struct used in data throttler implementation