63 Star 183 Fork 3

Gitee 极速下载/hyperledger-fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/hyperledger/fabric
克隆/下载
discover.go 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
nirro 提交于 2018-09-13 22:23 . [FAB-11781] enable pvtdata reconciliaition
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package nwo
import (
"encoding/json"
"github.com/hyperledger/fabric/integration/nwo/commands"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
// DiscoveredPeer defines a struct for discovering peers using discovery service.
// each peer in the result will have these fields
type DiscoveredPeer struct {
MSPID string `yaml:"mspid,omitempty"`
Endpoint string `yaml:"endpoint,omitempty"`
Identity string `yaml:"identity,omitempty"`
Chaincodes []string `yaml:"chaincodes,omitempty"`
}
// running discovery service command discover peers against peer using channel name and user as specified in the
// function arguments. return a slice of the discovered peers
func DiscoverPeers(n *Network, p *Peer, user, channelName string) func() []DiscoveredPeer {
return func() []DiscoveredPeer {
peers := commands.Peers{
UserCert: n.PeerUserCert(p, user),
UserKey: n.PeerUserKey(p, user),
MSPID: n.Organization(p.Organization).MSPID,
Server: n.PeerAddress(p, ListenPort),
Channel: channelName,
}
sess, err := n.Discover(peers)
Expect(err).NotTo(HaveOccurred())
Eventually(sess).Should(gexec.Exit(0))
var discovered []DiscoveredPeer
err = json.Unmarshal(sess.Out.Contents(), &discovered)
Expect(err).NotTo(HaveOccurred())
return discovered
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mirrors/hyperledger-fabric.git
git@gitee.com:mirrors/hyperledger-fabric.git
mirrors
hyperledger-fabric
hyperledger-fabric
v1.4.2

搜索帮助