privdata

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 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 added in v1.4.2

type AppCapabilities interface {
	channelconfig.ApplicationCapabilities
}

appCapabilities local interface used to generate mock for foreign interface.

type CapabilityProvider added in v1.4.3

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 added in v1.2.0

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 added in v1.2.0

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 added in v1.4.1

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 added in v1.3.0

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 added in v1.2.0

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 added in v1.3.0

type NoOpReconciler struct {
}

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

func (*NoOpReconciler) Start added in v1.3.0

func (*NoOpReconciler) Start()

func (*NoOpReconciler) Stop added in v1.3.0

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 added in v1.4.0

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 added in v1.3.0

type Reconciler struct {
	ReconcileSleepInterval time.Duration
	ReconcileBatchSize     int

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

func NewReconciler added in v1.3.0

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 added in v1.3.0

func (r *Reconciler) Start()

func (*Reconciler) Stop added in v1.3.0

func (r *Reconciler) Stop()

type ReconciliationFetcher added in v1.3.0

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