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

package privdata

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

Index

Package Files

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

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 {
    channelconfig.ApplicationCapabilities
}

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 *peer.CollectionConfig, chainID string) (privdata.CollectionAccessPolicy, error)
}

CollectionAccessFactory an interface to generate collection access policy

func NewCollectionAccessFactory Uses

func NewCollectionAccessFactory(factory IdentityDeserializerFactory) CollectionAccessFactory

NewCollectionAccessFactory

type CollectionStore Uses

type CollectionStore interface {
    privdata.CollectionStore
}

CollectionStore is the local interface used to generate mocks for foreign interface.

type Committer Uses

type Committer interface {
    committer.Committer
}

Committer is the local interface used to generate mocks for foreign interface.

type ConfigHistoryRetriever Uses

type ConfigHistoryRetriever interface {
    ledger.ConfigHistoryRetriever
}

ConfigHistoryRetriever is the local interface used to generate mocks for foreign interface.

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 *protostransientstore.TxPvtReadWriteSetWithConfigInfo, blckHeight uint64) error

    // GetPvtDataAndBlockByNum gets block by number and also returns all related private data
    // that requesting peer is eligible for.
    // The order of private data in slice of PvtDataCollections doesn't imply 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 protoutil.SignedData) (*common.Block, util.PvtDataCollections, error)

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

    // Close coordinator, shuts down coordinator service
    Close()
}

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, store *transientstore.Store, selfSignedData protoutil.SignedData, metrics *metrics.PrivdataMetrics,
    config CoordinatorConfig, idDeserializerFactory IdentityDeserializerFactory) Coordinator

NewCoordinator creates a new instance of coordinator

type CoordinatorConfig Uses

type CoordinatorConfig struct {
    // TransientBlockRetention indicates the number of blocks to retain in the transient store
    // when purging below height on commiting every TransientBlockRetention-th block
    TransientBlockRetention uint64
    // PullRetryThreshold indicates the max duration an attempted fetch from a remote peer will retry
    // for before giving up and leaving the private data as missing
    PullRetryThreshold time.Duration
    // SkipPullingInvalidTransactions if true will skip the fetch from remote peer step for transactions
    // marked as invalid
    SkipPullingInvalidTransactions bool
}

CoordinatorConfig encapsulates the config that is passed to a new coordinator

type Dig2PvtRWSetWithConfig Uses

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

Dig2PvtRWSetWithConfig

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 IdentityDeserializerFactoryFunc Uses

type IdentityDeserializerFactoryFunc func(chainID string) msp.IdentityDeserializer

IdentityDeserializerFactoryFunc is a function adapter for IdentityDeserializerFactory.

func (IdentityDeserializerFactoryFunc) GetIdentityDeserializer Uses

func (i IdentityDeserializerFactoryFunc) GetIdentityDeserializer(chainID string) msp.IdentityDeserializer

type MissingPvtDataTracker Uses

type MissingPvtDataTracker interface {
    ledger.MissingPvtDataTracker
}

MissingPvtDataTracker is the local interface used to generate mocks for foreign interface.

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 []*protosgossip.PvtDataDigest, blockNum uint64) (Dig2PvtRWSetWithConfig, bool, error)
}

PrivateDataRetriever interface which defines API capable of retrieving required private data

type PrivdataConfig Uses

type PrivdataConfig struct {
    // ReconcileSleepInterval determines the time reconciler sleeps from end of an interation until the beginning of the next
    // reconciliation iteration.
    ReconcileSleepInterval time.Duration
    // ReconcileBatchSize determines the maximum batch size of missing private data that will be reconciled in a single iteration.
    ReconcileBatchSize int
    // ReconciliationEnabled is a flag that indicates whether private data reconciliation is enabled or not.
    ReconciliationEnabled bool
}

PrivdataConfig is the struct that defines the Gossip Privdata configurations.

func GlobalConfig Uses

func GlobalConfig() *PrivdataConfig

GlobalConfig obtains a set of configuration from viper, build and returns the config struct.

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
    Start()
    // Stop function stops reconciler
    Stop()
}

PvtDataReconciler 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 PvtdataProvider Uses

type PvtdataProvider struct {
    // contains filtered or unexported fields
}

func (*PvtdataProvider) RetrievePvtdata Uses

func (pdp *PvtdataProvider) RetrievePvtdata(pvtdataToRetrieve []*ledger.TxPvtdataInfo) (*RetrievedPvtdata, error)

RetrievePvtdata is passed a list of private data items from a block, it determines which private data items this peer is eligible for, and then retrieves the private data from local cache, local transient store, or a remote peer.

type RWSetScanner Uses

type RWSetScanner interface {
    transientstore.RWSetScanner
}

RWSetScanner is the local interface used to generate mocks for foreign interface.

type Reconciler Uses

type Reconciler struct {
    ReconcileSleepInterval time.Duration
    ReconcileBatchSize     int

    ReconciliationFetcher
    committer.Committer
    // contains filtered or unexported fields
}

func NewReconciler Uses

func NewReconciler(channel string, metrics *metrics.PrivdataMetrics, c committer.Committer,
    fetcher ReconciliationFetcher, config *PrivdataConfig) *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 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 RetrievedPvtdata Uses

type RetrievedPvtdata struct {
    // contains filtered or unexported fields
}

func (*RetrievedPvtdata) GetBlockPvtdata Uses

func (r *RetrievedPvtdata) GetBlockPvtdata() *ledger.BlockPvtdata

GetBlockPvtdata returns the BlockPvtdata

func (*RetrievedPvtdata) Purge Uses

func (r *RetrievedPvtdata) Purge()

Purge purges private data for transactions in the block from the transient store. Transactions older than the retention period are considered orphaned and also purged.

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 []*protosgossip.PvtDataDigest, blockNum uint64) (Dig2PvtRWSetWithConfig, bool, error)
}

StorageDataRetriever defines an API to retrieve private date from the storage.

func NewDataRetriever Uses

func NewDataRetriever(store *transientstore.Store, committer committer.Committer) StorageDataRetriever

NewDataRetriever constructing function for implementation of the StorageDataRetriever interface

type Support Uses

type Support struct {
    ChainID string
    privdata.CollectionStore
    txvalidator.Validator
    committer.Committer
    Fetcher
    CapabilityProvider
}

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

Directories

PathSynopsis
common
mocksCode generated by counterfeiter.

Package privdata imports 41 packages (graph) and is imported by 2 packages. Updated 2020-02-11. Refresh now. Tools for package owners.