placement

package
v0.10.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyNodes when container doesn't contains any nodes
	ErrEmptyNodes = internal.Error("container doesn't contains nodes")

	// ErrNodesBucketOmitted when in PlacementRule, Selector has not NodesBucket
	ErrNodesBucketOmitted = internal.Error("nodes-bucket is omitted")

	// ErrEmptyContainer when GetMaxSelection or GetSelection returns empty result
	ErrEmptyContainer = internal.Error("could not get container, it's empty")
)

Functions

This section is empty.

Types

type Component

type Component interface {
	NetworkState() *bootstrap.SpreadMap
	Neighbours(seed, epoch uint64, full bool) []peers.ID
	Update(epoch uint64, nm *netmap.NetMap) error
	Query(ctx context.Context, opts ...QueryOption) (Graph, error)
}

Component is interface of placement service

func New

func New(p Params) Component

New is a placement component constructor.

type FilterRule

type FilterRule func(netmap.SFGroup, *netmap.Bucket) *netmap.Bucket

FilterRule bucket callback handler

type Graph

type Graph interface {
	Filter(rule FilterRule) Graph
	Exclude(list []multiaddr.Multiaddr) Graph
	NodeList() ([]multiaddr.Multiaddr, error)
	NodeInfo() ([]bootstrap.NodeInfo, error)
}

Graph is result of request to Placement-component

func ContainerGraph

func ContainerGraph(nm *netmap.NetMap, rule *netmap.PlacementRule, ignore []uint32, cid refs.CID) (Graph, error)

ContainerGraph applies the placement rules to network map and returns container graph.

type Key

type Key []byte

Key to fetch node-list

type NetMap

type NetMap = netmap.NetMap

NetMap is a type alias of NetMap from netmap package.

type Params

type Params struct {
	Log                *zap.Logger
	Netmap             *netmap.NetMap
	Peerstore          peers.Store
	Fetcher            container.Storage
	ChronologyDuration uint64 // storing number of past epochs states
}

Params to create Placement component

type QueryOption

type QueryOption func(*QueryOptions)

QueryOption settings closure

func ContainerID

func ContainerID(cid refs.CID) QueryOption

ContainerID set by Key.

func ExcludeNodes

func ExcludeNodes(list []multiaddr.Multiaddr) QueryOption

ExcludeNodes to ignore some nodes.

func UsePreviousNetmap

func UsePreviousNetmap(diff int) QueryOption

UsePreviousNetmap for query.

type QueryOptions

type QueryOptions struct {
	CID      refs.CID
	Previous int
	Excludes []multiaddr.Multiaddr
}

QueryOptions for query request

Jump to

Keyboard shortcuts

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