privdata

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2018 License: Apache-2.0 Imports: 32 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, channel string) *puller

NewPuller creates new private data puller

Types

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 *rwset.TxPvtReadWriteSet) 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)

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

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

type Fetcher

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

Fetcher interface which defines API to fetch missing private data elements

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) []util.PrivateRWSet
}

PrivateDataRetriever interfacce 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 *rwset.TxPvtReadWriteSet, cs privdata.CollectionStore) error
}

PvtDataDistributor interface to defines API of distributing private data

func NewDistributor

func NewDistributor(chainID string, gossip gossipAdapter) PvtDataDistributor

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

type StorageDataRetriever

type StorageDataRetriever interface {
	// CollectionRWSet retrieves for give digest relevant private data if
	// available otherwise returns nil
	CollectionRWSet(dig *gossip2.PvtDataDigest) []util.PrivateRWSet
}

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 {
	// 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

Jump to

Keyboard shortcuts

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