blockchain

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage interface {
	// ReadGenesisBlock returns the hard-coded genesis block
	ReadGenesisBlock(context.Context) (block.Block, error)
	// ReadBlockByHash returns a block by given hash
	ReadBlockByHash(context.Context, []byte) (block.Block, error)
	// ReadLastNBlocks returns last N blocks
	ReadLastNBlocks(context.Context, int) ([]block.Block, error)
	// ReadLastBlockHash returns a last known block hash
	ReadLastBlockHash(context.Context) ([]byte, error)
	// WriteBlock writes a given block to the storage
	WriteBlock(context.Context, block.Block) error
	// Close releases allocated resources
	Close(context.Context) error
	transaction.Storage
}

Storage represents a blockchain storage This interface might be implemented by any embedded storage. You can read more about storage details here: https://bitcoin.stackexchange.com/questions/28168/what-are-the-keys-used-in-the-blockchain-leveldb-ie-what-are-the-keyvalue-pair https://bitcoin.stackexchange.com/questions/48959/why-is-bitcoin-core-using-leveldb-instead-of-redis-or-sqlite

func NewMemoryStorage

func NewMemoryStorage() (Storage, error)

NewMemoryStorage returns memory storage implementation

Jump to

Keyboard shortcuts

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