numpinalloc

package
v0.0.0-...-857e381 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package numpinalloc implements an ipfscluster.Allocator based on the "numpin" Informer. It is a simple example on how an allocator is implemented.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocator

type Allocator struct{}

Allocator implements ipfscluster.Allocate.

func NewAllocator

func NewAllocator() *Allocator

NewAllocator returns an initialized Allocator

func (*Allocator) Allocate

func (alloc *Allocator) Allocate(c *cid.Cid, current, candidates map[peer.ID]api.Metric) ([]peer.ID, error)

Allocate returns where to allocate a pin request based on "numpin"-Informer metrics. In this simple case, we do not pay attention to the metrics of the current, we just need to sort the candidates by number of pins.

func (*Allocator) SetClient

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

SetClient does nothing in this allocator

func (*Allocator) Shutdown

func (alloc *Allocator) Shutdown() error

Shutdown does nothing in this allocator

Jump to

Keyboard shortcuts

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