Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPeerUnknown is returned when there is an attempt to obtain data from a peer that is not known. ErrPeerUnknown = errors.New("peer unknown") )
Functions ¶
This section is empty.
Types ¶
type PeerConnectionState ¶
type PeerConnectionState ethpb.ConnectionState
PeerConnectionState is the state of the connection.
type PeerData ¶
type PeerData struct { // Network related data. Address ma.Multiaddr Direction network.Direction ConnState PeerConnectionState Enr *enr.Record NextValidTime time.Time // Chain related data. MetaData *pb.MetaData ChainState *pb.Status ChainStateLastUpdated time.Time ChainStateValidationError error // Scorers internal data. BadResponses int ProcessedBlocks uint64 BlockProviderUpdated time.Time // Gossip Scoring data. TopicScores map[string]*pbrpc.TopicScoreSnapshot GossipScore float64 BehaviourPenalty float64 }
PeerData aggregates protocol and application level info about a single peer.
type Store ¶
Store is a container for various peer related data (both protocol and app level). Container implements RWMutex, so data access can be restricted on the container level. This allows different components rely on the very same peer map container. Note: access to data is controlled by clients i.e. client code is responsible for locking/unlocking the mutex when accessing data.
func NewStore ¶
func NewStore(ctx context.Context, config *StoreConfig) *Store
NewStore creates new peer data store.
func (*Store) Config ¶
func (s *Store) Config() *StoreConfig
Config exposes store configuration params.
func (*Store) DeletePeerData ¶
DeletePeerData removes data associated with a given peer. Important: it is assumed that store mutex is locked when calling this method.
func (*Store) PeerData ¶
PeerData returns data associated with a given peer, if any. Important: it is assumed that store mutex is locked when calling this method.
func (*Store) PeerDataGetOrCreate ¶
PeerDataGetOrCreate returns data associated with a given peer. If no data has been associated yet, newly created and associated data object is returned. Important: it is assumed that store mutex is locked when calling this method.
type StoreConfig ¶
type StoreConfig struct {
MaxPeers int
}
StoreConfig holds peer store parameters.