kvledger

package
v0.0.0-...-95272ce Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(lpath string)

Initialize kv ledgers

Types

type Conf

type Conf struct {
	// contains filtered or unexported fields
}

Conf captures `KVLedger` configurations

func NewConf

func NewConf(filesystemPath string, maxBlockfileSize int) *Conf

NewConf constructs new `Conf`. filesystemPath is the top level directory under which `KVLedger` manages its data

type KVLedger

type KVLedger struct {
	// contains filtered or unexported fields
}

KVLedger provides an implementation of `ledger.ValidatedLedger`. This implementation provides a key-value based data model

func CreateLedger

func CreateLedger(name string) (*KVLedger, error)

CreateLedger creates a ledger if one does not exist

func GetLedger

func GetLedger(name string) *KVLedger

GetLedger returns a kvledger it will panic if ledger does not exist

func NewKVLedger

func NewKVLedger(conf *Conf) (*KVLedger, error)

NewKVLedger constructs new `KVLedger`

func (*KVLedger) Close

func (l *KVLedger) Close()

Close closes `KVLedger`

func (*KVLedger) Commit

func (l *KVLedger) Commit() error

Commit commits the valid block (returned in the method RemoveInvalidTransactionsAndPrepare) and related state changes

func (*KVLedger) GetBlockByHash

func (l *KVLedger) GetBlockByHash(blockHash []byte) (*common.Block, error)

GetBlockByHash returns a block given it's hash

func (*KVLedger) GetBlockByNumber

func (l *KVLedger) GetBlockByNumber(blockNumber uint64) (*common.Block, error)

GetBlockByNumber returns block at a given height

func (*KVLedger) GetBlockchainInfo

func (l *KVLedger) GetBlockchainInfo() (*pb.BlockchainInfo, error)

GetBlockchainInfo returns basic info about blockchain

func (*KVLedger) GetBlocksIterator

func (l *KVLedger) GetBlocksIterator(startBlockNumber uint64) (ledger.ResultsIterator, error)

GetBlocksIterator returns an iterator that starts from `startBlockNumber`(inclusive). The iterator is a blocking iterator i.e., it blocks till the next block gets available in the ledger ResultsIterator contains type BlockHolder

func (*KVLedger) GetTransactionByID

func (l *KVLedger) GetTransactionByID(txID string) (*pb.Transaction, error)

GetTransactionByID retrieves a transaction by id

func (*KVLedger) NewQueryExecutor

func (l *KVLedger) NewQueryExecutor() (ledger.QueryExecutor, error)

NewQueryExecutor gives handle to a query executer. A client can obtain more than one 'QueryExecutor's for parallel execution. Any synchronization should be performed at the implementation level if required

func (*KVLedger) NewTxSimulator

func (l *KVLedger) NewTxSimulator() (ledger.TxSimulator, error)

NewTxSimulator returns new `ledger.TxSimulator`

func (*KVLedger) Prune

func (l *KVLedger) Prune(policy ledger.PrunePolicy) error

Prune prunes the blocks/transactions that satisfy the given policy

func (*KVLedger) RemoveInvalidTransactionsAndPrepare

func (l *KVLedger) RemoveInvalidTransactionsAndPrepare(block *common.Block) (*common.Block, []*pb.InvalidTransaction, error)

RemoveInvalidTransactionsAndPrepare validates all the transactions in the given block and returns a block that contains only valid transactions and a list of transactions that are invalid

func (*KVLedger) Rollback

func (l *KVLedger) Rollback()

Rollback rollbacks the changes caused by the last invocation to method `RemoveInvalidTransactionsAndPrepare`

type LedgerCreateErr

type LedgerCreateErr string

LedgerCreateErr exists error

func (LedgerCreateErr) Error

func (l LedgerCreateErr) Error() string

type LedgerExistsErr

type LedgerExistsErr string

LedgerExistsErr exists error

func (LedgerExistsErr) Error

func (l LedgerExistsErr) Error() string

type LedgerNotInitializedErr

type LedgerNotInitializedErr string

LedgerNotInitializedErr exists error

func (LedgerNotInitializedErr) Error

func (l LedgerNotInitializedErr) Error() string

Directories

Path Synopsis
main command
marble_example
main command

Jump to

Keyboard shortcuts

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