common

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	context.Context

	// Must return epoch number to select the values.
	Epoch() uint64
}

Context wraps stdlib context with accompanying meta values.

type ManagerBuilder

type ManagerBuilder interface {
	// BuildManagers must compose list of managers. It depends on
	// particular epoch and PeerID of the current route point.
	BuildManagers(epoch uint64, p apireputation.PeerID) ([]ServerInfo, error)
}

ManagerBuilder defines an interface for providing a list of Managers for specific epoch. Implementation depends on trust value.

func NewManagerBuilder added in v0.22.0

func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) ManagerBuilder

NewManagerBuilder creates a new instance of the managerBuilder.

Panics if at least one value of the parameters is invalid.

The created managerBuilder does not require additional initialization and is completely ready for work.

type ManagersPrm added in v0.22.0

type ManagersPrm struct {
	NetMapSource netmapcore.Source
}

ManagersPrm groups the required parameters of the managerBuilder's constructor.

All values must comply with the requirements imposed on them. Passing incorrect parameter values will result in constructor failure (error or panic depending on the implementation).

type MngOption added in v0.22.0

type MngOption func(*mngOptions)

func WithLogger added in v0.22.0

func WithLogger(l *logger.Logger) MngOption

WithLogger returns MngOption to specify logging component.

type ServerInfo

type ServerInfo interface {
	// PublicKey returns public key of the node
	// from the route in a binary representation.
	PublicKey() []byte

	// Iterates over network addresses of the node
	// in the route. Breaks iterating on true return
	// of the handler.
	IterateAddresses(func(string) bool)

	// Returns number of server's network addresses.
	NumberOfAddresses() int
}

ServerInfo describes a set of characteristics of a point in a route.

type Writer

type Writer interface {
	// Write performs a write operation of reputation.Trust value
	// and returns any error encountered.
	//
	// All values after the Close call must be flushed to the
	// physical target. Implementations can cache values before
	// Close operation.
	//
	// Write must not be called after Close.
	Write(reputation.Trust) error

	// Close exits with method-providing Writer.
	//
	// All cached values must be flushed before
	// the Close's return.
	//
	// Methods must not be called after Close.
	io.Closer
}

Writer describes the interface for storing reputation.Trust values.

This interface is provided by both local storage of values and remote (wrappers over the RPC).

type WriterProvider

type WriterProvider interface {
	// InitWriter should return an initialized Writer.
	//
	// Initialization problems are reported via error.
	// If no error was returned, then the Writer must not be nil.
	//
	// Implementations can have different logic for different
	// contexts, so specific ones may document their own behavior.
	InitWriter(Context) (Writer, error)
}

WriterProvider is a group of methods provided by entity which generates keepers of reputation.Trust values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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