Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 0cb0cf9

Browse files
committed
[FAB-9241] Import discovery client
This change adds the Fabric discovery client to the pinning scripts. Change-Id: I4ae8367f5fe9446e200238952a5c0ad58d246ffb Signed-off-by: Troy Ronda <troy@troyronda.com>
1 parent 429e1ef commit 0cb0cf9

File tree

13 files changed

+3926
-158
lines changed

13 files changed

+3926
-158
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ FABRIC_DEV_REGISTRY_PRE_CMD ?= docker login -u docker -p docker nexus3.hyperledg
6666
THIRDPARTY_FABRIC_CA_BRANCH ?= master
6767
THIRDPARTY_FABRIC_CA_COMMIT ?= v1.1.0
6868
THIRDPARTY_FABRIC_BRANCH ?= master
69-
THIRDPARTY_FABRIC_COMMIT ?= v1.1.0
69+
THIRDPARTY_FABRIC_COMMIT ?= 30806c107fe89e29d6c80b6244a57477242f241f
7070

7171
# Force removal of images in cleanup (overridable)
7272
FIXTURE_DOCKER_REMOVE_FORCE ?= false
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/*
7+
Notice: This file has been modified for Hyperledger Fabric SDK Go usage.
8+
Please review third_party pinning scripts and patches for more details.
9+
*/
10+
11+
package discovery
12+
13+
import (
14+
"github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/protos/discovery"
15+
"github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/protos/gossip"
16+
"github.com/pkg/errors"
17+
"golang.org/x/net/context"
18+
"google.golang.org/grpc"
19+
)
20+
21+
var (
22+
// ErrNotFound defines an error that means that an element wasn't found
23+
ErrNotFound = errors.New("not found")
24+
)
25+
26+
// Signer signs a message and returns the signature and nil,
27+
// or nil and error on failure
28+
type Signer func(msg []byte) ([]byte, error)
29+
30+
// Dialer connects to the server
31+
type Dialer func() (*grpc.ClientConn, error)
32+
33+
// Client defines the client-side API of the discovery service
34+
type Client interface {
35+
// Send sends the Request and returns the response, or error on failure
36+
Send(context.Context, *Request) (Response, error)
37+
}
38+
39+
// Response aggregates several responses from the discovery service
40+
type Response interface {
41+
// ForChannel returns a ChannelResponse in the context of a given channel
42+
ForChannel(string) ChannelResponse
43+
}
44+
45+
// ChannelResponse aggregates responses for a given channel
46+
type ChannelResponse interface {
47+
// Config returns a response for a config query, or error if something went wrong
48+
Config() (*discovery.ConfigResult, error)
49+
50+
// Peers returns a response for a peer membership query, or error if something went wrong
51+
Peers() ([]*Peer, error)
52+
53+
// Endorsers returns the response for an endorser query for a given
54+
// chaincode in a given channel context, or error if something went wrong.
55+
// The method returns a random set of endorsers, such that signatures from all of them
56+
// combined, satisfy the endorsement policy.
57+
Endorsers(string) (Endorsers, error)
58+
}
59+
60+
// Endorsers defines a set of peers that are sufficient
61+
// for satisfying some chaincode's endorsement policy
62+
type Endorsers []*Peer
63+
64+
// Peer aggregates identity, membership and channel-scoped information
65+
// of a certain peer.
66+
type Peer struct {
67+
MSPID string
68+
AliveMessage *gossip.SignedGossipMessage
69+
StateInfoMessage *gossip.SignedGossipMessage
70+
Identity []byte
71+
}

0 commit comments

Comments
 (0)