1 Star 0 Fork 0

妥協/fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
peer.go 6.52 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 commands
type NodeStart struct {
PeerID string
Dir string
}
func (n NodeStart) SessionName() string {
return n.PeerID
}
func (n NodeStart) WorkingDir() string {
return n.Dir
}
func (n NodeStart) Args() []string {
return []string{
"node", "start",
}
}
type ChannelCreate struct {
ChannelID string
Orderer string
File string
OutputBlock string
}
func (c ChannelCreate) SessionName() string {
return "peer-channel-create"
}
func (c ChannelCreate) Args() []string {
return []string{
"channel", "create",
"--channelID", c.ChannelID,
"--orderer", c.Orderer,
"--file", c.File,
"--outputBlock", c.OutputBlock,
}
}
type ChannelJoin struct {
BlockPath string
}
func (c ChannelJoin) SessionName() string {
return "peer-channel-join"
}
func (c ChannelJoin) Args() []string {
return []string{
"channel", "join",
"-b", c.BlockPath,
}
}
type ChannelFetch struct {
ChannelID string
Block string
Orderer string
OutputFile string
}
func (c ChannelFetch) SessionName() string {
return "peer-channel-fetch"
}
func (c ChannelFetch) Args() []string {
args := []string{
"channel", "fetch", c.Block,
}
if c.ChannelID != "" {
args = append(args, "--channelID", c.ChannelID)
}
if c.Orderer != "" {
args = append(args, "--orderer", c.Orderer)
}
if c.OutputFile != "" {
args = append(args, c.OutputFile)
}
return args
}
type ChaincodePackage struct {
Name string
Version string
Path string
Lang string
OutputFile string
}
func (c ChaincodePackage) SessionName() string {
return "peer-chaincode-package"
}
func (c ChaincodePackage) Args() []string {
args := []string{
"chaincode", "package",
"--name", c.Name,
"--version", c.Version,
"--path", c.Path,
c.OutputFile,
}
if c.Lang != "" {
args = append(args, "--lang", c.Lang)
}
return args
}
type ChaincodeInstall struct {
Name string
Version string
Path string
Lang string
PackageFile string
}
func (c ChaincodeInstall) SessionName() string {
return "peer-chaincode-install"
}
func (c ChaincodeInstall) Args() []string {
args := []string{
"chaincode", "install",
}
if c.PackageFile != "" {
args = append(args, c.PackageFile)
}
if c.Name != "" {
args = append(args, "--name", c.Name)
}
if c.Version != "" {
args = append(args, "--version", c.Version)
}
if c.Path != "" {
args = append(args, "--path", c.Path)
}
if c.Lang != "" {
args = append(args, "--lang", c.Lang)
}
return args
}
type ChaincodeInstantiate struct {
ChannelID string
Orderer string
Name string
Version string
Ctor string
Policy string
Lang string
CollectionsConfig string
}
func (c ChaincodeInstantiate) SessionName() string {
return "peer-chaincode-instantiate"
}
func (c ChaincodeInstantiate) Args() []string {
args := []string{
"chaincode", "instantiate",
"--channelID", c.ChannelID,
"--orderer", c.Orderer,
"--name", c.Name,
"--version", c.Version,
"--ctor", c.Ctor,
"--policy", c.Policy,
}
if c.CollectionsConfig != "" {
args = append(args, "--collections-config", c.CollectionsConfig)
}
if c.Lang != "" {
args = append(args, "--lang", c.Lang)
}
return args
}
type ChaincodeListInstalled struct{}
func (c ChaincodeListInstalled) SessionName() string {
return "peer-chaincode-list-installed"
}
func (c ChaincodeListInstalled) Args() []string {
return []string{
"chaincode", "list", "--installed",
}
}
type ChaincodeListInstantiated struct {
ChannelID string
}
func (c ChaincodeListInstantiated) SessionName() string {
return "peer-chaincode-list-instantiated"
}
func (c ChaincodeListInstantiated) Args() []string {
return []string{
"chaincode", "list", "--instantiated",
"--channelID", c.ChannelID,
}
}
type ChaincodeQuery struct {
ChannelID string
Name string
Ctor string
}
func (c ChaincodeQuery) SessionName() string {
return "peer-chaincode-query"
}
func (c ChaincodeQuery) Args() []string {
return []string{
"chaincode", "query",
"--channelID", c.ChannelID,
"--name", c.Name,
"--ctor", c.Ctor,
}
}
type ChaincodeInvoke struct {
ChannelID string
Orderer string
Name string
Ctor string
PeerAddresses []string
WaitForEvent bool
}
func (c ChaincodeInvoke) SessionName() string {
return "peer-chaincode-invoke"
}
func (c ChaincodeInvoke) Args() []string {
args := []string{
"chaincode", "invoke",
"--channelID", c.ChannelID,
"--orderer", c.Orderer,
"--name", c.Name,
"--ctor", c.Ctor,
}
for _, p := range c.PeerAddresses {
args = append(args, "--peerAddresses", p)
}
if c.WaitForEvent {
args = append(args, "--waitForEvent")
}
return args
}
type ChaincodeUpgrade struct {
Name string
Version string
Path string // optional
ChannelID string
Orderer string
Ctor string
Policy string
CollectionsConfig string // optional
}
func (c ChaincodeUpgrade) SessionName() string {
return "peer-chaincode-upgrade"
}
func (c ChaincodeUpgrade) Args() []string {
args := []string{
"chaincode", "upgrade",
"--name", c.Name,
"--version", c.Version,
"--channelID", c.ChannelID,
"--orderer", c.Orderer,
"--ctor", c.Ctor,
"--policy", c.Policy,
}
if c.Path != "" {
args = append(args, "--path", c.Path)
}
if c.CollectionsConfig != "" {
args = append(args, "--collections-config", c.CollectionsConfig)
}
return args
}
type SignConfigTx struct {
File string
}
func (s SignConfigTx) SessionName() string {
return "peer-channel-signconfigtx"
}
func (s SignConfigTx) Args() []string {
return []string{
"channel", "signconfigtx",
"--file", s.File,
}
}
type ChannelUpdate struct {
ChannelID string
Orderer string
File string
}
func (c ChannelUpdate) SessionName() string {
return "peer-channel-update"
}
func (c ChannelUpdate) Args() []string {
return []string{
"channel", "update",
"--channelID", c.ChannelID,
"--orderer", c.Orderer,
"--file", c.File,
}
}
type ChannelInfo struct {
ChannelID string
}
func (c ChannelInfo) SessionName() string {
return "peer-channel-info"
}
func (c ChannelInfo) Args() []string {
return []string{
"channel", "getinfo",
"-c", c.ChannelID,
}
}
type LoggingSetLevel struct {
Logger string
Level string
}
func (l LoggingSetLevel) SessionName() string {
return "peer-logging-setlevel"
}
func (l LoggingSetLevel) Args() []string {
return []string{
"logging", "setlevel", l.Logger, l.Level,
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liurenhao/fabric.git
git@gitee.com:liurenhao/fabric.git
liurenhao
fabric
fabric
v1.4.0

搜索帮助