Documentation ¶
Index ¶
Constants ¶
View Source
const PhoneBookEntryArchivalRole = 2
PhoneBookEntryArchivalRole used for all the archival nodes that are provided via the archive SRV record.
View Source
const PhoneBookEntryRelayRole = 1
PhoneBookEntryRelayRole used for all the relays that are provided either via the algobootstrap SRV record or via a configuration file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PhoneBookEntryRoles ¶
type PhoneBookEntryRoles int
PhoneBookEntryRoles defines the roles that a single entry on the phonebook can take. currently, we have two roles : relay role and archival role, which are mutually exclusive.
type Phonebook ¶
type Phonebook interface { // GetAddresses(N) returns up to N addresses, but may return fewer GetAddresses(n int, role PhoneBookEntryRoles) []string // UpdateRetryAfter updates the retry-after field for the entries matching the given address UpdateRetryAfter(addr string, retryAfter time.Time) // GetConnectionWaitTime will calculate and return the wait // time to prevent exceeding connectionsRateLimitingCount. // The connection should be established when the waitTime is 0. // It will register a provisional next connection time when the waitTime is 0. // The provisional time should be updated after the connection with UpdateConnectionTime GetConnectionWaitTime(addrOrPeerID string) (addrInPhonebook bool, waitTime time.Duration, provisionalTime time.Time) // UpdateConnectionTime will update the provisional connection time. // Returns true of the addr was in the phonebook UpdateConnectionTime(addrOrPeerID string, provisionalTime time.Time) bool // ReplacePeerList merges a set of addresses with that passed in for networkName // new entries in dnsAddresses are being added // existing items that aren't included in dnsAddresses are being removed // matching entries don't change ReplacePeerList(dnsAddresses []string, networkName string, role PhoneBookEntryRoles) // AddPersistentPeers stores addresses of peers which are persistent. // i.e. they won't be replaced by ReplacePeerList calls AddPersistentPeers(dnsAddresses []string, networkName string, role PhoneBookEntryRoles) }
Phonebook stores or looks up addresses of nodes we might contact
Click to show internal directories.
Click to hide internal directories.