pin

package
v0.4.5-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

package pin implements structures and methods to keep track of which objects a user wants to keep stored locally.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotPinned = fmt.Errorf("not pinned")

Functions

func PinModeToString added in v0.4.2

func PinModeToString(mode PinMode) (string, bool)

Types

type PinMode

type PinMode int
const (
	Recursive PinMode = iota
	Direct
	Indirect
	Internal
	NotPinned
	Any
)

func StringToPinMode added in v0.4.2

func StringToPinMode(s string) (PinMode, bool)

type Pinned added in v0.4.5

type Pinned struct {
	Key  *cid.Cid
	Mode PinMode
	Via  *cid.Cid
}

func (Pinned) Pinned added in v0.4.5

func (p Pinned) Pinned() bool

func (Pinned) String added in v0.4.5

func (p Pinned) String() string

type Pinner

type Pinner interface {
	IsPinned(*cid.Cid) (string, bool, error)
	IsPinnedWithType(*cid.Cid, PinMode) (string, bool, error)
	Pin(context.Context, node.Node, bool) error
	Unpin(context.Context, *cid.Cid, bool) error

	// Check if a set of keys are pinned, more efficient than
	// calling IsPinned for each key
	CheckIfPinned(cids ...*cid.Cid) ([]Pinned, error)

	// PinWithMode is for manually editing the pin structure. Use with
	// care! If used improperly, garbage collection may not be
	// successful.
	PinWithMode(*cid.Cid, PinMode)
	// RemovePinWithMode is for manually editing the pin structure.
	// Use with care! If used improperly, garbage collection may not
	// be successful.
	RemovePinWithMode(*cid.Cid, PinMode)

	Flush() error
	DirectKeys() []*cid.Cid
	RecursiveKeys() []*cid.Cid
	InternalPins() []*cid.Cid
}

func LoadPinner

func LoadPinner(d ds.Datastore, dserv, internal mdag.DAGService) (Pinner, error)

LoadPinner loads a pinner and its keysets from the given datastore

func NewPinner

func NewPinner(dstore ds.Datastore, serv, internal mdag.DAGService) Pinner

NewPinner creates a new pinner using the given datastore as a backend

Directories

Path Synopsis
internal
pb
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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