mocks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockSelectionService

type MockSelectionService struct {
	Error          error
	Peers          []fab.Peer
	ChannelContext context.Channel
}

MockSelectionService implements mock selection service

func NewMockSelectionService

func NewMockSelectionService(err error, peers ...fab.Peer) *MockSelectionService

NewMockSelectionService returns mock selection service

func (*MockSelectionService) GetEndorsersForChaincode

func (ds *MockSelectionService) GetEndorsersForChaincode(chaincodes []*fab.ChaincodeCall, opts ...options.Opt) ([]fab.Peer, error)

GetEndorsersForChaincode mockcore retrieving endorsing peers

type MockStaticDiscoveryProvider

type MockStaticDiscoveryProvider struct {
	Error error
	Peers []fab.Peer
}

MockStaticDiscoveryProvider implements mock discovery provider

func NewMockDiscoveryProvider

func NewMockDiscoveryProvider(err error, peers []fab.Peer) (*MockStaticDiscoveryProvider, error)

NewMockDiscoveryProvider returns mock discovery provider

func (*MockStaticDiscoveryProvider) CreateLocalDiscoveryService

func (dp *MockStaticDiscoveryProvider) CreateLocalDiscoveryService(mspID string) (fab.DiscoveryService, error)

CreateLocalDiscoveryService return discovery service for specific channel

type MockStaticDiscoveryService

type MockStaticDiscoveryService struct {
	Error error
	Peers []fab.Peer
}

MockStaticDiscoveryService implements mock discovery service

func NewMockDiscoveryService

func NewMockDiscoveryService(err error, peers ...fab.Peer) *MockStaticDiscoveryService

NewMockDiscoveryService returns mock discovery service

func (*MockStaticDiscoveryService) GetPeers

func (ds *MockStaticDiscoveryService) GetPeers() ([]fab.Peer, error)

GetPeers is used to discover eligible peers for chaincode

type MockTransactor

type MockTransactor struct {
	Ctx       context.Client
	ChannelID string
	Orderers  []fab.Orderer
	Err       error
}

MockTransactor provides an implementation of Transactor that exposes all its context.

func (*MockTransactor) CreateTransaction

func (t *MockTransactor) CreateTransaction(request fab.TransactionRequest) (*fab.Transaction, error)

CreateTransaction create a transaction with proposal response.

func (*MockTransactor) CreateTransactionHeader

func (t *MockTransactor) CreateTransactionHeader(opts ...fab.TxnHeaderOpt) (fab.TransactionHeader, error)

CreateTransactionHeader creates a Transaction Header based on the current context.

func (*MockTransactor) SendTransaction

func (t *MockTransactor) SendTransaction(tx *fab.Transaction) (*fab.TransactionResponse, error)

SendTransaction send a transaction to the chain’s orderer service (one or more orderer endpoints) for consensus and committing to the ledger.

func (*MockTransactor) SendTransactionProposal

func (t *MockTransactor) SendTransactionProposal(proposal *fab.TransactionProposal, targets []fab.ProposalProcessor) ([]*fab.TransactionProposalResponse, error)

SendTransactionProposal sends a TransactionProposal to the target peers.

Jump to

Keyboard shortcuts

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