corerepo

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: May 12, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package corerepo provides pinning and garbage collection for local IPFS block services.

IPFS nodes will keep local copies of any object that have either been added or requested locally. Not all of these objects are worth preserving forever though, so the node adminstrator can pin objects they want to keep and unpin objects that they don't care about.

Garbage collection sweeps iterate through the local block store removing objects that aren't pinned, which frees storage space for new objects.

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxStorageExceeded = errors.New("Maximum storage limit exceeded. Maybe unpin some files?")

Functions

func BestEffortRoots

func BestEffortRoots(filesRoot *mfs.Root) ([]*cid.Cid, error)

func CollectResult

func CollectResult(ctx context.Context, gcOut <-chan gc.Result, cb func(*cid.Cid)) error

CollectResult collects the output of a garbage collection run and calls the given callback for each object removed. It also collects all errors into a MultiError which is returned after the gc is completed.

func ConditionalGC

func ConditionalGC(ctx context.Context, node *core.IpfsNode, offset uint64) error

func GarbageCollect

func GarbageCollect(n *core.IpfsNode, ctx context.Context) error

func GarbageCollectAsync

func GarbageCollectAsync(n *core.IpfsNode, ctx context.Context) <-chan gc.Result

func PeriodicGC

func PeriodicGC(ctx context.Context, node *core.IpfsNode) error

func Pin added in v0.2.2

func Pin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool) ([]*cid.Cid, error)

func Unpin added in v0.2.2

func Unpin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool) ([]*cid.Cid, error)

Types

type GC

type GC struct {
	Node       *core.IpfsNode
	Repo       repo.Repo
	StorageMax uint64
	StorageGC  uint64
	SlackGB    uint64
	Storage    uint64
}

func NewGC

func NewGC(n *core.IpfsNode) (*GC, error)

type MultiError

type MultiError struct {
	Errors  []error
	Summary error
}

MultiError contains the results of multiple errors.

func NewMultiError

func NewMultiError(errs ...error) *MultiError

NewMultiError creates a new MultiError object from a given slice of errors.

func (*MultiError) Error

func (e *MultiError) Error() string

type Stat

type Stat struct {
	NumObjects uint64
	RepoSize   uint64 // size in bytes
	RepoPath   string
	Version    string
}

func RepoStat

func RepoStat(n *core.IpfsNode, ctx context.Context) (*Stat, error)

Jump to

Keyboard shortcuts

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