ledger

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAndPvtData added in v1.1.0

type BlockAndPvtData struct {
	Block          *common.Block
	PvtData        TxPvtDataMap
	MissingPvtData TxMissingPvtDataMap
}

BlockAndPvtData encapsulates the block and a map that contains the tuples <seqInBlock, *TxPvtData> The map is expected to contain the entries only for the transactions that has associated pvt data

type BlockPvtdata

type BlockPvtdata struct {
	PvtData        TxPvtDataMap
	MissingPvtData TxMissingPvtDataMap
}

BlockPvtdata contains the retrieved private data as well as missing and ineligible private data for use at commit time

type ChaincodeDefinition

type ChaincodeDefinition struct {
	Name              string
	Hash              []byte
	Version           string
	CollectionConfigs *peer.CollectionConfigPackage
}

ChaincodeDefinition captures the info about chaincode

func (*ChaincodeDefinition) String

func (cdef *ChaincodeDefinition) String() string

type ChaincodeLifecycleDetails added in v1.3.0

type ChaincodeLifecycleDetails struct {
	Updated bool // true, if an existing chaincode is updated (false for newly deployed chaincodes).
	// Following attributes are meaningful only if 'Updated' is true
	HashChanged        bool     // true, if the chaincode code package is changed
	CollectionsUpdated []string // names of the explicit collections that are either added or updated
	CollectionsRemoved []string // names of the explicit collections that are removed
}

ChaincodeLifecycleDetails captures the finer details of chaincode lifecycle event

type ChaincodeLifecycleEventListener

type ChaincodeLifecycleEventListener interface {
	// HandleChaincodeDeploy is invoked when chaincode installed + defined becomes true.
	// The expected usage are to creates all the necessary statedb structures (such as indexes) and update
	// service discovery info. This function is invoked immediately before the committing the state changes
	// that contain chaincode definition or when a chaincode install happens
	HandleChaincodeDeploy(chaincodeDefinition *ChaincodeDefinition, dbArtifactsTar []byte) error
	// ChaincodeDeployDone is invoked after the chaincode deployment is finished - `succeeded` indicates
	// whether the deploy finished successfully
	ChaincodeDeployDone(succeeded bool)
}

ChaincodeLifecycleEventListener interface enables ledger components (mainly, intended for statedb) to be able to listen to chaincode lifecycle events. 'dbArtifactsTar' represents db specific artifacts (such as index specs) packaged in a tar. Note that this interface is redefined here (in addition to the one defined in ledger/cceventmgmt package). Using the same interface for the new lifecycle path causes a cyclic import dependency. Moreover, eventually the whole package ledger/cceventmgmt is intented to be removed when migration to new lifecycle is mandated.

type ChaincodeLifecycleEventProvider

type ChaincodeLifecycleEventProvider interface {
	RegisterListener(channelID string, listener ChaincodeLifecycleEventListener)
}

type ChaincodeLifecycleInfo added in v1.3.0

type ChaincodeLifecycleInfo struct {
	Name    string
	Deleted bool
	Details *ChaincodeLifecycleDetails // Can contain finer details about lifecycle event that can be used for certain optimization
}

ChaincodeLifecycleInfo captures the update info of a chaincode

type CollConfigNotDefinedError added in v1.3.0

type CollConfigNotDefinedError struct {
	Ns string
}

CollConfigNotDefinedError is returned whenever an operation is requested on a collection whose config has not been defined

func (*CollConfigNotDefinedError) Error added in v1.3.0

func (e *CollConfigNotDefinedError) Error() string

type CollectionConfigInfo added in v1.2.0

type CollectionConfigInfo struct {
	CollectionConfig   *peer.CollectionConfigPackage
	CommittingBlockNum uint64
}

CollectionConfigInfo encapsulates a collection config for a chaincode and its committing block number

type CollectionPvtdataInfo

type CollectionPvtdataInfo struct {
	Namespace, Collection string
	ExpectedHash          []byte
	CollectionConfig      *peer.StaticCollectionConfig
	Endorsers             []*peer.Endorsement
}

CollectionPvtdataInfo contains information about the private data for a given collection

type CommitOptions added in v1.4.2

type CommitOptions struct {
	FetchPvtDataFromLedger bool
}

CommitOptions encapsulates options associated with a block commit.

type Config

type Config struct {
	// RootFSPath is the top-level directory where ledger files are stored.
	RootFSPath string
	// StateDBConfig holds the configuration parameters for the state database.
	StateDBConfig *StateDBConfig
	// PrivateDataConfig holds the configuration parameters for the private data store.
	PrivateDataConfig *PrivateDataConfig
	// HistoryDBConfig holds the configuration parameters for the transaction history database.
	HistoryDBConfig *HistoryDBConfig
}

Config is a structure used to configure a ledger provider.

type ConfigHistoryRetriever added in v1.2.0

type ConfigHistoryRetriever interface {
	CollectionConfigAt(blockNum uint64, chaincodeName string) (*CollectionConfigInfo, error)
	MostRecentCollectionConfigBelow(blockNum uint64, chaincodeName string) (*CollectionConfigInfo, error)
}

ConfigHistoryRetriever allow retrieving history of collection configs

type CustomTxProcessor

type CustomTxProcessor interface {
	GenerateSimulationResults(txEnvelop *common.Envelope, simulator TxSimulator, initializingLedger bool) error
}

CustomTxProcessor allows to generate simulation results during commit time for custom transactions. A custom processor may represent the information in a propriety fashion and can use this process to translate the information into the form of `TxSimulationResults`. Because, the original information is signed in a custom representation, an implementation of a `Processor` should be cautious that the custom representation is used for simulation in an deterministic fashion and should take care of compatibility cross fabric versions. 'initializingLedger' true indicates that either the transaction being processed is from the genesis block or the ledger is synching the state (which could happen during peer startup if the statedb is found to be lagging behind the blockchain). In the former case, the transactions processed are expected to be valid and in the latter case, only valid transactions are reprocessed and hence any validation can be skipped.

type DeployedChaincodeInfo added in v1.3.0

type DeployedChaincodeInfo struct {
	Name                        string
	Hash                        []byte
	Version                     string
	ExplicitCollectionConfigPkg *peer.CollectionConfigPackage
	IsLegacy                    bool
}

DeployedChaincodeInfo encapsulates chaincode information from the deployed chaincodes

type DeployedChaincodeInfoProvider added in v1.3.0

type DeployedChaincodeInfoProvider interface {
	// Namespaces returns the slice of the namespaces that are used for maintaining chaincode lifecycle data
	Namespaces() []string
	// UpdatedChaincodes returns the chaincodes that are getting updated by the supplied 'stateUpdates'
	UpdatedChaincodes(stateUpdates map[string][]*kvrwset.KVWrite) ([]*ChaincodeLifecycleInfo, error)
	// ChaincodeInfo returns the info about a deployed chaincode
	ChaincodeInfo(channelName, chaincodeName string, qe SimpleQueryExecutor) (*DeployedChaincodeInfo, error)
	// CollectionInfo returns the proto msg that defines the named collection. This function can be called for both explicit and implicit collections
	CollectionInfo(channelName, chaincodeName, collectionName string, qe SimpleQueryExecutor) (*peer.StaticCollectionConfig, error)
	// ImplicitCollections returns a slice that contains one proto msg for each of the implicit collections
	ImplicitCollections(channelName, chaincodeName string, qe SimpleQueryExecutor) ([]*peer.StaticCollectionConfig, error)
	// AllCollectionsConfigPkg returns a combined collection config pkg that contains both explicit and implicit collections
	AllCollectionsConfigPkg(channelName, chaincodeName string, qe SimpleQueryExecutor) (*peer.CollectionConfigPackage, error)
}

DeployedChaincodeInfoProvider is a dependency that is used by ledger to build collection config history LSCC module is expected to provide an implementation for this dependencies

type ErrCollectionConfigNotYetAvailable added in v1.2.0

type ErrCollectionConfigNotYetAvailable struct {
	MaxBlockNumCommitted uint64
	Msg                  string
}

ErrCollectionConfigNotYetAvailable is an error which is returned from the function ConfigHistoryRetriever.CollectionConfigAt() if the latest block number committed is lower than the block number specified in the request.

func (*ErrCollectionConfigNotYetAvailable) Error added in v1.2.0

type Hasher

type Hasher interface {
	Hash(msg []byte, opts bccsp.HashOpts) (hash []