supplier

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("no CID iterator found for given key")

ErrNotFound signals that CidIteratorSupplier has no iterator corresponding to the given key.

Functions

This section is empty.

Types

type CarSupplier

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

func NewCarSupplier

func NewCarSupplier(eng provider.Interface, ds datastore.Datastore, opts ...car.ReadOption) *CarSupplier

func (*CarSupplier) Callback

func (cs *CarSupplier) Callback(ctx context.Context, contextID []byte) (provider.MultihashIterator, error)

Callback supplies an iterator over CIDs of the CAR file that corresponds to the given key. An error is returned if no CAR file is found for the key.

func (*CarSupplier) Close

func (cs *CarSupplier) Close() error

Close permanently closes this supplier. After calling Close this supplier is no longer usable.

func (*CarSupplier) Put

func (cs *CarSupplier) Put(ctx context.Context, contextID []byte, path string, metadata stiapi.Metadata) (cid.Cid, error)

Put makes the CAR at the given path, and identified by the given ID, suppliable by this supplier. The return CID can then be used via Supply to get an iterator over CIDs that belong to the CAR.

This function accepts both CARv1 and CARv2 formats.

func (*CarSupplier) ReadOnlyBlockstore

func (cs *CarSupplier) ReadOnlyBlockstore(contextID []byte) (ClosableBlockstore, error)

ReadOnlyBlockstore returns a CAR blockstore interface for the given blockstore key

func (*CarSupplier) Remove

func (cs *CarSupplier) Remove(ctx context.Context, contextID []byte) (cid.Cid, error)

Remove removes the CAR at the given path from the list of suppliable CID iterators. If the CAR at given path is not known, this function will return an error. This function accepts both CARv1 and CARv2 formats.

type ClosableBlockstore

type ClosableBlockstore interface {
	bstore.Blockstore
	io.Closer
}

ClosableBlockstore is a blockstore that can be closed

Jump to

Keyboard shortcuts

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