github.com/true-sqn/fabric@v2.1.1+incompatible/internal/peer/node/pause.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 pauseCmd() *cobra.Command {
    17  	pauseChannelCmd.ResetFlags()
    18  	flags := pauseChannelCmd.Flags()
    19  	flags.StringVarP(&channelID, "channelID", "c", common.UndefinedParamValue, "Channel to pause.")
    20  
    21  	return pauseChannelCmd
    22  }
    23  
    24  var pauseChannelCmd = &cobra.Command{
    25  	Use:   "pause",
    26  	Short: "Pauses a channel on the peer.",
    27  	Long:  `Pauses a channel on the peer. When the command is executed, the peer must be offline. When the peer starts after pause, it will not receive blocks for the paused 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.PauseChannel(config.RootFSPath, channelID)
    35  	},
    36  }