phonebook

package
v0.0.0-...-92e0e00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

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

func MakePhonebook

func MakePhonebook(connectionsRateLimitingCount uint,
	connectionsRateLimitingWindow time.Duration) Phonebook

MakePhonebook creates phonebookImpl with the passed configuration values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL