blockservice

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2017 License: MIT Imports: 8 Imported by: 0

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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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