addressbook

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package addressbook provides persisted mapping between overlay (topology) address and address.Address, which contains underlay (physical) address. The underlay address contains both physical and p2p addresses.

It is single point of truth about known peers and relations of their overlay and underlay addresses.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("addressbook: not found")

Functions

This section is empty.

Types

type GetPutter

type GetPutter interface {
	Getter
	Putter
}

type Getter

type Getter interface {
	// Get returns pointer to saved bzz.Address for requested overlay address.
	Get(overlay boson.Address) (addr *address.Address, err error)
}

type Interface

type Interface interface {
	GetPutter
	Remover
	// Overlays returns a list of all overlay addresses saved in addressbook.
	Overlays() ([]boson.Address, error)
	// IterateOverlays exposes overlays in a form of an iterator.
	IterateOverlays(func(boson.Address) (bool, error)) error
	// Addresses returns a list of all bzz.Address-es saved in addressbook.
	Addresses() ([]address.Address, error)
}

Interface is the AddressBook interface.

func New

func New(storer storage.StateStorer) Interface

New creates new addressbook for state storer.

type Putter

type Putter interface {
	// Put saves relation between peer overlay address and bzz.Address address.
	Put(overlay boson.Address, addr address.Address) (err error)
}

type Remover

type Remover interface {
	// Remove removes overlay address.
	Remove(overlay boson.Address) error
}

Jump to

Keyboard shortcuts

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