fabric: github.com/hyperledger/fabric/gossip/privdata Index | Files | Directories

package privdata

import "github.com/hyperledger/fabric/gossip/privdata"


Package Files

coordinator.go dataretriever.go distributor.go pull.go reconcile.go test_utils.go util.go


const (
    TransientBlockRetentionDefault = 1000

func GetBtlPullMargin Uses

func GetBtlPullMargin() uint64

func GetTransientBlockRetention Uses

func GetTransientBlockRetention() uint64

func NewPuller Uses

func NewPuller(metrics *metrics.PrivdataMetrics, cs privdata.CollectionStore, g gossip,
    dataRetriever PrivateDataRetriever, factory CollectionAccessFactory, channel string, btlPullMargin uint64) *puller

NewPuller creates new private data puller

type AppCapabilities Uses

type AppCapabilities interface {

go:generate mockery -dir ./ -name AppCapabilities -case underscore -output mocks/ appCapabilities local interface used to generate mock for foreign interface.

type CapabilityProvider Uses

type CapabilityProvider interface {
    // Capabilities defines the capabilities for the application portion of this channel
    Capabilities() channelconfig.ApplicationCapabilities

CapabilityProvider contains functions to retrieve capability information for a channel

type CollectionAccessFactory Uses

type CollectionAccessFactory interface {
    // AccessPolicy based on collection configuration
    AccessPolicy(config *common.CollectionConfig, chainID string) (privdata.CollectionAccessPolicy, error)

CollectionAccessFactory an interface to generate collection access policy

func NewCollectionAccessFactory Uses

func NewCollectionAccessFactory(factory IdentityDeserializerFactory) CollectionAccessFactory


type Coordinator Uses

type Coordinator interface {
    // StoreBlock deliver new block with underlined private data
    // returns missing transaction ids
    StoreBlock(block *common.Block, data util.PvtDataCollections) error

    // StorePvtData used to persist private data into transient store
    StorePvtData(txid string, privData *transientstore2.TxPvtReadWriteSetWithConfigInfo, blckHeight uint64) error

    // GetPvtDataAndBlockByNum get block by number and returns also all related private data
    // the order of private data in slice of PvtDataCollections doesn't implies the order of
    // transactions in the block related to these private data, to get the correct placement
    // need to read TxPvtData.SeqInBlock field
    GetPvtDataAndBlockByNum(seqNum uint64, peerAuth common.SignedData) (*common.Block, util.PvtDataCollections, error)

    // Get recent block sequence number
    LedgerHeight() (uint64, error)

    // Close coordinator, shuts down coordinator service

Coordinator orchestrates the flow of the new blocks arrival and in flight transient data, responsible to complete missing parts of transient data for given block.

func NewCoordinator Uses

func NewCoordinator(support Support, selfSignedData common.SignedData, metrics *metrics.PrivdataMetrics,
    config CoordinatorConfig) Coordinator

NewCoordinator creates a new instance of coordinator

type CoordinatorConfig Uses

type CoordinatorConfig struct {
    TransientBlockRetention        uint64
    PullRetryThreshold             time.Duration
    SkipPullingInvalidTransactions bool

type DataStore Uses

type DataStore interface {
    // GetTxPvtRWSetByTxid returns an iterator due to the fact that the txid may have multiple private
    // RWSets persisted from different endorsers (via Gossip)
    GetTxPvtRWSetByTxid(txid string, filter ledger.PvtNsCollFilter) (transientstore.RWSetScanner, error)

    // GetPvtDataByNum returns a slice of the private data from the ledger
    // for given block and based on the filter which indicates a map of
    // collections and namespaces of private data to retrieve
    GetPvtDataByNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)

    // GetConfigHistoryRetriever returns the ConfigHistoryRetriever
    GetConfigHistoryRetriever() (ledger.ConfigHistoryRetriever, error)

    // Get recent block sequence number
    LedgerHeight() (uint64, error)

DataStore defines set of APIs need to get private data from underlined data store

type Dig2PvtRWSetWithConfig Uses

type Dig2PvtRWSetWithConfig map[privdatacommon.DigKey]*util.PrivateRWSetWithConfig


type Fetcher Uses

type Fetcher interface {
    // contains filtered or unexported methods

Fetcher interface which defines API to fetch missing private data elements

type IdentityDeserializerFactory Uses

type IdentityDeserializerFactory interface {
    // GetIdentityDeserializer returns an IdentityDeserializer
    // instance for the specified chain
    GetIdentityDeserializer(chainID string) msp.IdentityDeserializer

IdentityDeserializerFactory is a factory interface to create IdentityDeserializer for given channel

type NoOpReconciler Uses

type NoOpReconciler struct {

NoOpReconciler non functional reconciler to be used in case reconciliation has been disabled

func (*NoOpReconciler) Start Uses

func (*NoOpReconciler) Start()

func (*NoOpReconciler) Stop Uses

func (*NoOpReconciler) Stop()

type PrivateDataRetriever Uses

type PrivateDataRetriever interface {
    // CollectionRWSet returns the bytes of CollectionPvtReadWriteSet for a given txID and collection from the transient store
    CollectionRWSet(dig []*proto.PvtDataDigest, blockNum uint64) (Dig2PvtRWSetWithConfig, bool, error)

PrivateDataRetriever interface which defines API capable of retrieving required private data

type PvtDataDistributor Uses

type PvtDataDistributor interface {
    // Distribute broadcast reliably private data read write set based on policies
    Distribute(txID string, privData *transientstore.TxPvtReadWriteSetWithConfigInfo, blkHt uint64) error

PvtDataDistributor interface to defines API of distributing private data

func NewDistributor Uses

func NewDistributor(chainID string, gossip gossipAdapter, factory CollectionAccessFactory,
    metrics *metrics.PrivdataMetrics, pushAckTimeout time.Duration) PvtDataDistributor

NewDistributor a constructor for private data distributor capable to send private read write sets for underlying collection

type PvtDataReconciler Uses

type PvtDataReconciler interface {
    // Start function start the reconciler based on a scheduler, as was configured in reconciler creation
    // Stop function stops reconciler

Reconciler 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.

type Reconciler Uses

type Reconciler struct {
    // contains filtered or unexported fields

func NewReconciler Uses

func NewReconciler(channel string, metrics *metrics.PrivdataMetrics, c committer.Committer,
    fetcher ReconciliationFetcher, config *ReconcilerConfig) *Reconciler

NewReconciler creates a new instance of reconciler

func (*Reconciler) Start Uses

func (r *Reconciler) Start()

func (*Reconciler) Stop Uses

func (r *Reconciler) Stop()

type ReconcilerConfig Uses

type ReconcilerConfig struct {
    SleepInterval time.Duration
    BatchSize     int
    IsEnabled     bool

ReconcilerConfig holds config flags that are read from core.yaml

func GetReconcilerConfig Uses

func GetReconcilerConfig() *ReconcilerConfig

this func reads reconciler configuration values from core.yaml and returns ReconcilerConfig

type ReconciliationFetcher Uses

type ReconciliationFetcher interface {
    FetchReconciledItems(dig2collectionConfig privdatacommon.Dig2CollectionConfig) (*privdatacommon.FetchedPvtDataContainer, error)

ReconciliationFetcher interface which defines API to fetch private data elements that have to be reconciled

type StorageDataRetriever Uses

type StorageDataRetriever interface {
    // CollectionRWSet retrieves for give digest relevant private data if
    // available otherwise returns nil, bool which is true if data fetched from ledger and false if was fetched from transient store, and an error
    CollectionRWSet(dig []*gossip2.PvtDataDigest, blockNum uint64) (Dig2PvtRWSetWithConfig, bool, error)

StorageDataRetriever defines an API to retrieve private date from the storage

func NewDataRetriever Uses

func NewDataRetriever(store DataStore) StorageDataRetriever

NewDataRetriever constructing function for implementation of the StorageDataRetriever interface

type Support Uses

type Support struct {
    ChainID string

Support encapsulates set of interfaces to aggregate required functionality by single struct

type TransientStore Uses

type TransientStore interface {
    // 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 *transientstore2.TxPvtReadWriteSetWithConfigInfo) error

    // Persist stores the private write set of a transaction in the transient store
    Persist(txid string, blockHeight uint64, privateSimulationResults *rwset.TxPvtReadWriteSet) 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) (transientstore.RWSetScanner, error)

    // PurgeByTxids removes private read-write sets for 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

TransientStore holds private data that the corresponding blocks haven't been committed yet into the ledger



Package privdata imports 39 packages (graph) and is imported by 1 packages. Updated 2019-08-07. Refresh now. Tools for package owners.