package
0.0.0-20191017011114-667e4383b672
Repository: https://github.com/abchain/fabric.git
Documentation: pkg.go.dev

# README

Ledger Package

This package implements the ledger, which includes the blockchain and global state.

YA-fabric has refactored this module and provided a more robust implement, with entries easy to be used

Mutiple ledgers

In YA-fabric, developer can run mutiple ledger objects in an instance. All of them have their separated blockchain, state and block indexes. And they share a storage pool for graphics of states, and transactions, which can be accessed from the globalLedger singleton (Each ledger object also integrated the entry of globalLedger)

GetNewLedger API can be used to create new ledger, replace of the legacy "GetLedger". The later function can still be used for accessing a default ledger object

Concurrent supporting

A ledger object now can be read by mutiple-thread and written by single-thread (Single Write Mutiple Reads, or SWMR). User can use a snapshot of database to get data consistent in a query transction, even another transaction is just changing the underlying database

Execution and committing entries

TxExecState, a new designed object, is provided for executing transactions, replace the old API for world-states. The new object allow concurrent execution of txs, and in combination of the committing entries form a new environment for chaincode platform.

A series of committing objects, see ledger_commit.go and ledger_commit_sync.go is used for updating ledger now. They have a unified interface on handling each elements in the ledger (blocks, states and indexes) and can be applied by requirement of different scenes like committing a new block after executing a bunch of transactions, inserting a block, or syncing the whole world-state, etc.

Syncing of world-state

A practical syncing implement for the whole world-state, via the new Dividable interface, is avaliable now. So peers can transfer their world-state data with resumable, verifiable process, which may be able to save much traffic and computational cost.

Currently only buckettree has implied the 'diviable' interface

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
GetLedger - gives a reference to a 'singleton' ledger.
GetLedger - gives a reference to a 'singleton' global ledger, it was the only singleton part (the ledger singleton is just for compatible).
GetNewLedger - gives a reference to a new ledger TODO need better approach.
No description provided by the author
No description provided by the author
InitTestLedger provides a ledger for testing.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

ErrorTypeBlockNotFound used to indicate if a block is not found when looked up by it's hash.
ErrorTypeFatalCommit used to indicate fatal error in commit: we obtain unexpected differentresult (hashes) from different source (e.g.: by local execution and incoming block).
ErrorTypeInvalidArgument used to indicate the invalid input to ledger method.
ErrorTypeOutOfBounds used to indicate that a request is out of bounds.
ErrorTypeResourceNotFound used to indicate if a resource is not found.

# Variables

export the build block function.
No description provided by the author
ErrOutOfBounds is returned if a request is out of bounds.
ErrResourceNotFound is returned if a resource is not found.

# Structs

commit blocks, can work concurrent with mutiple block commiter, or state commiter.
Error can be used for throwing an error from ledger code.
Ledger - the struct for openchain ledger Threadsafy: we purpose ledger is a read-safe object for multi-thread but NOT write-safe.
Ledger - the struct for openchain ledger.
No description provided by the author
No description provided by the author
state syncing commiter.
full tx commiter, to build new block and corresponding state on top of current chainfrom the execution results of a bunch of txs.
No description provided by the author

# Interfaces

BlockChainAccessor interface for retreiving blocks by block number.
BlockChainModifier interface for applying changes to the block chain.
BlockChainUtil interface for interrogating the block chain.
StateAccessor interface for query states of current history and global.
StateManager interface for manage history view and global states.

# Type aliases

ErrorType represents the type of a ledger error.
only the "raw" block (i.e.
No description provided by the author