...

Package transientstore

import "github.com/hyperledger/fabric/core/transientstore"
Overview
Index

Overview ▾

Variables

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

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

func GetTransientStorePath

func GetTransientStorePath() string

GetTransientStorePath returns the filesystem path for temporarily storing the private rwset

type EndorserPvtSimulationResults

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 EndorserPvtSimulationResults struct {
    ReceivedAtBlockHeight uint64
    PvtSimulationResults  *rwset.TxPvtReadWriteSet
}

type EndorserPvtSimulationResultsWithConfig

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

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

type RWSetScanner

RWSetScanner provides an iterator for EndorserPvtSimulationResults

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()
}

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

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

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 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()
}

type StoreEnv

StoreEnv provides the store env for testing

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

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

StoreProvider provides an instance of a TransientStore

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

func NewStoreProvider

func NewStoreProvider() StoreProvider

NewStoreProvider instantiates TransientStoreProvider