ipfs-cluster: github.com/ipfs/ipfs-cluster/pintracker/stateless Index | Files

package stateless

import "github.com/ipfs/ipfs-cluster/pintracker/stateless"

Package stateless implements a PinTracker component for IPFS Cluster, which aims to reduce the memory footprint when handling really large cluster states.

Index

Package Files

config.go stateless.go

Constants

const (
    DefaultMaxPinQueueSize = 50000
    DefaultConcurrentPins  = 10
)

Default values for this Config.

type Config Uses

type Config struct {
    config.Saver

    // If higher, they will automatically marked with an error.
    MaxPinQueueSize int
    // ConcurrentPins specifies how many pin requests can be sent to the ipfs
    // daemon in parallel. If the pinning method is "refs", it might increase
    // speed. Unpin requests are always processed one by one.
    ConcurrentPins int
}

Config allows to initialize a Monitor and customize some parameters.

func (*Config) ApplyEnvVars Uses

func (cfg *Config) ApplyEnvVars() error

ApplyEnvVars fills in any Config fields found as environment variables.

func (*Config) ConfigKey Uses

func (cfg *Config) ConfigKey() string

ConfigKey provides a human-friendly identifier for this type of Config.

func (*Config) Default Uses

func (cfg *Config) Default() error

Default sets the fields of this Config to sensible values.

func (*Config) LoadJSON Uses

func (cfg *Config) LoadJSON(raw []byte) error

LoadJSON sets the fields of this Config to the values defined by the JSON representation of it, as generated by ToJSON.

func (*Config) ToJSON Uses

func (cfg *Config) ToJSON() ([]byte, error)

ToJSON generates a human-friendly JSON representation of this Config.

func (*Config) Validate Uses

func (cfg *Config) Validate() error

Validate checks that the fields of this Config have working values, at least in appearance.

type Tracker Uses

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

Tracker uses the optracker.OperationTracker to manage transitioning shared ipfs-cluster state (Pins) to the local IPFS node.

func New Uses

func New(cfg *Config, pid peer.ID, peerName string) *Tracker

New creates a new StatelessPinTracker.

func (*Tracker) OpContext Uses

func (spt *Tracker) OpContext(ctx context.Context, c cid.Cid) context.Context

OpContext exports the internal optracker's OpContext method. For testing purposes only.

func (*Tracker) Recover Uses

func (spt *Tracker) Recover(ctx context.Context, c cid.Cid) (*api.PinInfo, error)

Recover will re-track or re-untrack a Cid in error state, possibly retriggering an IPFS pinning operation and returning only when it is done.

func (*Tracker) RecoverAll Uses

func (spt *Tracker) RecoverAll(ctx context.Context) ([]*api.PinInfo, error)

RecoverAll attempts to recover all items tracked by this peer.

func (*Tracker) SetClient Uses

func (spt *Tracker) SetClient(c *rpc.Client)

SetClient makes the StatelessPinTracker ready to perform RPC requests to other components.

func (*Tracker) Shutdown Uses

func (spt *Tracker) Shutdown(ctx context.Context) error

Shutdown finishes the services provided by the StatelessPinTracker and cancels any active context.

func (*Tracker) Status Uses

func (spt *Tracker) Status(ctx context.Context, c cid.Cid) *api.PinInfo

Status returns information for a Cid pinned to the local IPFS node.

func (*Tracker) StatusAll Uses

func (spt *Tracker) StatusAll(ctx context.Context) []*api.PinInfo

StatusAll returns information for all Cids pinned to the local IPFS node.

func (*Tracker) Sync Uses

func (spt *Tracker) Sync(ctx context.Context, c cid.Cid) (*api.PinInfo, error)

Sync returns the updated local status for the given Cid.

func (*Tracker) SyncAll Uses

func (spt *Tracker) SyncAll(ctx context.Context) ([]*api.PinInfo, error)

SyncAll verifies that the statuses of all tracked Cids (from the shared state) match the one reported by the IPFS daemon. If not, they will be transitioned to PinError or UnpinError.

SyncAll returns the list of local status for all tracked Cids which were updated or have errors. Cids in error states can be recovered with Recover(). An error is returned if we are unable to contact the IPFS daemon.

func (*Tracker) Track Uses

func (spt *Tracker) Track(ctx context.Context, c *api.Pin) error

Track tells the StatelessPinTracker to start managing a Cid, possibly triggering Pin operations on the IPFS daemon.

func (*Tracker) Untrack Uses

func (spt *Tracker) Untrack(ctx context.Context, c cid.Cid) error

Untrack tells the StatelessPinTracker to stop managing a Cid. If the Cid is pinned locally, it will be unpinned.

Package stateless imports 14 packages (graph). Updated 2019-03-21. Refresh now. Tools for package owners.