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

package ascendalloc

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

Package ascendalloc implements an ipfscluster.PinAllocator, which returns allocations based on sorting the metrics in ascending order. Thus, peers with smallest 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 AscendAllocator Uses

type AscendAllocator struct{}

AscendAllocator extends the SimpleAllocator

func NewAllocator Uses

func NewAllocator() AscendAllocator

NewAllocator returns an initialized AscendAllocator

func (AscendAllocator) Allocate Uses

func (alloc AscendAllocator) 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 (smallest to largest).

func (AscendAllocator) SetClient Uses

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

SetClient does nothing in this allocator

func (AscendAllocator) Shutdown Uses

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

Shutdown does nothing in this allocator

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