placement

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

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

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

Functions

This section is empty.

Types

type Address

type Address = refs.Address

Address is a type alias of Address from refs package of neofs-api-go.

type CID

type CID = refs.CID

CID is a type alias of CID from refs package of neofs-api-go.

type Component

type Component interface {
	NetworkState() *bootstrap.SpreadMap
	Neighbours(seed, epoch uint64, full bool) []peers.ID
	Update(epoch uint64, nm *netmapcore.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() ([]netmapcore.Info, error)
}

Graph is result of request to Placement-component

func ContainerGraph

func ContainerGraph(nm *NetMap, rule *libnetmap.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 Object

type Object = object.Object

Object is a type alias of Object from object package of neofs-api-go.

type ObjectID

type ObjectID = refs.ObjectID

ObjectID is a type alias of ObjectID from refs package of neofs-api-go.

type Params

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

Params to create Placement component

type PlacementWrapper

type PlacementWrapper struct {
	// contains filtered or unexported fields
}

func NewObjectPlacer

func NewObjectPlacer(pl Component) (*PlacementWrapper, error)

NewObjectPlacer wraps Component and returns ObjectPlacer interface.

func (PlacementWrapper) ContainerNodes

func (v PlacementWrapper) ContainerNodes(ctx context.Context, cid CID) ([]multiaddr.Multiaddr, error)

func (PlacementWrapper) ContainerNodesInfo

func (v PlacementWrapper) ContainerNodesInfo(ctx context.Context, cid CID, prev int) ([]netmapcore.Info, error)

func (PlacementWrapper) Epoch

func (v PlacementWrapper) Epoch() uint64

func (PlacementWrapper) GetNodes

func (v PlacementWrapper) GetNodes(ctx context.Context, addr Address, usePreviousNetMap bool, excl ...multiaddr.Multiaddr) ([]multiaddr.Multiaddr, error)

func (PlacementWrapper) IsContainerNode

func (v PlacementWrapper) IsContainerNode(ctx context.Context, addr multiaddr.Multiaddr, cid CID, previousNetMap bool) (bool, error)

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

type SGID

type SGID = refs.SGID

SGID is a type alias of SGID from refs package of neofs-api-go.

Jump to

Keyboard shortcuts

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