blockstore

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2015 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

package blockstore implements a thin wrapper over a datastore, giving a clean interface for Getting and Putting block objects.

Index

Constants

This section is empty.

Variables

View Source
var BlockPrefix = ds.NewKey("blocks")

BlockPrefix namespaces blockstore datastores

View Source
var ErrNotFound = errors.New("blockstore: block not found")
View Source
var ValueTypeMismatch = errors.New("The retrieved value is not a Block")

Functions

This section is empty.

Types

type Blockstore

type Blockstore interface {
	DeleteBlock(key.Key) error
	Has(key.Key) (bool, error)
	Get(key.Key) (*blocks.Block, error)
	Put(*blocks.Block) error
	PutMany([]*blocks.Block) error

	AllKeysChan(ctx context.Context) (<-chan key.Key, error)
}

Blockstore wraps a ThreadSafeDatastore

func NewBlockstore

func NewBlockstore(d ds.ThreadSafeDatastore) Blockstore

func WriteCached

func WriteCached(bs Blockstore, size int) (Blockstore, error)

WriteCached returns a blockstore that caches up to |size| unique writes (bs.Put).

Jump to

Keyboard shortcuts

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