Documentation ¶
Overview ¶
package blockservice implements a BlockService interface that provides a single GetBlock/AddBlock interface that seamlessly retrieves data either locally or from a remote peer through the exchange.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("blockservice: key not found")
Functions ¶
This section is empty.
Types ¶
type BlockService ¶
type BlockService interface { Blockstore() blockstore.Blockstore Exchange() exchange.Interface AddBlock(o blocks.Block) (*cid.Cid, error) AddBlocks(bs []blocks.Block) ([]*cid.Cid, error) GetBlock(ctx context.Context, c *cid.Cid) (blocks.Block, error) GetBlocks(ctx context.Context, ks []*cid.Cid) <-chan blocks.Block DeleteBlock(o blocks.Block) error Close() error }
BlockService is a hybrid block datastore. It stores data in a local datastore and may retrieve data from a remote Exchange. It uses an internal `datastore.Datastore` instance to store values.
func New ¶
func New(bs blockstore.Blockstore, rem exchange.Interface) BlockService
NewBlockService creates a BlockService with given datastore instance.
func NewWriteThrough ¶ added in v0.4.5
func NewWriteThrough(bs blockstore.Blockstore, rem exchange.Interface) BlockService
NewWriteThrough ceates a BlockService that guarantees writes will go through to the blockstore and are not skipped by cache checks.
Click to show internal directories.
Click to hide internal directories.