privdata

package
v0.0.0-...-35b2663 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPuller

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

Types

type AppCapabilities

type AppCapabilities interface {
	channelconfig.ApplicationCapabilities
}

appCapabilities local interface used to generate mock for foreign interface.

type CapabilityProvider

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

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

func NewCollectionAccessFactory(factory IdentityDeserializerFactory) CollectionAccessFactory

NewCollectionAccessFactory

type CollectionStore

type CollectionStore interface {
	privdata.CollectionStore
}

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

type Committer

type Committer interface {
	committer.Committer
}

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

type ConfigHistoryRetriever

type ConfigHistoryRetriever interface {
	ledger.ConfigHistoryRetriever
}

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

type Coordinator

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

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

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

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

Dig2PvtRWSetWithConfig

type Fetcher

type Fetcher interface {
	// contains filtered or unexported methods
}

Fetcher interface which defines API to fetch missing private data elements

type IdentityDeserializerFactory

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

type IdentityDeserializerFactoryFunc func(chainID string) msp.IdentityDeserializer

IdentityDeserializerFactoryFunc is a function adapter for IdentityDeserializerFactory.

func (IdentityDeserializerFactoryFunc) GetIdentityDeserializer

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

type MissingPvtDataTracker

type MissingPvtDataTracker interface {
	ledger.MissingPvtDataTracker
}

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

type NoOpReconciler

type NoOpReconciler struct {
}

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

func (*NoOpReconciler) Start

func (*NoOpReconciler) Start()

func (*NoOpReconciler) Stop

func (*NoOpReconciler) Stop()

type PrivateDataRetriever

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

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

func GlobalConfig() *PrivdataConfig

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

type PvtDataDistributor

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

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

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

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

func (*PvtdataProvider) RetrievePvtdata

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

type RWSetScanner interface {
	transientstore.RWSetScanner
}

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

type Reconciler

type Reconciler struct {
	ReconcileSleepInterval time.Duration
	ReconcileBatchSize     int

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

func NewReconciler

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

func (r *Reconciler) Start()

func (*Reconciler) Stop

func (r *Reconciler) Stop()

type ReconciliationFetcher

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

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

func (*RetrievedPvtdata) GetBlockPvtdata

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

GetBlockPvtdata returns the BlockPvtdata

func (*RetrievedPvtdata) Purge

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

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

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

NewDataRetriever constructing function for implementation of the StorageDataRetriever interface

type Support

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

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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