-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds the Fabric discovery client to the pinning scripts. Change-Id: I4ae8367f5fe9446e200238952a5c0ad58d246ffb Signed-off-by: Troy Ronda <troy@troyronda.com>
- Loading branch information
Showing
13 changed files
with
3,926 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
internal/github.com/hyperledger/fabric/discovery/client/api.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/* | ||
Notice: This file has been modified for Hyperledger Fabric SDK Go usage. | ||
Please review third_party pinning scripts and patches for more details. | ||
*/ | ||
|
||
package discovery | ||
|
||
import ( | ||
"github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/protos/discovery" | ||
"github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/protos/gossip" | ||
"github.com/pkg/errors" | ||
"golang.org/x/net/context" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
var ( | ||
// ErrNotFound defines an error that means that an element wasn't found | ||
ErrNotFound = errors.New("not found") | ||
) | ||
|
||
// Signer signs a message and returns the signature and nil, | ||
// or nil and error on failure | ||
type Signer func(msg []byte) ([]byte, error) | ||
|
||
// Dialer connects to the server | ||
type Dialer func() (*grpc.ClientConn, error) | ||
|
||
// Client defines the client-side API of the discovery service | ||
type Client interface { | ||
// Send sends the Request and returns the response, or error on failure | ||
Send(context.Context, *Request) (Response, error) | ||
} | ||
|
||
// Response aggregates several responses from the discovery service | ||
type Response interface { | ||
// ForChannel returns a ChannelResponse in the context of a given channel | ||
ForChannel(string) ChannelResponse | ||
} | ||
|
||
// ChannelResponse aggregates responses for a given channel | ||
type ChannelResponse interface { | ||
// Config returns a response for a config query, or error if something went wrong | ||
Config() (*discovery.ConfigResult, error) | ||
|
||
// Peers returns a response for a peer membership query, or error if something went wrong | ||
Peers() ([]*Peer, error) | ||
|
||
// Endorsers returns the response for an endorser query for a given | ||
// chaincode in a given channel context, or error if something went wrong. | ||
// The method returns a random set of endorsers, such that signatures from all of them | ||
// combined, satisfy the endorsement policy. | ||
Endorsers(string) (Endorsers, error) | ||
} | ||
|
||
// Endorsers defines a set of peers that are sufficient | ||
// for satisfying some chaincode's endorsement policy | ||
type Endorsers []*Peer | ||
|
||
// Peer aggregates identity, membership and channel-scoped information | ||
// of a certain peer. | ||
type Peer struct { | ||
MSPID string | ||
AliveMessage *gossip.SignedGossipMessage | ||
StateInfoMessage *gossip.SignedGossipMessage | ||
Identity []byte | ||
} |
Oops, something went wrong.