63 Star 183 Fork 3

Gitee 极速下载/hyperledger-fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/hyperledger/fabric
克隆/下载
api.go 2.44 KB
一键复制 编辑 原始数据 按行查看 历史
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package discovery
import (
"github.com/hyperledger/fabric/protos/discovery"
"github.com/hyperledger/fabric/protos/gossip"
"github.com/pkg/errors"
"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)
// 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
// ForLocal returns a LocalResponse in the context of no channel
ForLocal() LocalResponse
}
// 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(invocationChain ...*discovery.ChaincodeCall) ([]*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.
// The selection is based on the given selection hints:
// Filter: Filters and sorts the endorsers
// The given InvocationChain specifies the chaincode calls (along with collections)
// that the client passed during the construction of the request
Endorsers(invocationChain InvocationChain, f Filter) (Endorsers, error)
}
// LocalResponse aggregates responses for a channel-less scope
type LocalResponse interface {
// Peers returns a response for a local peer membership query, or error if something went wrong
Peers() ([]*Peer, 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
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mirrors/hyperledger-fabric.git
git@gitee.com:mirrors/hyperledger-fabric.git
mirrors
hyperledger-fabric
hyperledger-fabric
v1.3.0-rc1

搜索帮助

0d507c66 1850385 C8b1a773 1850385