ipfs-cluster: github.com/ipfs/ipfs-cluster/allocator/descendalloc Index | Files

package descendalloc

import "github.com/ipfs/ipfs-cluster/allocator/descendalloc"

Package descendalloc implements an ipfscluster.PinAllocator returns allocations based on sorting the metrics in descending order. Thus, peers with largest metrics are first in the list. This allocator can be used with a number of informers, as long as they provide a numeric metric value.


Package Files


type DescendAllocator Uses

type DescendAllocator struct{}

DescendAllocator extends the SimpleAllocator

func NewAllocator Uses

func NewAllocator() DescendAllocator

NewAllocator returns an initialized DescendAllocator

func (DescendAllocator) Allocate Uses

func (alloc DescendAllocator) Allocate(ctx context.Context, c cid.Cid, current, candidates, priority map[peer.ID]*api.Metric) ([]peer.ID, error)

Allocate returns where to allocate a pin request based on metrics which carry a numeric value such as "used disk". We do not pay attention to the metrics of the currently allocated peers and we just sort the candidates based on their metric values (largest to smallest).

func (DescendAllocator) SetClient Uses

func (alloc DescendAllocator) SetClient(c *rpc.Client)

SetClient does nothing in this allocator

func (DescendAllocator) Shutdown Uses

func (alloc DescendAllocator) Shutdown(_ context.Context) error

Shutdown does nothing in this allocator

Package descendalloc imports 6 packages (graph). Updated 2020-06-07. Refresh now. Tools for package owners.