github.com/lzy4123/fabric@v2.1.1+incompatible/internal/peer/node/resume.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package node 8 9 import ( 10 "github.com/hyperledger/fabric/core/ledger/kvledger" 11 "github.com/hyperledger/fabric/internal/peer/common" 12 "github.com/pkg/errors" 13 "github.com/spf13/cobra" 14 ) 15 16 func resumeCmd() *cobra.Command { 17 resumeChannelCmd.ResetFlags() 18 flags := resumeChannelCmd.Flags() 19 flags.StringVarP(&channelID, "channelID", "c", common.UndefinedParamValue, "Channel to resume.") 20 21 return resumeChannelCmd 22 } 23 24 var resumeChannelCmd = &cobra.Command{ 25 Use: "resume", 26 Short: "Resumes a channel on the peer.", 27 Long: `Resumes a channel on the peer. When the command is executed, the peer must be offline. When the peer starts after resume, it will receive blocks for the resumed channel.`, 28 RunE: func(cmd *cobra.Command, args []string) error { 29 if channelID == common.UndefinedParamValue { 30 return errors.New("Must supply channel ID") 31 } 32 33 config := ledgerConfig() 34 return kvledger.ResumeChannel(config.RootFSPath, channelID) 35 }, 36 }