3 Star 6 Fork 7

Gitee 极速下载 / Hyperledger fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/hyperledger/fabric
克隆/下载
msgprocessor.go 2.98 KB
一键复制 编辑 原始数据 按行查看 历史
/*
Copyright IBM Corp. 2017 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Package msgprocessor provides the implementations for processing of the assorted message
// types which may arrive in the system through Broadcast.
package msgprocessor
import (
"errors"
"github.com/hyperledger/fabric/common/flogging"
cb "github.com/hyperledger/fabric/protos/common"
logging "github.com/op/go-logging"
)
const (
pkgLogID = "orderer/common/msgprocessor"
// These should eventually be derived from the channel support once enabled
msgVersion = int32(0)
epoch = 0
)
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
// ErrChannelDoesNotExist is returned by the system channel for transactions which
// are not for the system channel ID and are not attempting to create a new channel
var ErrChannelDoesNotExist = errors.New("channel does not exist")
// ErrPermissionDenied is returned by errors which are caused by transactions
// which are not permitted due to an authorization failure.
var ErrPermissionDenied = errors.New("permission denied")
// Classification represents the possible message types for the system.
type Classification int
const (
// NormalMsg is the class of standard (endorser or otherwise non-config) messages.
// Messages of this type should be processed by ProcessNormalMsg.
NormalMsg Classification = iota
// ConfigUpdateMsg indicates messages of type CONFIG_UPDATE.
// Messages of this type should be processed by ProcessConfigUpdateMsg.
ConfigUpdateMsg
// ConfigMsg indicates message of type ORDERER_TRANSACTION or CONFIG.
// Messages of this type should be processed by ProcessConfigMsg
ConfigMsg
)
// Processor provides the methods necessary to classify and process any message which
// arrives through the Broadcast interface.
type Processor interface {
// ClassifyMsg inspects the message header to determine which type of processing is necessary
ClassifyMsg(chdr *cb.ChannelHeader) Classification
// ProcessNormalMsg will check the validity of a message based on the current configuration. It returns the current
// configuration sequence number and nil on success, or an error if the message is not valid
ProcessNormalMsg(env *cb.Envelope) (configSeq uint64, err error)
// ProcessConfigUpdateMsg will attempt to apply the config update to the current configuration, and if successful
// return the resulting config message and the configSeq the config was computed from. If the config update message
// is invalid, an error is returned.
ProcessConfigUpdateMsg(env *cb.Envelope) (config *cb.Envelope, configSeq uint64, err error)
// ProcessConfigMsg takes message of type `ORDERER_TX` or `CONFIG`, unpack the ConfigUpdate envelope embedded
// in it, and call `ProcessConfigUpdateMsg` to produce new Config message of the same type as original message.
// This method is used to re-validate and reproduce config message, if it's deemed not to be valid anymore.
ProcessConfigMsg(env *cb.Envelope) (*cb.Envelope, uint64, error)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/fabric.git
git@gitee.com:mirrors/fabric.git
mirrors
fabric
Hyperledger fabric
v1.1.0

搜索帮助

344bd9b3 5694891 D2dac590 5694891