blockservice

package
v0.0.0-...-e4696f9 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2014 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 struct {
	Datastore ds.Datastore
	Remote    exchange.Interface
}

BlockService is a block datastore. It uses an internal `datastore.Datastore` instance to store values.

func NewBlockService

func NewBlockService(d ds.Datastore, rem exchange.Interface) (*BlockService, error)

NewBlockService creates a BlockService with given datastore instance.

func (*BlockService) AddBlock

func (s *BlockService) AddBlock(b *blocks.Block) (u.Key, error)

AddBlock adds a particular block to the service, Putting it into the datastore.

func (*BlockService) DeleteBlock

func (s *BlockService) DeleteBlock(k u.Key) error

DeleteBlock deletes a block in the blockservice from the datastore

func (*BlockService) GetBlock

func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, error)

GetBlock retrieves a particular block from the service, Getting it from the datastore using the key (hash).

Jump to

Keyboard shortcuts

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