代码拉取完成,页面将自动刷新
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package kvledger
import (
"github.com/hyperledger/fabric/common/ledger/util/leveldbhelper"
"github.com/hyperledger/fabric/core/ledger/kvledger/msgs"
"github.com/pkg/errors"
)
// PauseChannel updates the channel status to inactive in ledgerProviders.
func PauseChannel(rootFSPath, ledgerID string) error {
if err := pauseOrResumeChannel(rootFSPath, ledgerID, msgs.Status_INACTIVE); err != nil {
return err
}
logger.Infof("The channel [%s] has been successfully paused", ledgerID)
return nil
}
// ResumeChannel updates the channel status to active in ledgerProviders
func ResumeChannel(rootFSPath, ledgerID string) error {
if err := pauseOrResumeChannel(rootFSPath, ledgerID, msgs.Status_ACTIVE); err != nil {
return err
}
logger.Infof("The channel [%s] has been successfully resumed", ledgerID)
return nil
}
func pauseOrResumeChannel(rootFSPath, ledgerID string, status msgs.Status) error {
fileLock := leveldbhelper.NewFileLock(fileLockPath(rootFSPath))
if err := fileLock.Lock(); err != nil {
return errors.Wrap(err, "as another peer node command is executing,"+
" wait for that command to complete its execution or terminate it before retrying")
}
defer fileLock.Unlock()
idStore, err := openIDStore(LedgerProviderPath(rootFSPath))
if err != nil {
return err
}
defer idStore.db.Close()
return idStore.updateLedgerStatus(ledgerID, status)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。