{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package privdata\n\n## Constants\n\n```go\nconst (\n\tTransientBlockRetentionDefault = 1000\n)\n```\n\n## Functions\n\n```go\nfunc GetBtlPullMargin() uint64\n```\n\n```go\nfunc GetTransientBlockRetention() uint64\n```\n\n```go\nfunc NewPuller(metrics *metrics.PrivdataMetrics, cs privdata.CollectionStore, g gossip,\n\tdataRetriever PrivateDataRetriever, factory CollectionAccessFactory, channel string, btlPullMargin uint64) *puller\n```\nNewPuller creates new private data puller\n\n## Types\n\n```go\ntype AppCapabilities interface {\n\tchannelconfig.ApplicationCapabilities\n}\n```\nappCapabilities local interface used to generate mock for foreign interface.\n\n```go\ntype CapabilityProvider interface {\n\t// Capabilities defines the capabilities for the application portion of this channel\n\tCapabilities() channelconfig.ApplicationCapabilities\n}\n```\nCapabilityProvider contains functions to retrieve capability information for a channel\n\n```go\ntype CollectionAccessFactory interface {\n\t// AccessPolicy based on collection configuration\n\tAccessPolicy(config *common.CollectionConfig, chainID string) (privdata.CollectionAccessPolicy, error)\n}\n```\nCollectionAccessFactory an interface to generate collection access policy\n\n```go\nfunc NewCollectionAccessFactory(factory IdentityDeserializerFactory) CollectionAccessFactory\n```\nNewCollectionAccessFactory\n\n```go\ntype Coordinator interface {\n\t// StoreBlock deliver new block with underlined private data\n\t// returns missing transaction ids\n\tStoreBlock(block *common.Block, data util.PvtDataCollections) error\n\n\t// StorePvtData used to persist private data into transient store\n\tStorePvtData(txid string, privData *transientstore2.TxPvtReadWriteSetWithConfigInfo, blckHeight uint64) error\n\n\t// GetPvtDataAndBlockByNum get block by number and returns also all related private data\n\t// the order of private data in slice of PvtDataCollections doesn't implies the order of\n\t// transactions in the block related to these private data, to get the correct placement\n\t// need to read TxPvtData.SeqInBlock field\n\tGetPvtDataAndBlockByNum(seqNum uint64, peerAuth common.SignedData) (*common.Block, util.PvtDataCollections, error)\n\n\t// Get recent block sequence number\n\tLedgerHeight() (uint64, error)\n\n\t// Close coordinator, shuts down coordinator service\n\tClose()\n}\n```\nCoordinator orchestrates the flow of the new blocks arrival and in flight transient data, responsible to complete missing parts of transient data for given block.\n\n```go\nfunc NewCoordinator(support Support, selfSignedData common.SignedData, metrics *metrics.PrivdataMetrics,\n\tconfig CoordinatorConfig) Coordinator\n```\nNewCoordinator creates a new instance of coordinator\n\n```go\ntype CoordinatorConfig struct {\n\tTransientBlockRetention        uint64\n\tPullRetryThreshold             time.Duration\n\tSkipPullingInvalidTransactions bool\n}\n```\n\n```go\ntype DataStore interface {\n\t// GetTxPvtRWSetByTxid returns an iterator due to the fact that the txid may have multiple private\n\t// RWSets persisted from different endorsers (via Gossip)\n\tGetTxPvtRWSetByTxid(txid string, filter ledger.PvtNsCollFilter) (transientstore.RWSetScanner, error)\n\n\t// GetPvtDataByNum returns a slice of the private data from the ledger\n\t// for given block and based on the filter which indicates a map of\n\t// collections and namespaces of private data to retrieve\n\tGetPvtDataByNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)\n\n\t// GetConfigHistoryRetriever returns the ConfigHistoryRetriever\n\tGetConfigHistoryRetriever() (ledger.ConfigHistoryRetriever, error)\n\n\t// Get recent block sequence number\n\tLedgerHeight() (uint64, error)\n}\n```\nDataStore defines set of APIs need to get private data from underlined data store\n\n```go\ntype Dig2PvtRWSetWithConfig map[privdatacommon.DigKey]*util.PrivateRWSetWithConfig\n```\nDig2PvtRWSetWithConfig\n\n```go\ntype Fetcher interface {\n\t// contains filtered or unexported methods\n}\n```\nFetcher interface which defines API to fetch missing private data elements\n\n```go\ntype IdentityDeserializerFactory interface {\n\t// GetIdentityDeserializer returns an IdentityDeserializer\n\t// instance for the specified chain\n\tGetIdentityDeserializer(chainID string) msp.IdentityDeserializer\n}\n```\nIdentityDeserializerFactory is a factory interface to create IdentityDeserializer for given channel\n\n```go\ntype NoOpReconciler struct {\n}\n```\nNoOpReconciler non functional reconciler to be used in case reconciliation has been disabled\n\n```go\nfunc (*NoOpReconciler) Start()\n```\n\n```go\nfunc (*NoOpReconciler) Stop()\n```\n\n```go\ntype PrivateDataRetriever interface {\n\t// CollectionRWSet returns the bytes of CollectionPvtReadWriteSet for a given txID and collection from the transient store\n\tCollectionRWSet(dig []*proto.PvtDataDigest, blockNum uint64) (Dig2PvtRWSetWithConfig, bool, error)\n}\n```\nPrivateDataRetriever interface which defines API capable of retrieving required private data\n\n```go\ntype PvtDataDistributor interface {\n\t// Distribute broadcast reliably private data read write set based on policies\n\tDistribute(txID string, privData *transientstore.TxPvtReadWriteSetWithConfigInfo, blkHt uint64) error\n}\n```\nPvtDataDistributor interface to defines API of distributing private data\n\n```go\nfunc NewDistributor(chainID string, gossip gossipAdapter, factory CollectionAccessFactory,\n\tmetrics *metrics.PrivdataMetrics, pushAckTimeout time.Duration) PvtDataDistributor\n```\nNewDistributor a constructor for private data distributor capable to send private read write sets for underlying collection\n\n```go\ntype PvtDataReconciler interface {\n\t// Start function start the reconciler based on a scheduler, as was configured in reconciler creation\n\tStart()\n\t// Stop function stops reconciler\n\tStop()\n}\n```\nReconciler completes missing parts of private data that weren't available during commit time. this is done by getting from the ledger a list of missing private data and pulling it from the other peers.\n\n```go\ntype Reconciler struct {\n\tReconciliationFetcher\n\tcommitter.Committer\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewReconciler(channel string, metrics *metrics.PrivdataMetrics, c committer.Committer,\n\tfetcher ReconciliationFetcher, config *ReconcilerConfig) *Reconciler\n```\nNewReconciler creates a new instance of reconciler\n\n```go\nfunc (r *Reconciler) Start()\n```\n\n```go\nfunc (r *Reconciler) Stop()\n```\n\n```go\ntype ReconcilerConfig struct {\n\tSleepInterval time.Duration\n\tBatchSize     int\n\tIsEnabled     bool\n}\n```\nReconcilerConfig holds config flags that are read from core.yaml\n\n```go\nfunc GetReconcilerConfig() *ReconcilerConfig\n```\nthis func reads reconciler configuration values from core.yaml and returns ReconcilerConfig\n\n```go\ntype ReconciliationFetcher interface {\n\tFetchReconciledItems(dig2collectionConfig privdatacommon.Dig2CollectionConfig) (*privdatacommon.FetchedPvtDataContainer, error)\n}\n```\nReconciliationFetcher interface which defines API to fetch private data elements that have to be reconciled\n\n```go\ntype StorageDataRetriever interface {\n\t// CollectionRWSet retrieves for give digest relevant private data if\n\t// available otherwise returns nil, bool which is true if data fetched from ledger and false if was fetched from transient store, and an error\n\tCollectionRWSet(dig []*gossip2.PvtDataDigest, blockNum uint64) (Dig2PvtRWSetWithConfig, bool, error)\n}\n```\nStorageDataRetriever defines an API to retrieve private date from the storage\n\n```go\nfunc NewDataRetriever(store DataStore) StorageDataRetriever\n```\nNewDataRetriever constructing function for implementation of the StorageDataRetriever interface\n\n```go\ntype Support struct {\n\tChainID string\n\tprivdata.CollectionStore\n\ttxvalidator.Validator\n\tcommitter.Committer\n\tTransientStore\n\tFetcher\n\tCapabilityProvider\n}\n```\nSupport encapsulates set of interfaces to aggregate required functionality by single struct\n\n```go\ntype TransientStore interface {\n\t// PersistWithConfig stores the private write set of a transaction along with the collection config\n\t// in the transient store based on txid and the block height the private data was received at\n\tPersistWithConfig(txid string, blockHeight uint64, privateSimulationResultsWithConfig *transientstore2.TxPvtReadWriteSetWithConfigInfo) error\n\n\t// Persist stores the private write set of a transaction in the transient store\n\tPersist(txid string, blockHeight uint64, privateSimulationResults *rwset.TxPvtReadWriteSet) error\n\t// GetTxPvtRWSetByTxid returns an iterator due to the fact that the txid may have multiple private\n\t// write sets persisted from different endorsers (via Gossip)\n\tGetTxPvtRWSetByTxid(txid string, filter ledger.PvtNsCollFilter) (transientstore.RWSetScanner, error)\n\n\t// PurgeByTxids removes private read-write sets for a given set of transactions from the\n\t// transient store\n\tPurgeByTxids(txids []string) error\n\n\t// PurgeByHeight removes private write sets at block height lesser than\n\t// a given maxBlockNumToRetain. In other words, Purge only retains private write sets\n\t// that were persisted at block height of maxBlockNumToRetain or higher. Though the private\n\t// write sets stored in transient store is removed by coordinator using PurgebyTxids()\n\t// after successful block commit, PurgeByHeight() is still required to remove orphan entries (as\n\t// transaction that gets endorsed may not be submitted by the client for commit)\n\tPurgeByHeight(maxBlockNumToRetain uint64) error\n}\n```\nTransientStore holds private data that the corresponding blocks haven't been committed yet into the ledger\n\n","path":"github.com/eric-erki/https-hyperledger.org/gossip/privdata","name":"privdata","synopsis":"","isRedistributable":true}
