transientstore

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStoreEmpty = errors.New("Transient store is empty")

ErrStoreEmpty is used to indicate that there are no entries in transient store

Functions

func GetTransientStorePath

func GetTransientStorePath() string

GetTransientStorePath returns the filesystem path for temporarily storing the private rwset

Types

type EndorserPvtSimulationResults

type EndorserPvtSimulationResults struct {
	ReceivedAtBlockHeight uint64
	PvtSimulationResults  *rwset.TxPvtReadWriteSet
}

EndorserPvtSimulationResults captures the details of the simulation results specific to an endorser TODO: Once the related gossip changes are made as per FAB-5096, remove this struct

type EndorserPvtSimulationResultsWithConfig added in v1.2.0

type EndorserPvtSimulationResultsWithConfig struct {
	ReceivedAtBlockHeight          uint64
	PvtSimulationResultsWithConfig *transientstore.TxPvtReadWriteSetWithConfigInfo
}

EndorserPvtSimulationResultsWithConfig captures the details of the simulation results specific to an endorser

type RWSetScanner

type RWSetScanner interface {
	// Next returns the next EndorserPvtSimulationResults from the RWSetScanner.
	// It may return nil, nil when it has no further data, and also may return an error
	// on failure
	Next() (*EndorserPvtSimulationResults, error)
	// NextWithConfig returns the next EndorserPvtSimulationResultsWithConfig from the RWSetScanner.
	// It may return nil, nil when it has no further data, and also may return an error
	// on failure
	// TODO: Once the related gossip changes are made as per FAB-5096, remove the above function
	// and rename the below function to Next form NextWithConfig.
	NextWithConfig() (*EndorserPvtSimulationResultsWithConfig, error)
	// Close frees the resources associated with this RWSetScanner
	Close()
}

RWSetScanner provides an iterator for EndorserPvtSimulationResults

type RwsetScanner

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

func (*RwsetScanner) Close

func (scanner *RwsetScanner) Close()

Close releases resource held by the iterator

func (*RwsetScanner) Next

func (scanner *RwsetScanner) Next() (*EndorserPvtSimulationResults, error)

Next moves the iterator to the next key/value pair. It returns whether the iterator is exhausted. TODO: Once the related gossip changes are made as per FAB-5096, remove this function

func (*RwsetScanner) NextWithConfig added in v1.2.0

func (scanner *RwsetScanner) NextWithConfig() (*EndorserPvtSimulationResultsWithConfig, error)

Next moves the iterator to the next key/value pair. It returns whether the iterator is exhausted. TODO: Once the related gossip changes are made as per FAB-5096, rename this function to Next

type Store

type Store interface {
	// Persist stores the private write set of a transaction in the transient store
	// based on txid and the block height the private data was received at
	Persist(txid string, blockHeight uint64, privateSimulationResults *rwset.TxPvtReadWriteSet) error
	// TODO: Once the related gossip changes are made as per FAB-5096, remove the above function
	// and rename the below function to Persist form PersistWithConfig.
	// PersistWithConfig stores the private write set of a transaction along with the collection config
	// in the transient store based on txid and the block height the private data was received at
	PersistWithConfig(txid string, blockHeight uint64, privateSimulationResultsWithConfig *transientstore.TxPvtReadWriteSetWithConfigInfo) error
	// GetTxPvtRWSetByTxid returns an iterator due to the fact that the txid may have multiple private
	// write sets persisted from different endorsers (via Gossip)
	GetTxPvtRWSetByTxid(txid string, filter ledger.PvtNsCollFilter) (RWSetScanner, error)
	// PurgeByTxids removes private write sets of a given set of transactions from the
	// transient store
	PurgeByTxids(txids []string) error
	// PurgeByHeight removes private write sets at block height lesser than
	// a given maxBlockNumToRetain. In other words, Purge only retains private write sets
	// that were persisted at block height of maxBlockNumToRetain or higher. Though the private
	// write sets stored in transient store is removed by coordinator using PurgebyTxids()
	// after successful block commit, PurgeByHeight() is still required to remove orphan entries (as
	// transaction that gets endorsed may not be submitted by the client for commit)
	PurgeByHeight(maxBlockNumToRetain uint64) error
	// GetMinTransientBlkHt returns the lowest block height remaining in transient store
	GetMinTransientBlkHt() (uint64, error)
	Shutdown()
}

Store manages the storage of private write sets for a ledgerId. Ideally, a ledger can remove the data from this storage when it is committed to the permanent storage or the pruning of some data items is enforced by the policy

type StoreEnv

type StoreEnv struct {
	TestStoreProvider StoreProvider
	TestStore         Store
	// contains filtered or unexported fields
}

StoreEnv provides the store env for testing

func NewTestStoreEnv

func NewTestStoreEnv(t *testing.T) *StoreEnv

NewTestStoreEnv construct a StoreEnv for testing

func (*StoreEnv) Cleanup

func (env *StoreEnv) Cleanup()

Cleanup cleansup the store env after testing

type StoreProvider

type StoreProvider interface {
	OpenStore(ledgerID string) (Store, error)
	Close()
}

StoreProvider provides an instance of a TransientStore

func NewStoreProvider

func NewStoreProvider() StoreProvider

NewStoreProvider instantiates TransientStoreProvider

Jump to

Keyboard shortcuts

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