committer

package
v1.4.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Committer

type Committer interface {

	// CommitWithPvtData block and private data into the ledger
	CommitWithPvtData(blockAndPvtData *ledger.BlockAndPvtData) error

	// GetPvtDataAndBlockByNum retrieves block with private data with given
	// sequence number
	GetPvtDataAndBlockByNum(seqNum uint64) (*ledger.BlockAndPvtData, error)

	// GetPvtDataByNum returns a slice of the private data from the ledger
	// for given block and based on the filter which indicates a map of
	// collections and namespaces of private data to retrieve
	GetPvtDataByNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)

	// Get recent block sequence number
	LedgerHeight() (uint64, error)

	// Gets blocks with sequence numbers provided in the slice
	GetBlocks(blockSeqs []uint64) []*common.Block

	// GetConfigHistoryRetriever returns the ConfigHistoryRetriever
	GetConfigHistoryRetriever() (ledger.ConfigHistoryRetriever, error)

	// CommitPvtDataOfOldBlocks commits the private data corresponding to already committed block
	// If hashes for some of the private data supplied in this function does not match
	// the corresponding hash present in the block, the unmatched private data is not
	// committed and instead the mismatch inforation is returned back
	CommitPvtDataOfOldBlocks(blockPvtData []*ledger.BlockPvtData) ([]*ledger.PvtdataHashMismatch, error)

	// GetMissingPvtDataTracker return the MissingPvtDataTracker
	GetMissingPvtDataTracker() (ledger.MissingPvtDataTracker, error)

	// Closes committing service
	Close()
}

Committer is the interface supported by committers The only committer is noopssinglechain committer. The interface is intentionally sparse with the sole aim of "leave-everything-to-the-committer-for-now". As we solidify the bootstrap process and as we add more support (such as Gossip) this interface will change

type ConfigBlockEventer

type ConfigBlockEventer func(block *common.Block) error

ConfigBlockEventer callback function proto type to define action upon arrival on new configuaration update block

type LedgerCommitter

type LedgerCommitter struct {
	PeerLedgerSupport
	// contains filtered or unexported fields
}

LedgerCommitter is the implementation of Committer interface it keeps the reference to the ledger to commit blocks and retrieve chain information

func NewLedgerCommitter

func NewLedgerCommitter(ledger PeerLedgerSupport) *LedgerCommitter

NewLedgerCommitter is a factory function to create an instance of the committer which passes incoming blocks via validation and commits them into the ledger.

func NewLedgerCommitterReactive

func NewLedgerCommitterReactive(ledger PeerLedgerSupport, eventer ConfigBlockEventer) *LedgerCommitter

NewLedgerCommitterReactive is a factory function to create an instance of the committer same as way as NewLedgerCommitter, while also provides an option to specify callback to be called upon new configuration block arrival and commit event

func (*LedgerCommitter) CommitWithPvtData

func (lc *LedgerCommitter) CommitWithPvtData(blockAndPvtData *ledger.BlockAndPvtData) error

CommitWithPvtData commits blocks atomically with private data

func (*LedgerCommitter) GetBlocks

func (lc *LedgerCommitter) GetBlocks(blockSeqs []uint64) []*common.Block

GetBlocks used to retrieve blocks with sequence numbers provided in the slice

func (*LedgerCommitter) GetPvtDataAndBlockByNum

func (lc *LedgerCommitter) GetPvtDataAndBlockByNum(seqNum uint64) (*ledger.BlockAndPvtData, error)

GetPvtDataAndBlockByNum retrieves private data and block for given sequence number

func (*LedgerCommitter) LedgerHeight

func (lc *LedgerCommitter) LedgerHeight() (uint64, error)

LedgerHeight returns recently committed block sequence number

type PeerLedgerSupport

type PeerLedgerSupport interface {
	GetPvtDataAndBlockByNum(blockNum uint64, filter ledger.PvtNsCollFilter) (*ledger.BlockAndPvtData, error)

	GetPvtDataByNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)

	CommitWithPvtData(blockAndPvtdata *ledger.BlockAndPvtData) error

	CommitPvtDataOfOldBlocks(blockPvtData []*ledger.BlockPvtData) ([]*ledger.PvtdataHashMismatch, error)

	GetBlockchainInfo() (*common.BlockchainInfo, error)

	GetBlockByNumber(blockNumber uint64) (*common.Block, error)

	GetConfigHistoryRetriever() (ledger.ConfigHistoryRetriever, error)

	GetMissingPvtDataTracker() (ledger.MissingPvtDataTracker, error)

	Close()
}

PeerLedgerSupport abstract out the API's of ledger.PeerLedger interface required to implement LedgerCommitter

Directories

Path Synopsis
mocks
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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