ledger

package
v0.0.0-...-95b87ed Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAndPvtData

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

type BlockPvtData

type BlockPvtData struct {
	BlockNum  uint64
	WriteSets TxPvtDataMap
}

type ChaincodeDefinition

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

func (*ChaincodeDefinition) String

func (cdef *ChaincodeDefinition) String() string

type ChaincodeLifecycleDetails

type ChaincodeLifecycleDetails struct {
	Updated bool

	HashChanged        bool
	CollectionsUpdated []string
	CollectionsRemoved []string
}

type ChaincodeLifecycleEventListener

type ChaincodeLifecycleEventListener interface {
	HandleChaincodeDeploy(chaincodeDefinition *ChaincodeDefinition, dbArtifactsTar []byte) error

	ChaincodeDeployDone(succeeded bool)
}

type ChaincodeLifecycleEventProvider

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

type ChaincodeLifecycleInfo

type ChaincodeLifecycleInfo struct {
	Name    string
	Deleted bool
	Details *ChaincodeLifecycleDetails
}

type CollConfigNotDefinedError

type CollConfigNotDefinedError struct {
	Ns string
}

func (*CollConfigNotDefinedError) Error

func (e *CollConfigNotDefinedError) Error() string

type CollectionConfigInfo

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

type CommitOptions

type CommitOptions struct {
	FetchPvtDataFromLedger bool
}

type Config

type Config struct {
	RootFSPath string

	StateDBConfig *StateDBConfig

	PrivateDataConfig *PrivateDataConfig

	HistoryDBConfig *HistoryDBConfig
}

type ConfigHistoryRetriever

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

type CustomTxProcessor

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

type DeployedChaincodeInfo

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

func (DeployedChaincodeInfo) AllCollectionsConfigPkg

func (dci DeployedChaincodeInfo) AllCollectionsConfigPkg() *common.CollectionConfigPackage

type DeployedChaincodeInfoProvider

type DeployedChaincodeInfoProvider interface {
	Namespaces() []string

	UpdatedChaincodes(stateUpdates map[string][]*kvrwset.KVWrite) ([]*ChaincodeLifecycleInfo, error)

	ChaincodeInfo(channelName, chaincodeName string, qe SimpleQueryExecutor) (*DeployedChaincodeInfo, error)

	CollectionInfo(channelName, chaincodeName, collectionName string, qe SimpleQueryExecutor) (*common.StaticCollectionConfig, error)

	ImplicitCollections(channelName, chaincodeName string, qe SimpleQueryExecutor) ([]*common.StaticCollectionConfig, error)
}

type ErrCollectionConfigNotYetAvailable

type ErrCollectionConfigNotYetAvailable struct {
	MaxBlockNumCommitted uint64
	Msg                  string
}

func (*ErrCollectionConfigNotYetAvailable) Error

type HealthCheckRegistry

type HealthCheckRegistry interface {
	RegisterChecker(string, healthz.HealthChecker) error
}

type HistoryDBConfig

type HistoryDBConfig struct {
	Enabled bool
}

type HistoryQueryExecutor

type HistoryQueryExecutor interface {
	GetHistoryForKey(namespace string, key string) (commonledger.ResultsIterator, error)
}

type Initializer

type Initializer struct {
	StateListeners                  []StateListener
	DeployedChaincodeInfoProvider   DeployedChaincodeInfoProvider
	MembershipInfoProvider          MembershipInfoProvider
	ChaincodeLifecycleEventProvider ChaincodeLifecycleEventProvider
	MetricsProvider                 metrics.Provider
	HealthCheckRegistry             HealthCheckRegistry
	Config                          *Config
	CustomTxProcessors              map[common.HeaderType]CustomTxProcessor
}

type InvalidCollNameError

type InvalidCollNameError struct {
	Ns, Coll string
}

func (*InvalidCollNameError) Error

func (e *InvalidCollNameError) Error() string

type InvalidTxError

type InvalidTxError struct {
	Msg string
}

func (*InvalidTxError) Error

func (e *InvalidTxError) Error() string

type KVStateUpdates

type KVStateUpdates struct {
	PublicUpdates   []*kvrwset.KVWrite
	CollHashUpdates map[string][]*kvrwset.KVWriteHash
}

type MembershipInfoProvider

type MembershipInfoProvider interface {
	AmMemberOf(channelName string, collectionPolicyConfig *common.CollectionPolicyConfig) (bool, error)
}

type MissingBlockPvtdataInfo

type MissingBlockPvtdataInfo map[uint64][]*MissingCollectionPvtDataInfo

type MissingCollectionPvtDataInfo

type MissingCollectionPvtDataInfo struct {
	Namespace, Collection string
}

type MissingPvtData

type MissingPvtData struct {
	Namespace  string
	Collection string
	IsEligible bool
}

type MissingPvtDataInfo

type MissingPvtDataInfo map[uint64]MissingBlockPvtdataInfo

func (MissingPvtDataInfo) Add

func (missingPvtDataInfo MissingPvtDataInfo) Add(blkNum, txNum uint64, ns, coll string)

type MissingPvtDataTracker

type MissingPvtDataTracker interface {
	GetMissingPvtDataInfoForMostRecentBlocks(maxBlocks int) (MissingPvtDataInfo, error)
}

type NotFoundInIndexErr

type NotFoundInIndexErr string

func (NotFoundInIndexErr) Error

func (NotFoundInIndexErr) Error() string

type PeerLedger

type PeerLedger interface {
	commonledger.Ledger

	GetTransactionByID(txID string) (*peer.ProcessedTransaction, error)

	GetBlockByHash(blockHash []byte) (*common.Block, error)

	GetBlockByTxID(txID string) (*common.Block, error)

	GetTxValidationCodeByTxID(txID string) (peer.TxValidationCode, error)

	NewTxSimulator(txid string) (TxSimulator, error)

	NewQueryExecutor() (QueryExecutor, error)

	NewHistoryQueryExecutor() (HistoryQueryExecutor, error)

	GetPvtDataAndBlockByNum(blockNum uint64, filter PvtNsCollFilter) (*BlockAndPvtData, error)

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

	CommitLegacy(blockAndPvtdata *BlockAndPvtData, commitOpts *CommitOptions) error

	GetConfigHistoryRetriever() (ConfigHistoryRetriever, error)

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

	GetMissingPvtDataTracker() (MissingPvtDataTracker, error)

	DoesPvtDataInfoExist(blockNum uint64) (bool, error)
}

type PeerLedgerProvider

type PeerLedgerProvider interface {
	Create(genesisBlock *common.Block) (PeerLedger, error)

	Open(ledgerID string) (PeerLedger, error)

	Exists(ledgerID string) (bool, error)

	List() ([]string, error)

	Close()
}

type PrivateDataConfig

type PrivateDataConfig struct {
	BatchesInterval int

	MaxBatchSize int

	PurgeInterval int
}

type PvtCollFilter

type PvtCollFilter map[string]bool

type PvtNsCollFilter

type PvtNsCollFilter map[string]PvtCollFilter

func NewPvtNsCollFilter

func NewPvtNsCollFilter() PvtNsCollFilter

func (PvtNsCollFilter) Add

func (filter PvtNsCollFilter) Add(ns string, coll string)

func (PvtNsCollFilter) Has

func (filter PvtNsCollFilter) Has(ns string, coll string) bool

type PvtdataHashMismatch

type PvtdataHashMismatch struct {
	BlockNum, TxNum       uint64
	Namespace, Collection string
	ExpectedHash          []byte
}

type QueryExecutor

type QueryExecutor interface {
	SimpleQueryExecutor

	GetStateMetadata(namespace, key string) (map[string][]byte, error)

	GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)

	GetStateRangeScanIteratorWithMetadata(namespace string, startKey, endKey string, metadata map[string]interface{}) (QueryResultsIterator, error)

	ExecuteQuery(namespace, query string) (commonledger.ResultsIterator, error)

	ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (QueryResultsIterator, error)

	GetPrivateData(namespace, collection, key string) ([]byte, error)

	GetPrivateDataMetadata(namespace, collection, key string) (map[string][]byte, error)

	GetPrivateDataMetadataByHash(namespace, collection string, keyhash []byte) (map[string][]byte, error)

	GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([][]byte, error)

	GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (commonledger.ResultsIterator, error)

	ExecuteQueryOnPrivateData(namespace, collection, query string) (commonledger.ResultsIterator, error)

	Done()
}

type QueryResultsIterator

type QueryResultsIterator interface {
	commonledger.ResultsIterator

	GetBookmarkAndClose() string
}

type SimpleQueryExecutor

type SimpleQueryExecutor interface {
	GetState(namespace string, key string) ([]byte, error)

	GetStateRangeScanIterator(namespace string, startKey string, endKey string) (commonledger.ResultsIterator, error)

	GetPrivateDataHash(namespace, collection, key string) ([]byte, error)
}

type StateDBConfig

type StateDBConfig struct {
	StateDatabase string

	CouchDB *couchdb.Config
}

type StateListener

type StateListener interface {
	Initialize(ledgerID string, qe SimpleQueryExecutor) error
	InterestedInNamespaces() []string
	HandleStateUpdates(trigger *StateUpdateTrigger) error
	StateCommitDone(channelID string)
}

type StateUpdateTrigger

type StateUpdateTrigger struct {
	LedgerID                    string
	StateUpdates                StateUpdates
	CommittingBlockNum          uint64
	CommittedStateQueryExecutor SimpleQueryExecutor
	PostCommitQueryExecutor     SimpleQueryExecutor
}

type StateUpdates

type StateUpdates map[string]*KVStateUpdates

type TxMissingPvtDataMap

type TxMissingPvtDataMap map[uint64][]*MissingPvtData

func (TxMissingPvtDataMap) Add

func (txMissingPvtData TxMissingPvtDataMap) Add(txNum uint64, ns, coll string, isEligible bool)

type TxPvtData

type TxPvtData struct {
	SeqInBlock uint64
	WriteSet   *rwset.TxPvtReadWriteSet
}

func (*TxPvtData) Has

func (pvtdata *TxPvtData) Has(ns string, coll string) bool

type TxPvtDataMap

type TxPvtDataMap map[uint64]*TxPvtData

type TxSimulationResults

type TxSimulationResults struct {
	PubSimulationResults *rwset.TxReadWriteSet
	PvtSimulationResults *rwset.TxPvtReadWriteSet
}

func (*TxSimulationResults) ContainsPvtWrites

func (txSim *TxSimulationResults) ContainsPvtWrites() bool

func (*TxSimulationResults) GetPubSimulationBytes

func (txSim *TxSimulationResults) GetPubSimulationBytes() ([]byte, error)

func (*TxSimulationResults) GetPvtSimulationBytes

func (txSim *TxSimulationResults) GetPvtSimulationBytes() ([]byte, error)

type TxSimulator

type TxSimulator interface {
	QueryExecutor

	SetState(namespace string, key string, value []byte) error

	DeleteState(namespace string, key string) error

	SetStateMultipleKeys(namespace string, kvs map[string][]byte) error

	SetStateMetadata(namespace, key string, metadata map[string][]byte) error

	DeleteStateMetadata(namespace, key string) error

	ExecuteUpdate(query string) error

	SetPrivateData(namespace, collection, key string, value []byte) error

	SetPrivateDataMultipleKeys(namespace, collection string, kvs map[string][]byte) error

	DeletePrivateData(namespace, collection, key string) error

	SetPrivateDataMetadata(namespace, collection, key string, metadata map[string][]byte) error

	DeletePrivateDataMetadata(namespace, collection, key string) error

	GetTxSimulationResults() (*TxSimulationResults, error)
}

Jump to

Keyboard shortcuts

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