Documentation ¶
Index ¶
- func CcCalls(ccNames ...string) []*discovery.ChaincodeCall
- func CcInterests(invocationsChains ...[]*discovery.ChaincodeCall) []*discovery.ChaincodeInterest
- func GetProperties(endpoint *discclient.Peer) fab.Properties
- func NewIndifferentFilter() discclient.Filter
- type Client
- type MockDiscoverEndpointResponse
- type MockDiscoveryClient
- type MockResponseBuilder
- type Request
- func (req *Request) AddConfigQuery() *Request
- func (req *Request) AddEndorsersQuery(interests ...*discovery.ChaincodeInterest) (*Request, error)
- func (req *Request) AddLocalPeersQuery() *Request
- func (req *Request) AddPeersQuery(invocationChain ...*discovery.ChaincodeCall) *Request
- func (req *Request) OfChannel(ch string) *Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CcCalls ¶
func CcCalls(ccNames ...string) []*discovery.ChaincodeCall
CcCalls creates an array of ChaincodeCalls based of cc names, can be used in AddPeersQuery(CcCalls(...))
func CcInterests ¶
func CcInterests(invocationsChains ...[]*discovery.ChaincodeCall) []*discovery.ChaincodeInterest
CcInterests creates an array of ChaincodeInterests based of ChaincodeCalls, can be used in AddEndorsersQuery(CcInterests(CcCalls(...)))
func GetProperties ¶
func GetProperties(endpoint *discclient.Peer) fab.Properties
GetProperties extracts the properties from the discovered peer.
func NewIndifferentFilter ¶
func NewIndifferentFilter() discclient.Filter
NewIndifferentFilter returns NoPriorities/NoExclusion filter. Note: this method was added just to allow users of Client to be able to use Endorsers method in response, which requires Filter as an argument. It's impossible to implement interface because Filter is placed under internal dir which is not available to end user. A user should filter peers by himself.
Types ¶
type Client ¶
type Client interface {
Send(ctx context.Context, req *Request, targets ...fab.PeerConfig) (<-chan Response, error)
}
Client gives ability to send discovery request to multiple targets. There are cases when multiple targets requested and some of them are hanging, recommended to cancel ctx after first successful response. Note: "access denied" is a success response, so check for it after response evaluation.
type MockDiscoverEndpointResponse ¶
type MockDiscoverEndpointResponse struct { Target string PeerEndpoints []*mocks.MockDiscoveryPeerEndpoint Error error EndorsersErr error }
MockDiscoverEndpointResponse contains a mock response for the discover client
func (*MockDiscoverEndpointResponse) Build ¶
func (b *MockDiscoverEndpointResponse) Build() Response
Build builds a mock discovery response
type MockDiscoveryClient ¶
type MockDiscoveryClient struct {
// contains filtered or unexported fields
}
MockDiscoveryClient implements a mock Discover service
func NewMockDiscoveryClient ¶
func NewMockDiscoveryClient() *MockDiscoveryClient
NewMockDiscoveryClient returns a new mock Discover service
func (*MockDiscoveryClient) Send ¶
func (m *MockDiscoveryClient) Send(ctx context.Context, req *Request, targets ...fab.PeerConfig) (<-chan Response, error)
Send sends a Discovery request
func (*MockDiscoveryClient) SetResponses ¶
func (m *MockDiscoveryClient) SetResponses(responses ...MockResponseBuilder)
SetResponses sets the responses that the mock client should return from the Send function
type MockResponseBuilder ¶
type MockResponseBuilder interface {
Build() Response
}
MockResponseBuilder builds a mock discovery response
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request aggregates several queries inside it
func (*Request) AddConfigQuery ¶
AddConfigQuery adds to the request a config query
func (*Request) AddEndorsersQuery ¶
func (req *Request) AddEndorsersQuery(interests ...*discovery.ChaincodeInterest) (*Request, error)
AddEndorsersQuery adds to the request a query for given chaincodes interests are the chaincode interests that the client wants to query for. All interests for a given channel should be supplied in an aggregated slice
func (*Request) AddLocalPeersQuery ¶
AddLocalPeersQuery adds to the request a local peer query
func (*Request) AddPeersQuery ¶
func (req *Request) AddPeersQuery(invocationChain ...*discovery.ChaincodeCall) *Request
AddPeersQuery adds to the request a peer query