privdata

package
v1.4.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPuller

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

NewPuller creates new private data puller

Types

type CollectionAccessFactory added in v1.2.0

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

func NewCollectionAccessFactory(factory IdentityDeserializerFactory) CollectionAccessFactory

NewCollectionAccessFactory

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 *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
	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, selfSignedData common.SignedData) Coordinator

NewCoordinator creates a new instance of coordinator

type DataStore

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

PrivateDataRetriever interface which defines API capable of retrieving required private data

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) 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()
}

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

type Reconciler struct {
	ReconciliationFetcher
	committer.Committer
	// contains filtered or unexported fields
}

func NewReconciler added in v1.3.0

func NewReconciler(c committer.Committer, fetcher ReconciliationFetcher, config *ReconcilerConfig) *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 ReconcilerConfig added in v1.3.0

type ReconcilerConfig struct {
	IsEnabled bool
	// contains filtered or unexported fields
}

ReconcilerConfig holds config flags that are read from core.yaml

func GetReconcilerConfig added in v1.3.0

func GetReconcilerConfig() *ReconcilerConfig

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

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

StorageDataRetriever defines an API to retrieve private date from the storage

func NewDataRetriever

func NewDataRetriever(store DataStore) StorageDataRetriever

NewDataRetriever constructing function for implementation of the StorageDataRetriever interface

type Support

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

type TransientStore

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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