mocks

package
v0.1.1 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: 42 Imported by: 0

Documentation

Overview

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCollDataReqMsg

func NewCollDataReqMsg(channelID string, reqID uint64, keys ...*store.Key) *protoext.SignedGossipMessage

NewCollDataReqMsg returns a mock collection data request message

func NewCollDataReqMsgWithDigests added in v0.1.1

func NewCollDataReqMsgWithDigests(channelID string, reqID uint64, digests ...*gproto.CollDataDigest) *protoext.SignedGossipMessage

NewCollDataReqMsgWithDigests returns a mock collection data request message

func NewCollDataResMsg

func NewCollDataResMsg(channelID string, reqID uint64, keyVals ...*KeyVal) *protoext.SignedGossipMessage

NewCollDataResMsg returns a mock collection data response message

func NewDataMsg

func NewDataMsg(channelID string) *protoext.SignedGossipMessage

NewDataMsg returns a mock data message

func NewMember

func NewMember(endpoint string, pkiID []byte, roles ...string) discovery.NetworkMember

NewMember creates a new network member

Types

type BlockBuilder

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

BlockBuilder builds a mock Block

func NewBlockBuilder

func NewBlockBuilder(channelID string, blockNum uint64) *BlockBuilder

NewBlockBuilder returns a new mock BlockBuilder

func (*BlockBuilder) Build

func (b *BlockBuilder) Build() *cb.Block

Build builds the block

func (*BlockBuilder) ConfigUpdate

func (b *BlockBuilder) ConfigUpdate() *ConfigUpdateBuilder

ConfigUpdate adds a config update

func (*BlockBuilder) Transaction

func (b *BlockBuilder) Transaction(txID string, validationCode pb.TxValidationCode) *TxBuilder

Transaction adds a new transaction

type ChaincodeActionBuilder

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

ChaincodeActionBuilder builds a mock Chaincode Action

func NewChaincodeActionBuilder

func NewChaincodeActionBuilder(ccID, txID string) *ChaincodeActionBuilder

NewChaincodeActionBuilder returns a new ChaincodeActionBuilder

func (*ChaincodeActionBuilder) Build

func (b *ChaincodeActionBuilder) Build() []byte

Build builds the chaincode action

func (*ChaincodeActionBuilder) ChaincodeEvent

func (b *ChaincodeActionBuilder) ChaincodeEvent(eventName string, payload []byte) *ChaincodeActionBuilder

ChaincodeEvent adds a chaincode event to the chaincode action

func (*ChaincodeActionBuilder) Collection

Collection starts a new collection read/write set

func (*ChaincodeActionBuilder) Delete

Delete adds a KV write (with delete=true) to the read/write set

func (*ChaincodeActionBuilder) Read

Read adds a KV read to the read/write set

func (*ChaincodeActionBuilder) Response

func (b *ChaincodeActionBuilder) Response(response *pb.Response) *ChaincodeActionBuilder

Response sets the chaincode response

func (*ChaincodeActionBuilder) Write

func (b *ChaincodeActionBuilder) Write(key string, value []byte) *ChaincodeActionBuilder

Write adds a KV write to the read/write set

type CollectionBuilder

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

CollectionBuilder is a utility that builds a CollectionConfig and private data read/write sets for unit testing

func NewPvtReadWriteSetCollectionBuilder

func NewPvtReadWriteSetCollectionBuilder(name string) *CollectionBuilder

NewPvtReadWriteSetCollectionBuilder returns a new private read-write set collection builder

func (*CollectionBuilder) Build

Build builds the collection private read-write set

func (*CollectionBuilder) DCASConfig

func (c *CollectionBuilder) DCASConfig(policy string, requiredPeerCount, maximumPeerCount int32, ttl string) *CollectionBuilder

DCASConfig sets the DCAS collection config

func (*CollectionBuilder) Delete

func (c *CollectionBuilder) Delete(key string) *CollectionBuilder

Delete adds a new write with 'IsDelete=true' to the collection

func (*CollectionBuilder) OffLedgerConfig

func (c *CollectionBuilder) OffLedgerConfig(policy string, requiredPeerCount, maximumPeerCount int32, ttl string) *CollectionBuilder

OffLedgerConfig sets the off-ledger collection config

func (*CollectionBuilder) Read

func (c *CollectionBuilder) Read(key string, blockNum uint64, txIdx uint64) *CollectionBuilder

Read adds a new read to the collection

func (*CollectionBuilder) StaticConfig

func (c *CollectionBuilder) StaticConfig(policy string, requiredPeerCount, maximumPeerCount int32, btl uint64) *CollectionBuilder

StaticConfig sets the static collection config

func (*CollectionBuilder) TransientConfig

func (c *CollectionBuilder) TransientConfig(policy string, requiredPeerCount, maximumPeerCount int32, ttl string) *CollectionBuilder

TransientConfig sets the transient collection config

func (*CollectionBuilder) WithMarshalError

func (c *CollectionBuilder) WithMarshalError() *CollectionBuilder

WithMarshalError simulates a marshalling error

func (*CollectionBuilder) Write

func (c *CollectionBuilder) Write(key string, value []byte) *CollectionBuilder

Write adds a new write to the collection

type CollectionConfigProvider added in v0.1.1

type CollectionConfigProvider struct {
	ForChannelStub func(channelID string) support.CollectionConfigRetriever
	// contains filtered or unexported fields
}

func (*CollectionConfigProvider) ForChannel added in v0.1.1

func (*CollectionConfigProvider) ForChannelArgsForCall added in v0.1.1

func (fake *CollectionConfigProvider) ForChannelArgsForCall(i int) string

func (*CollectionConfigProvider) ForChannelCallCount added in v0.1.1

func (fake *CollectionConfigProvider) ForChannelCallCount() int

func (*CollectionConfigProvider) ForChannelReturns added in v0.1.1

func (fake *CollectionConfigProvider) ForChannelReturns(result1 support.CollectionConfigRetriever)

func (*CollectionConfigProvider) ForChannelReturnsOnCall added in v0.1.1

func (fake *CollectionConfigProvider) ForChannelReturnsOnCall(i int, result1 support.CollectionConfigRetriever)

func (*CollectionConfigProvider) Invocations added in v0.1.1

func (fake *CollectionConfigProvider) Invocations() map[string][][]interface{}

type CollectionConfigRetriever added in v0.1.1

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

CollectionConfigRetriever is a mock collection config retriever

func NewCollectionConfigRetriever added in v0.1.1

func NewCollectionConfigRetriever() *CollectionConfigRetriever

NewCollectionConfigRetriever returns a mock collection config retriever

func (*CollectionConfigRetriever) Config added in v0.1.1

Config returns the collection config for the given collection

func (*CollectionConfigRetriever) Policy added in v0.1.1

Policy returns the collection access policy for the given collection

func (*CollectionConfigRetriever) WithCollectionConfig added in v0.1.1

func (s *CollectionConfigRetriever) WithCollectionConfig(collConfig *pb.StaticCollectionConfig) *CollectionConfigRetriever

WithCollectionConfig sets the collection config for the given collection

func (*CollectionConfigRetriever) WithCollectionPolicy added in v0.1.1

WithCollectionPolicy sets the collection access policy for the given collection

func (*CollectionConfigRetriever) WithError added in v0.1.1

WithError injects an error

type ConfigUpdateBuilder

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

ConfigUpdateBuilder builds a mock config update envelope

func NewConfigUpdateBuilder

func NewConfigUpdateBuilder(channelID string) *ConfigUpdateBuilder

NewConfigUpdateBuilder returns a new mock ConfigUpdateBuilder

func (*ConfigUpdateBuilder) Build

func (b *ConfigUpdateBuilder) Build() []byte

Build builds a config update envelope

type DataProvider

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

DataProvider is a mock transient data provider

func NewDataProvider

func NewDataProvider() *DataProvider

NewDataProvider returns a new Data Provider

func (*DataProvider) RetrieverForChannel

func (p *DataProvider) RetrieverForChannel(channel string) storeapi.Retriever

RetrieverForChannel returns the retriever for the given channel

func (*DataProvider) WithData

func (p *DataProvider) WithData(key *storeapi.Key, value *storeapi.ExpiringValue) *DataProvider

WithData sets the data to be returned by the retriever

func (*DataProvider) WithError

func (p *DataProvider) WithError(err error) *DataProvider

WithError sets the error to be returned by the retriever

func (*DataProvider) WithQueryResults

func (p *DataProvider) WithQueryResults(key *storeapi.QueryKey, results []*storeapi.QueryResult) *DataProvider

WithQueryResults sets the mock query results for the given query string

type DataStore

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

DataStore implements a mock data store

func NewDataStore

func NewDataStore() *DataStore

NewDataStore returns a mock transient data store

func (*DataStore) Close

func (m *DataStore) Close()

Close closes the store

func (*DataStore) Data

func (m *DataStore) Data(key *storeapi.Key, value *storeapi.ExpiringValue) *DataStore

Data sets the data for the given key

func (*DataStore) Error

func (m *DataStore) Error(err error) *DataStore

Error sets an err

func (*DataStore) GetData

func (m *DataStore) GetData(key *storeapi.Key) (*storeapi.ExpiringValue, error)

GetData gets the value for the given DCAS item

func (*DataStore) GetDataMultipleKeys

func (m *DataStore) GetDataMultipleKeys(key *storeapi.MultiKey) (storeapi.ExpiringValues, error)

GetDataMultipleKeys gets the values for the multiple DCAS items in a single call

func (*DataStore) GetTransientData

func (m *DataStore) GetTransientData(key *storeapi.Key) (*storeapi.ExpiringValue, error)

GetTransientData gets the value for the given transient data item

func (*DataStore) GetTransientDataMultipleKeys

func (m *DataStore) GetTransientDataMultipleKeys(key *storeapi.MultiKey) (storeapi.ExpiringValues, error)

GetTransientDataMultipleKeys gets the values for the multiple transient data items in a single call

func (*DataStore) Persist

func (m *DataStore) Persist(txid string, privateSimulationResultsWithConfig *proto.TxPvtReadWriteSetWithConfigInfo) error

Persist 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

func (*DataStore) PutData

func (m *DataStore) PutData(config *pb.StaticCollectionConfig, key *storeapi.Key, value *storeapi.ExpiringValue) error

PutData stores the key/value

func (*DataStore) Query

Query executes the given rich query

func (*DataStore) TransientData

func (m *DataStore) TransientData(key *storeapi.Key, value *storeapi.ExpiringValue) *DataStore

TransientData sets the transient data for the given key

func (*DataStore) WithQueryResults added in v0.1.1

func (m *DataStore) WithQueryResults(key *storeapi.QueryKey, results []*storeapi.QueryResult) *DataStore

WithQueryResults sets the mock query results for the given query string

func (*DataStore) WithResultsIteratorError added in v0.1.1

func (m *DataStore) WithResultsIteratorError(err error) *DataStore

WithResultsIteratorError sets an error on the results iterator

type GossipProvider added in v0.1.1

type GossipProvider struct {
	GetGossipServiceStub func() gossipapi.GossipService
	// contains filtered or unexported fields
}

func (*GossipProvider) GetGossipService added in v0.1.1

func (fake *GossipProvider) GetGossipService() gossipapi.GossipService

func (*GossipProvider) GetGossipServiceCallCount added in v0.1.1

func (fake *GossipProvider) GetGossipServiceCallCount() int

func (*GossipProvider) GetGossipServiceReturns added in v0.1.1

func (fake *GossipProvider) GetGossipServiceReturns(result1 gossipapi.GossipService)

func (*GossipProvider) GetGossipServiceReturnsOnCall added in v0.1.1

func (fake *GossipProvider) GetGossipServiceReturnsOnCall(i int, result1 gossipapi.GossipService)

func (*GossipProvider) Invocations added in v0.1.1

func (fake *GossipProvider) Invocations() map[string][][]interface{}

type IdentifierProvider added in v0.1.1

type IdentifierProvider struct {
	GetIdentifierStub func() (string, error)
	// contains filtered or unexported fields
}

func (*IdentifierProvider) GetIdentifier added in v0.1.1

func (fake *IdentifierProvider) GetIdentifier() (string, error)

func (*IdentifierProvider) GetIdentifierCallCount added in v0.1.1

func (fake *IdentifierProvider) GetIdentifierCallCount() int

func (*IdentifierProvider) GetIdentifierReturns added in v0.1.1

func (fake *IdentifierProvider) GetIdentifierReturns(result1 string, result2 error)

func (*IdentifierProvider) GetIdentifierReturnsOnCall added in v0.1.1

func (fake *IdentifierProvider) GetIdentifierReturnsOnCall(i int, result1 string, result2 error)

func (*IdentifierProvider) Invocations added in v0.1.1

func (fake *IdentifierProvider) Invocations() map[string][][]interface{}

type IdentityDeserializer added in v0.1.1

type IdentityDeserializer struct {
	DeserializeIdentityStub func(serializedIdentity []byte) (msp.Identity, error)

	IsWellFormedStub func(identity *mspfabric_protos.SerializedIdentity) error
	// contains filtered or unexported fields
}

func (*IdentityDeserializer) DeserializeIdentity added in v0.1.1

func (fake *IdentityDeserializer) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error)

func (*IdentityDeserializer) DeserializeIdentityArgsForCall added in v0.1.1

func (fake *IdentityDeserializer) DeserializeIdentityArgsForCall(i int) []byte

func (*IdentityDeserializer) DeserializeIdentityCallCount added in v0.1.1

func (fake *IdentityDeserializer) DeserializeIdentityCallCount() int

func (*IdentityDeserializer) DeserializeIdentityReturns added in v0.1.1

func (fake *IdentityDeserializer) DeserializeIdentityReturns(result1 msp.Identity, result2 error)

func (*IdentityDeserializer) DeserializeIdentityReturnsOnCall added in v0.1.1

func (fake *IdentityDeserializer) DeserializeIdentityReturnsOnCall(i int, result1 msp.Identity, result2 error)

func (*IdentityDeserializer) Invocations added in v0.1.1

func (fake *IdentityDeserializer) Invocations() map[string][][]interface{}

func (*IdentityDeserializer) IsWellFormed added in v0.1.1

func (fake *IdentityDeserializer) IsWellFormed(identity *mspfabric_protos.SerializedIdentity) error

func (*IdentityDeserializer) IsWellFormedArgsForCall added in v0.1.1

func (fake *IdentityDeserializer) IsWellFormedArgsForCall(i int) *mspfabric_protos.SerializedIdentity

func (*IdentityDeserializer) IsWellFormedCallCount added in v0.1.1

func (fake *IdentityDeserializer) IsWellFormedCallCount() int

func (*IdentityDeserializer) IsWellFormedReturns added in v0.1.1

func (fake *IdentityDeserializer) IsWellFormedReturns(result1 error)

func (*IdentityDeserializer) IsWellFormedReturnsOnCall added in v0.1.1

func (fake *IdentityDeserializer) IsWellFormedReturnsOnCall(i int, result1 error)

type IdentityDeserializerProvider added in v0.1.1

type IdentityDeserializerProvider struct {
	GetIdentityDeserializerStub func(channelID string) msp.IdentityDeserializer
	// contains filtered or unexported fields
}

func (*IdentityDeserializerProvider) GetIdentityDeserializer added in v0.1.1

func (fake *IdentityDeserializerProvider) GetIdentityDeserializer(channelID string) msp.IdentityDeserializer

func (*IdentityDeserializerProvider) GetIdentityDeserializerArgsForCall added in v0.1.1

func (fake *IdentityDeserializerProvider) GetIdentityDeserializerArgsForCall(i int) string

func (*IdentityDeserializerProvider) GetIdentityDeserializerCallCount added in v0.1.1

func (fake *IdentityDeserializerProvider) GetIdentityDeserializerCallCount() int

func (*IdentityDeserializerProvider) GetIdentityDeserializerReturns added in v0.1.1

func (fake *IdentityDeserializerProvider) GetIdentityDeserializerReturns(result1 msp.IdentityDeserializer)

func (*IdentityDeserializerProvider) GetIdentityDeserializerReturnsOnCall added in v0.1.1

func (fake *IdentityDeserializerProvider) GetIdentityDeserializerReturnsOnCall(i int, result1 msp.IdentityDeserializer)

func (*IdentityDeserializerProvider) Invocations added in v0.1.1

func (fake *IdentityDeserializerProvider) Invocations() map[string][][]interface{}

type IdentityProvider added in v0.1.1

type IdentityProvider struct {
	GetDefaultSigningIdentityStub func() (msp.SigningIdentity, error)
	// contains filtered or unexported fields
}

func (*IdentityProvider) GetDefaultSigningIdentity added in v0.1.1

func (fake *IdentityProvider) GetDefaultSigningIdentity() (msp.SigningIdentity, error)

func (*IdentityProvider) GetDefaultSigningIdentityCallCount added in v0.1.1

func (fake *IdentityProvider) GetDefaultSigningIdentityCallCount() int

func (*IdentityProvider) GetDefaultSigningIdentityReturns added in v0.1.1

func (fake *IdentityProvider) GetDefaultSigningIdentityReturns(result1 msp.SigningIdentity, result2 error)

func (*IdentityProvider) GetDefaultSigningIdentityReturnsOnCall added in v0.1.1

func (fake *IdentityProvider) GetDefaultSigningIdentityReturnsOnCall(i int, result1 msp.SigningIdentity, result2 error)

func (*IdentityProvider) Invocations added in v0.1.1

func (fake *IdentityProvider) Invocations() map[string][][]interface{}

type KVIterator

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

KVIterator is a mock key-value iterator

func NewKVIterator

func NewKVIterator(kvs []*statedb.VersionedKV) *KVIterator

NewKVIterator returns a mock key-value iterator

func (*KVIterator) Close

func (it *KVIterator) Close()

Close releases resources occupied by the iterator

func (*KVIterator) Next

func (it *KVIterator) Next() (commonledger.QueryResult, error)

Next returns the next item in the result set. The `QueryResult` is expected to be nil when the iterator gets exhausted

func (*KVIterator) WithError

func (it *KVIterator) WithError(err error) *KVIterator

WithError injects an error

type KeyVal

type KeyVal struct {
	*store.Key
	*store.ExpiringValue
}

KeyVal stores a key and a value

func NewKeyValue

func NewKeyValue(key *store.Key, value *store.ExpiringValue) *KeyVal

NewKeyValue creates a new KeyVal

type Ledger

type Ledger struct {
	QueryExecutor  *QueryExecutor
	TxSimulator    *TxSimulator
	BlockchainInfo *common.BlockchainInfo
	Error          error
	BcInfoError    error
}

Ledger is a struct which is used to retrieve data using query

func (*Ledger) CheckpointBlock

func (m *Ledger) CheckpointBlock(block *common.Block) error

CheckpointBlock updates checkpoint info to given block

func (*Ledger) Close

func (m *Ledger) Close()

Close closes the ledger

func (*Ledger) CommitLegacy added in v0.1.1

func (m *Ledger) CommitLegacy(blockAndPvtdata *ledger2.BlockAndPvtData, commitOpts *ledger2.CommitOptions) error

CommitLegacy commits the block and the corresponding pvt data in an atomic operation following the v14 validation/commit path

func (*Ledger) CommitPvtDataOfOldBlocks

func (m *Ledger) CommitPvtDataOfOldBlocks(reconciledPvtdata []*ledger2.ReconciledPvtdata) ([]*ledger2.PvtdataHashMismatch, error)

CommitPvtDataOfOldBlocks commits the private data of old blocks

func (*Ledger) CommitWithPvtData

func (m *Ledger) CommitWithPvtData(blockAndPvtdata *ledger2.BlockAndPvtData) error

CommitWithPvtData commits the private data

func (*Ledger) DoesPvtDataInfoExist added in v0.1.1

func (m *Ledger) DoesPvtDataInfoExist(blockNum uint64) (bool, error)

DoesPvtDataInfoExist returns true when (1) the ledger has pvtdata associated with the given block number (or) (2) a few or all pvtdata associated with the given block number is missing but the

missing info is recorded in the ledger (or)

(3) the block is committed and does not contain any pvtData.

func (*Ledger) GetBlockByHash

func (m *Ledger) GetBlockByHash(blockHash []byte) (*common.Block, error)

GetBlockByHash returns the block by hash

func (*Ledger) GetBlockByNumber

func (m *Ledger) GetBlockByNumber(blockNumber uint64) (*common.Block, error)

GetBlockByNumber returns the block by number

func (*Ledger) GetBlockByTxID

func (m *Ledger) GetBlockByTxID(txID string) (*common.Block, error)

GetBlockByTxID gets the block by transaction id

func (*Ledger) GetBlockchainInfo

func (m *Ledger) GetBlockchainInfo() (*common.BlockchainInfo, error)

GetBlockchainInfo returns the block chain info

func (*Ledger) GetBlocksIterator

func (m *Ledger) GetBlocksIterator(startBlockNumber uint64) (ledger.ResultsIterator, error)

GetBlocksIterator returns the block iterator

func (*Ledger) GetConfigHistoryRetriever

func (m *Ledger) GetConfigHistoryRetriever() (ledger2.ConfigHistoryRetriever, error)

GetConfigHistoryRetriever returns the config history retriever

func (*Ledger) GetMissingPvtDataTracker

func (m *Ledger) GetMissingPvtDataTracker() (ledger2.MissingPvtDataTracker, error)

GetMissingPvtDataTracker returns the private data tracker

func (*Ledger) GetPvtDataAndBlockByNum

func (m *Ledger) GetPvtDataAndBlockByNum(blockNum uint64, filter ledger2.PvtNsCollFilter) (*ledger2.BlockAndPvtData, error)

GetPvtDataAndBlockByNum gets private data and block by block number

func (*Ledger) GetPvtDataByNum

func (m *Ledger) GetPvtDataByNum(blockNum uint64, filter ledger2.PvtNsCollFilter) ([]*ledger2.TxPvtData, error)

GetPvtDataByNum gets private data by number

func (*Ledger) GetTransactionByID

func (m *Ledger) GetTransactionByID(txID string) (*peer.ProcessedTransaction, error)

GetTransactionByID gets the transaction by id

func (*Ledger) GetTxValidationCodeByTxID

func (m *Ledger) GetTxValidationCodeByTxID(txID string) (peer.TxValidationCode, error)

GetTxValidationCodeByTxID gets the validation code

func (*Ledger) NewHistoryQueryExecutor

func (m *Ledger) NewHistoryQueryExecutor() (ledger2.HistoryQueryExecutor, error)

NewHistoryQueryExecutor returns the history query executor

func (*Ledger) NewQueryExecutor

func (m *Ledger) NewQueryExecutor() (ledger2.QueryExecutor, error)

NewQueryExecutor returns the query executor

func (*Ledger) NewTxSimulator

func (m *Ledger) NewTxSimulator(txid string) (ledger2.TxSimulator, error)

NewTxSimulator returns the transaction simulator

type LedgerProvider added in v0.1.1

type LedgerProvider struct {
	GetLedgerStub func(cid string) ledger.PeerLedger
	// contains filtered or unexported fields
}

func (*LedgerProvider) GetLedger added in v0.1.1

func (fake *LedgerProvider) GetLedger(cid string) ledger.PeerLedger

func (*LedgerProvider) GetLedgerArgsForCall added in v0.1.1

func (fake *LedgerProvider) GetLedgerArgsForCall(i int) string

func (*LedgerProvider) GetLedgerCallCount added in v0.1.1

func (fake *LedgerProvider) GetLedgerCallCount() int

func (*LedgerProvider) GetLedgerReturns added in v0.1.1

func (fake *LedgerProvider) GetLedgerReturns(result1 ledger.PeerLedger)

func (*LedgerProvider) GetLedgerReturnsOnCall added in v0.1.1

func (fake *LedgerProvider) GetLedgerReturnsOnCall(i int, result1 ledger.PeerLedger)

func (*LedgerProvider) Invocations added in v0.1.1

func (fake *LedgerProvider) Invocations() map[string][][]interface{}

type MessageHandler

type MessageHandler func(msg *gossipproto.GossipMessage)

MessageHandler defines a function that handles a gossip message.

type MockAccessPolicy

type MockAccessPolicy struct {
	ReqPeerCount int
	MaxPeerCount int
	Orgs         []string
	OnlyRead     bool
	OnlyWrite    bool
	Filter       privdata.Filter
}

MockAccessPolicy implements a mock CollectionAccessPolicy

func (*MockAccessPolicy) AccessFilter

func (m *MockAccessPolicy) AccessFilter() privdata.Filter

AccessFilter returns a member filter function for a collection

func (*MockAccessPolicy) IsMemberOnlyRead

func (m *MockAccessPolicy) IsMemberOnlyRead() bool

IsMemberOnlyRead returns a true if only collection members can read the private data

func (*MockAccessPolicy) IsMemberOnlyWrite

func (m *MockAccessPolicy) IsMemberOnlyWrite() bool

IsMemberOnlyWrite returns a true if only collection members can write the private data

func (*MockAccessPolicy) MaximumPeerCount

func (m *MockAccessPolicy) MaximumPeerCount() int

MaximumPeerCount The maximum number of peers that private data will be sent to upon endorsement. This number has to be bigger than RequiredPeerCount().

func (*MockAccessPolicy) MemberOrgs

func (m *MockAccessPolicy) MemberOrgs() []string

MemberOrgs returns the collection's members as MSP IDs. This serves as a human-readable way of quickly identifying who is part of a collection.

func (*MockAccessPolicy) RequiredPeerCount

func (m *MockAccessPolicy) RequiredPeerCount() int

RequiredPeerCount The minimum number of peers private data will be sent to upon endorsement. The endorsement would fail if dissemination to at least this number of peers is not achieved.

type MockBlockHandler

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

MockBlockHandler is a mock block handler

func NewMockBlockHandler

func NewMockBlockHandler() *MockBlockHandler

NewMockBlockHandler returns a mock Block Handler

func (*MockBlockHandler) HandleChaincodeEvent

func (m *MockBlockHandler) HandleChaincodeEvent(txMetadata api.TxMetadata, event *pb.ChaincodeEvent) error

HandleChaincodeEvent handle a chaincode event by incrementing the CC event counter

func (*MockBlockHandler) HandleChaincodeUpgradeEvent

func (m *MockBlockHandler) HandleChaincodeUpgradeEvent(txMetadata api.TxMetadata, chaincodeName string) error

HandleChaincodeUpgradeEvent handles a chaincode upgrade event by incrementing the chaincode upgrade counter

func (*MockBlockHandler) HandleConfigUpdate

func (m *MockBlockHandler) HandleConfigUpdate(blockNum uint64, configUpdate *cb.ConfigUpdate) error

HandleConfigUpdate handles a config update by incrementing the config update counter

func (*MockBlockHandler) HandleLSCCWrite

func (m *MockBlockHandler) HandleLSCCWrite(txMetadata api.TxMetadata, chaincodeName string, ccData *ccprovider.ChaincodeData, ccp *pb.CollectionConfigPackage) error

HandleLSCCWrite handles an LSCC write by incrementing the LSCC write counter

func (*MockBlockHandler) HandleRead

func (m *MockBlockHandler) HandleRead(txMetadata api.TxMetadata, namespace string, kvRead *kvrwset.KVRead) error

HandleRead handles a read event by incrementing the read counter

func (*MockBlockHandler) HandleWrite

func (m *MockBlockHandler) HandleWrite(txMetadata api.TxMetadata, namespace string, kvWrite *kvrwset.KVWrite) error

HandleWrite handles a write event by incrementing the write counter

func (*MockBlockHandler) NumCCEvents

func (m *MockBlockHandler) NumCCEvents() int

NumCCEvents returns the number of chaincode events handled

func (*MockBlockHandler) NumCCUpgradeEvents

func (m *MockBlockHandler) NumCCUpgradeEvents() int

NumCCUpgradeEvents returns the number of chaincode upgrades handled

func (*MockBlockHandler) NumConfigUpdates

func (m *MockBlockHandler) NumConfigUpdates() int

NumConfigUpdates returns the number of configuration updates handled

func (*MockBlockHandler) NumLSCCWrites

func (m *MockBlockHandler) NumLSCCWrites() int

NumLSCCWrites returns the number of LSCC writes handled

func (*MockBlockHandler) NumReads

func (m *MockBlockHandler) NumReads() int

NumReads returns the number of reads handled

func (*MockBlockHandler) NumWrites

func (m *MockBlockHandler) NumWrites() int

NumWrites returns the number of writes handled

func (*MockBlockHandler) WithError

func (m *MockBlockHandler) WithError(err error) *MockBlockHandler

WithError sets an error

type MockBlockPublisher

type MockBlockPublisher struct {
	HandleUpgrade      gossipapi.ChaincodeUpgradeHandler
	HandleConfigUpdate gossipapi.ConfigUpdateHandler
	HandleWrite        gossipapi.WriteHandler
	HandleRead         gossipapi.ReadHandler
	HandleLSCCWrite    gossipapi.LSCCWriteHandler
	HandleCCEvent      gossipapi.ChaincodeEventHandler
}

MockBlockPublisher is a mock block publisher

func NewBlockPublisher

func NewBlockPublisher() *MockBlockPublisher

NewBlockPublisher returns a mock block publisher

func (*MockBlockPublisher) AddCCEventHandler

func (m *MockBlockPublisher) AddCCEventHandler(handler gossipapi.ChaincodeEventHandler)

AddCCEventHandler adds a chaincode event handler

func (*MockBlockPublisher) AddCCUpgradeHandler

func (m *MockBlockPublisher) AddCCUpgradeHandler(handler gossipapi.ChaincodeUpgradeHandler)

AddCCUpgradeHandler adds a chaincode upgrade handler

func (*MockBlockPublisher) AddConfigUpdateHandler

func (m *MockBlockPublisher) AddConfigUpdateHandler(handler gossipapi.ConfigUpdateHandler)

AddConfigUpdateHandler adds a config update handler

func (*MockBlockPublisher) AddLSCCWriteHandler

func (m *MockBlockPublisher) AddLSCCWriteHandler(handler gossipapi.LSCCWriteHandler)

AddLSCCWriteHandler adds a write handler

func (*MockBlockPublisher) AddReadHandler

func (m *MockBlockPublisher) AddReadHandler(handler gossipapi.ReadHandler)

AddReadHandler adds a read handler

func (*MockBlockPublisher) AddWriteHandler

func (m *MockBlockPublisher) AddWriteHandler(handler gossipapi.WriteHandler)

AddWriteHandler adds a write handler

func (*MockBlockPublisher) LedgerHeight

func (m *MockBlockPublisher) LedgerHeight() uint64

LedgerHeight is not implemented and panics if invoked

func (*MockBlockPublisher) Publish

func (m *MockBlockPublisher) Publish(block *common.Block)

Publish is not implemented and panics if invoked

type MockBlockPublisherProvider

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

MockBlockPublisherProvider is a mock block publisher provider

func NewBlockPublisherProvider

func NewBlockPublisherProvider() *MockBlockPublisherProvider

NewBlockPublisherProvider returns a mock block publisher provider

func (*MockBlockPublisherProvider) ForChannel

func (m *MockBlockPublisherProvider) ForChannel(channelID string) gossipapi.BlockPublisher

ForChannel returns the mock block publisher

func (*MockBlockPublisherProvider) WithBlockPublisher added in v0.1.1

WithBlockPublisher sets the block publisher

type MockGossipAdapter

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

MockGossipAdapter is the gossip adapter

func NewMockGossipAdapter

func NewMockGossipAdapter() *MockGossipAdapter

NewMockGossipAdapter returns the adapter

func (*MockGossipAdapter) Accept added in v0.1.1

func (m *MockGossipAdapter) Accept(acceptor common.MessageAcceptor, passThrough bool) (<-chan *gossipproto.GossipMessage, <-chan protoext.ReceivedMessage)

Accept returns a dedicated read-only channel for messages sent by other nodes that match a certain predicate.

func (*MockGossipAdapter) DistributePrivateData added in v0.1.1

func (m *MockGossipAdapter) DistributePrivateData(chainID string, txID string, privateData *transientstore.TxPvtReadWriteSetWithConfigInfo, blkHt uint64) error

DistributePrivateData distributes private data to the peers in the collections according to policies induced by the PolicyStore and PolicyParser

func (*MockGossipAdapter) Gossip added in v0.1.1

Gossip sends a message to other peers to the network

func (*MockGossipAdapter) IdentityInfo

func (m *MockGossipAdapter) IdentityInfo() gossipapi.PeerIdentitySet

IdentityInfo returns the identitySet of this adapter

func (*MockGossipAdapter) IsInMyOrg added in v0.1.1

func (m *MockGossipAdapter) IsInMyOrg(member discovery.NetworkMember) bool

IsInMyOrg checks whether a network member is in this peer's org

func (*MockGossipAdapter) Member

Member adds the network member

func (*MockGossipAdapter) MemberWithNoPKIID

func (m *MockGossipAdapter) MemberWithNoPKIID(mspID string, member discovery.NetworkMember) *MockGossipAdapter

MemberWithNoPKIID appends the member

func (*MockGossipAdapter) MessageHandler

func (m *MockGossipAdapter) MessageHandler(handler MessageHandler) *MockGossipAdapter

MessageHandler sets the handler

func (*MockGossipAdapter) Peers added in v0.1.1

Peers returns the NetworkMembers considered alive

func (*MockGossipAdapter) PeersOfChannel

PeersOfChannel returns the members

func (*MockGossipAdapter) Self

Self discovers a network member

func (*MockGossipAdapter) SelfChannelInfo added in v0.1.1

SelfChannelInfo returns the peer's latest StateInfo message of a given channel

func (*MockGossipAdapter) SelfMembershipInfo

func (m *MockGossipAdapter) SelfMembershipInfo() discovery.NetworkMember

SelfMembershipInfo returns self

func (*MockGossipAdapter) Send

func (m *MockGossipAdapter) Send(msg *gossipproto.GossipMessage, peers ...*comm.RemotePeer)

Send sends a message to remote peers

func (*MockGossipAdapter) SendByCriteria added in v0.1.1

SendByCriteria sends a given message to all peers that match the given SendCriteria

type MockReceivedMessage

type MockReceivedMessage struct {
	Message   *protoext.SignedGossipMessage
	RespondTo func(msg *gproto.GossipMessage)
	Member    discovery.NetworkMember
}

MockReceivedMessage mocks the Gossip received message

func (*MockReceivedMessage) Ack

func (m *MockReceivedMessage) Ack(err error)

Ack is a noop

func (*MockReceivedMessage) GetConnectionInfo

func (m *MockReceivedMessage) GetConnectionInfo() *protoext.ConnectionInfo

GetConnectionInfo returns the connection information of the source of the message

func (*MockReceivedMessage) GetGossipMessage

func (m *MockReceivedMessage) GetGossipMessage() *protoext.SignedGossipMessage

GetGossipMessage returns the mock signed gossip message

func (*MockReceivedMessage) GetSourceEnvelope

func (m *MockReceivedMessage) GetSourceEnvelope() *gproto.Envelope

GetSourceEnvelope is not implemented

func (*MockReceivedMessage) Respond

func (m *MockReceivedMessage) Respond(msg *gproto.GossipMessage)

Respond responds to the given request

type MockSupport

type MockSupport struct {
	CollPolicy  privdata.CollectionAccessPolicy
	CollConfigs []*pb.StaticCollectionConfig
	Err         error
	Publisher   *MockBlockPublisher
}

MockSupport is a holder of policy, config and error

func NewMockSupport

func NewMockSupport() *MockSupport

NewMockSupport returns a new MockSupport

func (*MockSupport) BlockPublisher

func (s *MockSupport) BlockPublisher(channelID string) gossipapi.BlockPublisher

BlockPublisher returns a mock block publisher for the given channel

func (*MockSupport) CollectionConfig

func (s *MockSupport) CollectionConfig(collConfig *pb.StaticCollectionConfig) *MockSupport

CollectionConfig sets the collection config for the given collection

func (*MockSupport) CollectionPolicy

func (s *MockSupport) CollectionPolicy(collPolicy privdata.CollectionAccessPolicy) *MockSupport

CollectionPolicy sets the collection access policy for the given collection

func (*MockSupport) Config

func (s *MockSupport) Config(channelID, ns, coll string) (*pb.StaticCollectionConfig, error)

Config returns the collection config for the given collection

func (*MockSupport) Policy

func (s *MockSupport) Policy(channelID, ns, coll string) (privdata.CollectionAccessPolicy, error)

Policy returns the collection access policy for the given collection

type NamespaceBuilder

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

NamespaceBuilder is a utility that builds a CollectionPvtReadWriteSet and CollectionConfigPackage for unit testing

func NewNamespaceBuilder

func NewNamespaceBuilder(name string) *NamespaceBuilder

NewNamespaceBuilder returns a new namespace builder

func (*NamespaceBuilder) BuildCollectionConfig

func (b *NamespaceBuilder) BuildCollectionConfig() *peer.CollectionConfigPackage

BuildCollectionConfig builds the collection config package for the namespace

func (*NamespaceBuilder) BuildCollectionHashedRWSets

func (b *NamespaceBuilder) BuildCollectionHashedRWSets() []*rwset.CollectionHashedReadWriteSet

BuildCollectionHashedRWSets builds the collection-hashed read-write sets

func (*NamespaceBuilder) BuildNSReadWriteSets

func (b *NamespaceBuilder) BuildNSReadWriteSets() []byte

BuildNSReadWriteSets builds the read-write sets

func (*NamespaceBuilder) BuildReadWriteSets

func (b *NamespaceBuilder) BuildReadWriteSets() []*rwset.CollectionPvtReadWriteSet

BuildReadWriteSets builds the collection read-write sets for the namespace

func (*NamespaceBuilder) Collection

func (b *NamespaceBuilder) Collection(name string) *CollectionBuilder

Collection adds a new collection

func (*NamespaceBuilder) Delete

func (b *NamespaceBuilder) Delete(key string) *NamespaceBuilder

Delete adds a new write with 'IsDelete=true' to the namespace

func (*NamespaceBuilder) Read

func (b *NamespaceBuilder) Read(key string, blockNum uint64, txIdx uint64) *NamespaceBuilder

Read adds a new read to the namespace

func (*NamespaceBuilder) WithMarshalError

func (b *NamespaceBuilder) WithMarshalError() *NamespaceBuilder

WithMarshalError simulates a marshalling error

func (*NamespaceBuilder) Write

func (b *NamespaceBuilder) Write(key string, value []byte) *NamespaceBuilder

Write adds a new write to the namespace

type NamespaceRWSetBuilder

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

NamespaceRWSetBuilder builds a mock read/write set for a given namespace

func NewNamespaceRWSetBuilder

func NewNamespaceRWSetBuilder(ns string) *NamespaceRWSetBuilder

NewNamespaceRWSetBuilder returns a new namespace read/write set builder

func (*NamespaceRWSetBuilder) Build

Build builds a namespace read/write set

func (*NamespaceRWSetBuilder) Delete

Delete adds a KV write (with delete=true) to the read/write set

func (*NamespaceRWSetBuilder) Read

Read adds a KV read to the read/write set

func (*NamespaceRWSetBuilder) Write

func (b *NamespaceRWSetBuilder) Write(key string, value []byte) *NamespaceRWSetBuilder

Write adds a KV write to the read/write set

type PeerConfig added in v0.1.1

type PeerConfig struct {
	PeerIDStub func() string

	MSPIDStub func() string

	PeerAddressStub func() string

	MSPConfigPathStub func() string

	TLSCertPathStub func() string
	// contains filtered or unexported fields
}

func (*PeerConfig) Invocations added in v0.1.1

func (fake *PeerConfig) Invocations() map[string][][]interface{}

func (*PeerConfig) MSPConfigPath added in v0.1.1

func (fake *PeerConfig) MSPConfigPath() string

func (*PeerConfig) MSPConfigPathCallCount added in v0.1.1

func (fake *PeerConfig) MSPConfigPathCallCount() int

func (*PeerConfig) MSPConfigPathReturns added in v0.1.1

func (fake *PeerConfig) MSPConfigPathReturns(result1 string)

func (*PeerConfig) MSPConfigPathReturnsOnCall added in v0.1.1

func (fake *PeerConfig) MSPConfigPathReturnsOnCall(i int, result1 string)

func (*PeerConfig) MSPID added in v0.1.1

func (fake *PeerConfig) MSPID() string

func (*PeerConfig) MSPIDCallCount added in v0.1.1

func (fake *PeerConfig) MSPIDCallCount() int

func (*PeerConfig) MSPIDReturns added in v0.1.1

func (fake *PeerConfig) MSPIDReturns(result1 string)

func (*PeerConfig) MSPIDReturnsOnCall added in v0.1.1

func (fake *PeerConfig) MSPIDReturnsOnCall(i int, result1 string)

func (*PeerConfig) PeerAddress added in v0.1.1

func (fake *PeerConfig) PeerAddress() string

func (*PeerConfig) PeerAddressCallCount added in v0.1.1

func (fake *PeerConfig) PeerAddressCallCount() int

func (*PeerConfig) PeerAddressReturns added in v0.1.1

func (fake *PeerConfig) PeerAddressReturns(result1 string)

func (*PeerConfig) PeerAddressReturnsOnCall added in v0.1.1

func (fake *PeerConfig) PeerAddressReturnsOnCall(i int, result1 string)

func (*PeerConfig) PeerID added in v0.1.1

func (fake *PeerConfig) PeerID() string

func (*PeerConfig) PeerIDCallCount added in v0.1.1

func (fake *PeerConfig) PeerIDCallCount() int

func (*PeerConfig) PeerIDReturns added in v0.1.1

func (fake *PeerConfig) PeerIDReturns(result1 string)

func (*PeerConfig) PeerIDReturnsOnCall added in v0.1.1

func (fake *PeerConfig) PeerIDReturnsOnCall(i int, result1 string)

func (*PeerConfig) TLSCertPath added in v0.1.1

func (fake *PeerConfig) TLSCertPath() string

func (*PeerConfig) TLSCertPathCallCount added in v0.1.1

func (fake *PeerConfig) TLSCertPathCallCount() int

func (*PeerConfig) TLSCertPathReturns added in v0.1.1

func (fake *PeerConfig) TLSCertPathReturns(result1 string)

func (*PeerConfig) TLSCertPathReturnsOnCall added in v0.1.1

func (fake *PeerConfig) TLSCertPathReturnsOnCall(i int, result1 string)

type PvtReadWriteSetBuilder

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

PvtReadWriteSetBuilder is a utility that builds a TxPvtReadWriteSetWithConfigInfo for unit testing

func NewPvtReadWriteSetBuilder

func NewPvtReadWriteSetBuilder() *PvtReadWriteSetBuilder

NewPvtReadWriteSetBuilder returns a new PvtReadWriteSetBuilder

func (*PvtReadWriteSetBuilder) Build

Build builds a TxPvtReadWriteSetWithConfigInfo

func (*PvtReadWriteSetBuilder) BuildCollectionConfigs

func (b *PvtReadWriteSetBuilder) BuildCollectionConfigs() map[string]*peer.CollectionConfigPackage

BuildCollectionConfigs builds the collection config package

func (*PvtReadWriteSetBuilder) BuildReadWriteSet

func (b *PvtReadWriteSetBuilder) BuildReadWriteSet() *rwset.TxPvtReadWriteSet

BuildReadWriteSet builds the private read-write sets

func (*PvtReadWriteSetBuilder) Namespace

func (b *PvtReadWriteSetBuilder) Namespace(name string) *NamespaceBuilder

Namespace returns a new NamespaceBuilder

type QueryExecutor

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

QueryExecutor is a mock query executor

func NewQueryExecutor

func NewQueryExecutor() *QueryExecutor

NewQueryExecutor returns a new mock query executor

func (*QueryExecutor) Done

func (m *QueryExecutor) Done()

Done does nothing

func (*QueryExecutor) ExecuteQuery

func (m *QueryExecutor) ExecuteQuery(namespace, query string) (commonledger.ResultsIterator, error)

ExecuteQuery returns mock results for the given query

func (*QueryExecutor) ExecuteQueryOnPrivateData

func (m *QueryExecutor) ExecuteQueryOnPrivateData(namespace, collection, query string) (commonledger.ResultsIterator, error)

ExecuteQueryOnPrivateData returns mock results for the given query

func (*QueryExecutor) ExecuteQueryWithMetadata

func (m *QueryExecutor) ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error)

ExecuteQueryWithMetadata is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateData

func (m *QueryExecutor) GetPrivateData(namespace, collection, key string) ([]byte, error)

GetPrivateData returns the private data for the given namespace, collection, and key

func (*QueryExecutor) GetPrivateDataHash

func (m *QueryExecutor) GetPrivateDataHash(namespace, collection, key string) ([]byte, error)

GetPrivateDataHash is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateDataMetadata

func (m *QueryExecutor) GetPrivateDataMetadata(namespace, collection, key string) (map[string][]byte, error)

GetPrivateDataMetadata is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateDataMetadataByHash

func (m *QueryExecutor) GetPrivateDataMetadataByHash(namespace, collection string, keyhash []byte) (map[string][]byte, error)

GetPrivateDataMetadataByHash is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateDataMultipleKeys

func (m *QueryExecutor) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([][]byte, error)

GetPrivateDataMultipleKeys returns the private data for the given namespace, collection, and keys

func (*QueryExecutor) GetPrivateDataRangeScanIterator

func (m *QueryExecutor) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (commonledger.ResultsIterator, error)

GetPrivateDataRangeScanIterator is not currently implemented and will panic if called

func (*QueryExecutor) GetState

func (m *QueryExecutor) GetState(namespace string, key string) ([]byte, error)

GetState returns the mock state for the given namespace and key

func (*QueryExecutor) GetStateMetadata

func (m *QueryExecutor) GetStateMetadata(namespace, key string) (map[string][]byte, error)

GetStateMetadata is not currently implemented and will panic if called

func (*QueryExecutor) GetStateMultipleKeys

func (m *QueryExecutor) GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)

GetStateMultipleKeys returns the mock state for the given namespace and keys

func (*QueryExecutor) GetStateRangeScanIterator

func (m *QueryExecutor) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (commonledger.ResultsIterator, error)

GetStateRangeScanIterator returns an iterator for mock results ranging from startKey (inclusive) to endKey (exclusive)

func (*QueryExecutor) GetStateRangeScanIteratorWithMetadata

func (m *QueryExecutor) GetStateRangeScanIteratorWithMetadata(namespace string, startKey, endKey string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error)

GetStateRangeScanIteratorWithMetadata is not currently implemented and will panic if called

func (*QueryExecutor) WithDeletedPrivateState

func (m *QueryExecutor) WithDeletedPrivateState(ns, collection, key string) *QueryExecutor

WithDeletedPrivateState deletes the state

func (*QueryExecutor) WithDeletedState

func (m *QueryExecutor) WithDeletedState(ns, key string) *QueryExecutor

WithDeletedState deletes the state

func (*QueryExecutor) WithError

func (m *QueryExecutor) WithError(err error) *QueryExecutor

WithError injects an error to the mock executor

func (*QueryExecutor) WithIteratorProvider

func (m *QueryExecutor) WithIteratorProvider(p func() *ResultsIterator) *QueryExecutor

WithIteratorProvider sets the results iterator provider

func (*QueryExecutor) WithPrivateQueryResults

func (m *QueryExecutor) WithPrivateQueryResults(ns, coll, query string, results []*queryresult.KV) *QueryExecutor

WithPrivateQueryResults sets the query results for a given query on a private collection

func (*QueryExecutor) WithPrivateState

func (m *QueryExecutor) WithPrivateState(ns, collection, key string, value []byte) *QueryExecutor

WithPrivateState sets the private state

func (*QueryExecutor) WithQueryError

func (m *QueryExecutor) WithQueryError(err error) *QueryExecutor

WithQueryError injects an error to the mock executor for queries

func (*QueryExecutor) WithQueryResults

func (m *QueryExecutor) WithQueryResults(ns, query string, results []*queryresult.KV) *QueryExecutor

WithQueryResults sets the query results for a given query on a namespace

func (*QueryExecutor) WithState

func (m *QueryExecutor) WithState(ns, key string, value []byte) *QueryExecutor

WithState sets the state

type QueryExecutorProvider

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

QueryExecutorProvider is a mock query executor provider

func NewQueryExecutorProvider

func NewQueryExecutorProvider() *QueryExecutorProvider

NewQueryExecutorProvider returns a mock query executor provider

func (*QueryExecutorProvider) GetQueryExecutorForLedger

func (m *QueryExecutorProvider) GetQueryExecutorForLedger(channelID string) (ledger.QueryExecutor, error)

GetQueryExecutorForLedger returns the query executor for the given channel ID

func (*QueryExecutorProvider) WithError

WithError injects an error into the mock provider

func (*QueryExecutorProvider) WithMockQueryExecutor

func (m *QueryExecutorProvider) WithMockQueryExecutor(qe *QueryExecutor) *QueryExecutorProvider

WithMockQueryExecutor sets the mock query executor

type ReadWriteSetBuilder

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

ReadWriteSetBuilder is a utility that builds a TxReadWriteSet for unit testing

func NewReadWriteSetBuilder

func NewReadWriteSetBuilder() *ReadWriteSetBuilder

NewReadWriteSetBuilder returns a new ReadWriteSetBuilder

func (*ReadWriteSetBuilder) Build

Build builds the read-write sets

func (*ReadWriteSetBuilder) Namespace

func (b *ReadWriteSetBuilder) Namespace(name string) *NamespaceBuilder

Namespace returns a new NamespaceBuilder

type ResultsIterator

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

ResultsIterator is a mock key-value iterator

func NewResultsIterator

func NewResultsIterator() *ResultsIterator

NewResultsIterator returns a mock key-value iterator

func (*ResultsIterator) Close

func (m *ResultsIterator) Close()

Close releases resources occupied by the iterator

func (*ResultsIterator) Next

Next returns the next item in the result set. The `QueryResult` is expected to be nil when the iterator gets exhausted

func (*ResultsIterator) WithError

func (m *ResultsIterator) WithError(err error) *ResultsIterator

WithError injects an error

func (*ResultsIterator) WithResults

func (m *ResultsIterator) WithResults(results []*queryresult.KV) *ResultsIterator

WithResults sets the mock results

type SigningIdentity added in v0.1.1

type SigningIdentity struct {
	ExpiresAtStub func() time.Time

	GetIdentifierStub func() *msp.IdentityIdentifier

	GetMSPIdentifierStub func() string

	ValidateStub func() error

	GetOrganizationalUnitsStub func() []*msp.OUIdentifier

	AnonymousStub func() bool

	VerifyStub func(msg []byte, sig []byte) error

	SerializeStub func() ([]byte, error)

	SatisfiesPrincipalStub func(principal *mspfabric_protos.MSPPrincipal) error

	SignStub func(msg []byte) ([]byte, error)

	GetPublicVersionStub func() msp.Identity
	// contains filtered or unexported fields
}

func (*SigningIdentity) Anonymous added in v0.1.1

func (fake *SigningIdentity) Anonymous() bool

func (*SigningIdentity) AnonymousCallCount added in v0.1.1

func (fake *SigningIdentity) AnonymousCallCount() int

func (*SigningIdentity) AnonymousReturns added in v0.1.1

func (fake *SigningIdentity) AnonymousReturns(result1 bool)

func (*SigningIdentity) AnonymousReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) AnonymousReturnsOnCall(i int, result1 bool)

func (*SigningIdentity) ExpiresAt added in v0.1.1

func (fake *SigningIdentity) ExpiresAt() time.Time

func (*SigningIdentity) ExpiresAtCallCount added in v0.1.1

func (fake *SigningIdentity) ExpiresAtCallCount() int

func (*SigningIdentity) ExpiresAtReturns added in v0.1.1

func (fake *SigningIdentity) ExpiresAtReturns(result1 time.Time)

func (*SigningIdentity) ExpiresAtReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) ExpiresAtReturnsOnCall(i int, result1 time.Time)

func (*SigningIdentity) GetIdentifier added in v0.1.1

func (fake *SigningIdentity) GetIdentifier() *msp.IdentityIdentifier

func (*SigningIdentity) GetIdentifierCallCount added in v0.1.1

func (fake *SigningIdentity) GetIdentifierCallCount() int

func (*SigningIdentity) GetIdentifierReturns added in v0.1.1

func (fake *SigningIdentity) GetIdentifierReturns(result1 *msp.IdentityIdentifier)

func (*SigningIdentity) GetIdentifierReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) GetIdentifierReturnsOnCall(i int, result1 *msp.IdentityIdentifier)

func (*SigningIdentity) GetMSPIdentifier added in v0.1.1

func (fake *SigningIdentity) GetMSPIdentifier() string

func (*SigningIdentity) GetMSPIdentifierCallCount added in v0.1.1

func (fake *SigningIdentity) GetMSPIdentifierCallCount() int

func (*SigningIdentity) GetMSPIdentifierReturns added in v0.1.1

func (fake *SigningIdentity) GetMSPIdentifierReturns(result1 string)

func (*SigningIdentity) GetMSPIdentifierReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) GetMSPIdentifierReturnsOnCall(i int, result1 string)

func (*SigningIdentity) GetOrganizationalUnits added in v0.1.1

func (fake *SigningIdentity) GetOrganizationalUnits() []*msp.OUIdentifier

func (*SigningIdentity) GetOrganizationalUnitsCallCount added in v0.1.1

func (fake *SigningIdentity) GetOrganizationalUnitsCallCount() int

func (*SigningIdentity) GetOrganizationalUnitsReturns added in v0.1.1

func (fake *SigningIdentity) GetOrganizationalUnitsReturns(result1 []*msp.OUIdentifier)

func (*SigningIdentity) GetOrganizationalUnitsReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) GetOrganizationalUnitsReturnsOnCall(i int, result1 []*msp.OUIdentifier)

func (*SigningIdentity) GetPublicVersion added in v0.1.1

func (fake *SigningIdentity) GetPublicVersion() msp.Identity

func (*SigningIdentity) GetPublicVersionCallCount added in v0.1.1

func (fake *SigningIdentity) GetPublicVersionCallCount() int

func (*SigningIdentity) GetPublicVersionReturns added in v0.1.1

func (fake *SigningIdentity) GetPublicVersionReturns(result1 msp.Identity)

func (*SigningIdentity) GetPublicVersionReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) GetPublicVersionReturnsOnCall(i int, result1 msp.Identity)

func (*SigningIdentity) Invocations added in v0.1.1

func (fake *SigningIdentity) Invocations() map[string][][]interface{}

func (*SigningIdentity) SatisfiesPrincipal added in v0.1.1

func (fake *SigningIdentity) SatisfiesPrincipal(principal *mspfabric_protos.MSPPrincipal) error

func (*SigningIdentity) SatisfiesPrincipalArgsForCall added in v0.1.1

func (fake *SigningIdentity) SatisfiesPrincipalArgsForCall(i int) *mspfabric_protos.MSPPrincipal

func (*SigningIdentity) SatisfiesPrincipalCallCount added in v0.1.1

func (fake *SigningIdentity) SatisfiesPrincipalCallCount() int

func (*SigningIdentity) SatisfiesPrincipalReturns added in v0.1.1

func (fake *SigningIdentity) SatisfiesPrincipalReturns(result1 error)

func (*SigningIdentity) SatisfiesPrincipalReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) SatisfiesPrincipalReturnsOnCall(i int, result1 error)

func (*SigningIdentity) Serialize added in v0.1.1

func (fake *SigningIdentity) Serialize() ([]byte, error)

func (*SigningIdentity) SerializeCallCount added in v0.1.1

func (fake *SigningIdentity) SerializeCallCount() int

func (*SigningIdentity) SerializeReturns added in v0.1.1

func (fake *SigningIdentity) SerializeReturns(result1 []byte, result2 error)

func (*SigningIdentity) SerializeReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) SerializeReturnsOnCall(i int, result1 []byte, result2 error)

func (*SigningIdentity) Sign added in v0.1.1

func (fake *SigningIdentity) Sign(msg []byte) ([]byte, error)

func (*SigningIdentity) SignArgsForCall added in v0.1.1

func (fake *SigningIdentity) SignArgsForCall(i int) []byte

func (*SigningIdentity) SignCallCount added in v0.1.1

func (fake *SigningIdentity) SignCallCount() int

func (*SigningIdentity) SignReturns added in v0.1.1

func (fake *SigningIdentity) SignReturns(result1 []byte, result2 error)

func (*SigningIdentity) SignReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) SignReturnsOnCall(i int, result1 []byte, result2 error)

func (*SigningIdentity) Validate added in v0.1.1

func (fake *SigningIdentity) Validate() error

func (*SigningIdentity) ValidateCallCount added in v0.1.1

func (fake *SigningIdentity) ValidateCallCount() int

func (*SigningIdentity) ValidateReturns added in v0.1.1

func (fake *SigningIdentity) ValidateReturns(result1 error)

func (*SigningIdentity) ValidateReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) ValidateReturnsOnCall(i int, result1 error)

func (*SigningIdentity) Verify added in v0.1.1

func (fake *SigningIdentity) Verify(msg []byte, sig []byte) error

func (*SigningIdentity) VerifyArgsForCall added in v0.1.1

func (fake *SigningIdentity) VerifyArgsForCall(i int) ([]byte, []byte)

func (*SigningIdentity) VerifyCallCount added in v0.1.1

func (fake *SigningIdentity) VerifyCallCount() int

func (*SigningIdentity) VerifyReturns added in v0.1.1

func (fake *SigningIdentity) VerifyReturns(result1 error)

func (*SigningIdentity) VerifyReturnsOnCall added in v0.1.1

func (fake *SigningIdentity) VerifyReturnsOnCall(i int, result1 error)

type StoreProvider added in v0.1.1

type StoreProvider struct {
	StoreForChannelStub func(channelID string) storeapi.Store
	// contains filtered or unexported fields
}

func (*StoreProvider) Invocations added in v0.1.1

func (fake *StoreProvider) Invocations() map[string][][]interface{}

func (*StoreProvider) StoreForChannel added in v0.1.1

func (fake *StoreProvider) StoreForChannel(channelID string) storeapi.Store

func (*StoreProvider) StoreForChannelArgsForCall added in v0.1.1

func (fake *StoreProvider) StoreForChannelArgsForCall(i int) string

func (*StoreProvider) StoreForChannelCallCount added in v0.1.1

func (fake *StoreProvider) StoreForChannelCallCount() int

func (*StoreProvider) StoreForChannelReturns added in v0.1.1

func (fake *StoreProvider) StoreForChannelReturns(result1 storeapi.Store)

func (*StoreProvider) StoreForChannelReturnsOnCall added in v0.1.1

func (fake *StoreProvider) StoreForChannelReturnsOnCall(i int, result1 storeapi.Store)

type TxBuilder

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

TxBuilder builds a mock Transaction

func NewTxBuilder

func NewTxBuilder(channelID, txID string, validationCode pb.TxValidationCode) *TxBuilder

NewTxBuilder returns a new mock TxBuilder

func (*TxBuilder) Build

func (b *TxBuilder) Build() ([]byte, pb.TxValidationCode)

Build builds a transaction

func (*TxBuilder) ChaincodeAction

func (b *TxBuilder) ChaincodeAction(ccID string) *ChaincodeActionBuilder

ChaincodeAction adds a chaincode action to the transaction

type TxSimulator

type TxSimulator struct {
	ledgermocks.MockQueryExecutor
	SimulationResults *ledger.TxSimulationResults
	Error             error
	SimError          error
}

TxSimulator implements a mock transaction simulator

func (*TxSimulator) DeletePrivateData

func (m *TxSimulator) DeletePrivateData(namespace, collection, key string) error

DeletePrivateData is not currently implemented and will panic if called

func (*TxSimulator) DeletePrivateDataMetadata

func (m *TxSimulator) DeletePrivateDataMetadata(namespace, collection, key string) error

DeletePrivateDataMetadata is not currently implemented and will panic if called

func (*TxSimulator) DeleteState

func (m *TxSimulator) DeleteState(namespace string, key string) error

DeleteState is not currently implemented and will panic if called

func (*TxSimulator) DeleteStateMetadata

func (m *TxSimulator) DeleteStateMetadata(namespace, key string) error

DeleteStateMetadata is not currently implemented and will panic if called

func (*TxSimulator) ExecuteUpdate

func (m *TxSimulator) ExecuteUpdate(query string) error

ExecuteUpdate is not currently implemented and will panic if called

func (*TxSimulator) GetTxSimulationResults

func (m *TxSimulator) GetTxSimulationResults() (*ledger.TxSimulationResults, error)

GetTxSimulationResults returns the mock simulation results

func (*TxSimulator) SetPrivateData

func (m *TxSimulator) SetPrivateData(namespace, collection, key string, value []byte) error

SetPrivateData is not currently implemented and will panic if called

func (*TxSimulator) SetPrivateDataMetadata

func (m *TxSimulator) SetPrivateDataMetadata(namespace, collection, key string, metadata map[string][]byte) error

SetPrivateDataMetadata is not currently implemented and will panic if called

func (*TxSimulator) SetPrivateDataMultipleKeys

func (m *TxSimulator) SetPrivateDataMultipleKeys(namespace, collection string, kvs map[string][]byte) error

SetPrivateDataMultipleKeys currently does nothing except return the mock error (if any)

func (*TxSimulator) SetState

func (m *TxSimulator) SetState(namespace string, key string, value []byte) error

SetState is not currently implemented and will panic if called

func (*TxSimulator) SetStateMetadata

func (m *TxSimulator) SetStateMetadata(namespace, key string, metadata map[string][]byte) error

SetStateMetadata is not currently implemented and will panic if called

func (*TxSimulator) SetStateMultipleKeys

func (m *TxSimulator) SetStateMultipleKeys(namespace string, kvs map[string][]byte) error

SetStateMultipleKeys is not currently implemented and will panic if called

Jump to

Keyboard shortcuts

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