Documentation ¶
Index ¶
- type PeerSet
- func (ps *PeerSet) GetPeer(pid peer.ID) *peer.Peer
- func (ps *PeerSet) GetPeerStatus(pid peer.ID) status.Status
- func (ps *PeerSet) GetRandomPeer() *peer.Peer
- func (ps *PeerSet) HasAnyOpenSession() bool
- func (ps *PeerSet) HasOpenSession(pid peer.ID) bool
- func (ps *PeerSet) IteratePeers(consumer func(p *peer.Peer) (stop bool))
- func (ps *PeerSet) Len() int
- func (ps *PeerSet) Metric() metric.Metric
- func (ps *PeerSet) NumberOfSessions() int
- func (ps *PeerSet) OpenSession(pid peer.ID, from, count uint32) int
- func (ps *PeerSet) RemoveAllSessions()
- func (ps *PeerSet) RemovePeer(pid peer.ID)
- func (ps *PeerSet) SessionStats() session.Stats
- func (ps *PeerSet) Sessions() []*session.Session
- func (ps *PeerSet) SetExpiredSessionsAsUncompleted()
- func (ps *PeerSet) SetSessionCompleted(sid int)
- func (ps *PeerSet) SetSessionUncompleted(sid int)
- func (ps *PeerSet) StartedAt() time.Time
- func (ps *PeerSet) TotalSentBundles() int
- func (ps *PeerSet) UpdateAddress(pid peer.ID, addr, direction string)
- func (ps *PeerSet) UpdateHeight(pid peer.ID, height uint32, lastBlockHash hash.Hash)
- func (ps *PeerSet) UpdateInfo(pid peer.ID, moniker string, agent string, consKeys []*bls.PublicKey, ...)
- func (ps *PeerSet) UpdateInvalidMetric(pid peer.ID, bytes int64)
- func (ps *PeerSet) UpdateLastReceived(pid peer.ID)
- func (ps *PeerSet) UpdateLastSent(pid peer.ID)
- func (ps *PeerSet) UpdateProtocols(pid peer.ID, protocols []string)
- func (ps *PeerSet) UpdateReceivedMetric(pid peer.ID, msgType message.Type, bytes int64)
- func (ps *PeerSet) UpdateSentMetric(pid *peer.ID, msgType message.Type, bytes int64)
- func (ps *PeerSet) UpdateSessionLastActivity(sid int)
- func (ps *PeerSet) UpdateStatus(pid peer.ID, status status.Status)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerSet ¶
type PeerSet struct {
// contains filtered or unexported fields
}
func NewPeerSet ¶
NewPeerSet constructs a new PeerSet for managing peer information.
func (*PeerSet) GetPeerStatus ¶ added in v1.2.0
GetPeerStatus finds a peer by id and returns the status of the Peer.
func (*PeerSet) GetRandomPeer ¶
GetRandomPeer selects a random peer from the peer set based on their download score. Peers with higher score are more likely to be selected.
func (*PeerSet) HasAnyOpenSession ¶
func (*PeerSet) HasOpenSession ¶ added in v0.11.0
HasOpenSession checks if the specified peer has an open session for downloading blocks. Note that a peer may have more than one session.
func (*PeerSet) IteratePeers ¶ added in v0.15.0
func (*PeerSet) NumberOfSessions ¶ added in v0.17.0
NumberOfSessions returns the total number of sessions.
func (*PeerSet) OpenSession ¶
OpenSession opens a new session for downloading blocks and returns the session ID.
func (*PeerSet) RemoveAllSessions ¶ added in v0.17.0
func (ps *PeerSet) RemoveAllSessions()
func (*PeerSet) RemovePeer ¶
func (*PeerSet) SessionStats ¶ added in v0.17.0
func (*PeerSet) SetExpiredSessionsAsUncompleted ¶ added in v0.17.0
func (ps *PeerSet) SetExpiredSessionsAsUncompleted()
func (*PeerSet) SetSessionCompleted ¶ added in v0.17.0
func (*PeerSet) SetSessionUncompleted ¶ added in v0.17.0
func (*PeerSet) TotalSentBundles ¶ added in v0.18.3
func (*PeerSet) UpdateAddress ¶ added in v0.17.0
func (*PeerSet) UpdateHeight ¶
func (*PeerSet) UpdateInfo ¶ added in v0.15.0
func (*PeerSet) UpdateInvalidMetric ¶ added in v1.6.0
func (*PeerSet) UpdateLastReceived ¶ added in v0.15.0
func (*PeerSet) UpdateLastSent ¶ added in v0.15.0
func (*PeerSet) UpdateProtocols ¶ added in v0.18.0
func (*PeerSet) UpdateReceivedMetric ¶ added in v1.6.0
func (*PeerSet) UpdateSentMetric ¶ added in v1.6.0
func (*PeerSet) UpdateSessionLastActivity ¶ added in v0.18.0
Click to show internal directories.
Click to hide internal directories.