coreipfs

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrUnpinnedCid indicates that the operation failed because
	// the provided cid is unpinned.
	ErrUnpinnedCid = errors.New("can't unpin an unpinned cid")
	// ErrReplaceFromNotPinned indicates that the source cid to be replaced
	// isn't pinned.
	ErrReplaceFromNotPinned = errors.New("c1 isn't pinned")
)

Functions

This section is empty.

Types

type CoreIpfs

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

CoreIpfs is an implementation of HotStorage interface which saves data into a remote go-ipfs using the HTTP API.

func New

func New(ds datastore.TxnDatastore, ipfs iface.CoreAPI, l ffs.JobLogger) (*CoreIpfs, error)

New returns a new CoreIpfs instance.

func (*CoreIpfs) GCStaged added in v1.2.2

func (ci *CoreIpfs) GCStaged(ctx context.Context, exclude []cid.Cid, olderThan time.Time) ([]cid.Cid, error)

GCStaged unpins Cids that are only pinned by Stage() calls and all pins satisfy the filters.

func (*CoreIpfs) Get

func (ci *CoreIpfs) Get(ctx context.Context, c cid.Cid) (io.Reader, error)

Get retrieves a cid data from the IPFS node.

func (*CoreIpfs) IsPinned added in v1.2.2

func (ci *CoreIpfs) IsPinned(ctx context.Context, iid ffs.APIID, c cid.Cid) (bool, error)

IsPinned returns true if c is pinned by iid.

func (*CoreIpfs) Pin added in v1.2.2

func (ci *CoreIpfs) Pin(ctx context.Context, iid ffs.APIID, c cid.Cid) (int, error)

Pin a cid for an APIID. If the cid was already pinned by a stage from APIID, the Cid is considered fully-pinned and not a candidate to be unpinned by GCStaged().

func (*CoreIpfs) PinnedCids added in v1.2.2

func (ci *CoreIpfs) PinnedCids(ctx context.Context) ([]ffs.PinnedCid, error)

PinnedCids return detailed information about pinned cids.

func (*CoreIpfs) Replace

func (ci *CoreIpfs) Replace(ctx context.Context, iid ffs.APIID, c1 cid.Cid, c2 cid.Cid) (int, error)

Replace moves the pin from c1 to c2. If c2 was already pinned from a stage, it's considered fully-pinned and not GCable.

func (*CoreIpfs) Stage added in v1.2.2

func (ci *CoreIpfs) Stage(ctx context.Context, iid ffs.APIID, r io.Reader) (cid.Cid, error)

Stage adds the data of io.Reader in the storage, and creates a stage-pin on the resulting cid.

func (*CoreIpfs) StageCid added in v1.2.2

func (ci *CoreIpfs) StageCid(ctx context.Context, iid ffs.APIID, c cid.Cid) error

StageCid stage-pin a Cid.

func (*CoreIpfs) Unpin added in v1.2.2

func (ci *CoreIpfs) Unpin(ctx context.Context, iid ffs.APIID, c cid.Cid) error

Unpin unpins a Cid for an APIID. If the Cid isn't pinned, it returns ErrUnpinnedCid.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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