Documentation ¶
Index ¶
- Constants
- func ConfigEnvelopeFromBlock(block *common.Block) (*common.Envelope, error)
- func ConsensusMetadataFromConfigBlock(block *common.Block) (*etcdraft.Metadata, error)
- func ConsentersToMap(consenters []*etcdraft.Consenter) map[string]struct{}
- func EndpointconfigFromFromSupport(support consensus.ConsenterSupport) (*cluster.EndpointConfig, error)
- func IsMembershipUpdate(block *common.Block, currentMetadata *etcdraft.RaftMetadata) (bool, error)
- func LastConfigBlock(block *common.Block, support consensus.ConsenterSupport) (*common.Block, error)
- func MembershipByCert(consenters map[uint64]*etcdraft.Consenter) map[string]struct{}
- func MetadataFromConfigUpdate(update *common.ConfigUpdate) (*etcdraft.Metadata, error)
- func MetadataFromConfigValue(configValue *common.ConfigValue) (*etcdraft.Metadata, error)
- func RaftPeers(consenters map[uint64]*etcdraft.Consenter) []raft.Peer
- type BlockPuller
- type Chain
- func (c *Chain) Configure(env *common.Envelope, configSeq uint64) error
- func (c *Chain) Errored() <-chan struct{}
- func (c *Chain) Halt()
- func (c *Chain) Order(env *common.Envelope, configSeq uint64) error
- func (c *Chain) Start()
- func (c *Chain) Step(req *orderer.StepRequest, sender uint64) error
- func (c *Chain) Submit(req *orderer.SubmitRequest, sender uint64) error
- func (c *Chain) WaitReady() error
- type ChainGetter
- type Config
- type Configurator
- type Consenter
- type ConsenterCertificate
- type Dispatcher
- type MembershipChanges
- type MemoryStorage
- type MessageReceiver
- type Options
- type RPC
- type RaftStorage
- func (rs *RaftStorage) ApplySnapshot(snap raftpb.Snapshot)
- func (rs *RaftStorage) Close() error
- func (rs *RaftStorage) Snapshot() raftpb.Snapshot
- func (rs *RaftStorage) Store(entries []raftpb.Entry, hardstate raftpb.HardState, snapshot raftpb.Snapshot) error
- func (rs *RaftStorage) TakeSnapshot(i uint64, cs *raftpb.ConfState, data []byte) error
- type ReceiverGetter
Constants ¶
const DefaultSnapshotCatchUpEntries = uint64(500)
DefaultSnapshotChupentries是默认条目数 在拍摄快照时保存在内存中。这是为了 慢追随者赶上。
Variables ¶
This section is empty.
Functions ¶
func ConfigEnvelopeFromBlock ¶
configDevelopeFromBlock基于 配置类型,即headertype_order_transaction或headertype_config
func ConsensusMetadataFromConfigBlock ¶
conensusMetadataFromConfigBlock从配置块读取共识元数据更新
func ConsentersToMap ¶
同意者映射同意者到密钥为客户端TLS证书的集合中
func EndpointconfigFromFromSupport ¶
func EndpointconfigFromFromSupport(support consensus.ConsenterSupport) (*cluster.EndpointConfig, error)
EndpointConfigFromSupport从同意者支持提取TLS CA证书和终结点
func IsMembershipUpdate ¶
每当block为config block并携带时,ismembershipupdate检查 RAFT集群成员更新
func LastConfigBlock ¶
func LastConfigBlock(block *common.Block, support consensus.ConsenterSupport) (*common.Block, error)
last config block返回相对于给定块的最后一个配置块。
func MembershipByCert ¶
membershipbycert将同意者映射转换为由映射封装的集 其中密钥是客户端TLS证书
func MetadataFromConfigUpdate ¶
func MetadataFromConfigUpdate(update *common.ConfigUpdate) (*etcdraft.Metadata, error)
MetadataFromConfigUpdate从配置更新中提取共识元数据
func MetadataFromConfigValue ¶
func MetadataFromConfigValue(configValue *common.ConfigValue) (*etcdraft.Metadata, error)
MetadataFromConfigValue从配置值读取配置更新并将其转换为raft元数据
Types ¶
type BlockPuller ¶
BlockPuller用于从其他OSN中拉出块。
type Chain ¶
type Chain struct { BlockCreator *blockCreator // contains filtered or unexported fields }
链实现共识。链接口。
func NewChain ¶
func NewChain( support consensus.ConsenterSupport, opts Options, conf Configurator, rpc RPC, puller BlockPuller, observeC chan<- uint64) (*Chain, error)
newchain构造一个链对象。
func (*Chain) Step ¶
func (c *Chain) Step(req *orderer.StepRequest, sender uint64) error
step将给定的stepRequest消息传递给raft.node实例
type ChainGetter ¶
type ChainGetter interface { //getchain获取给定通道的链支持。 //当给定通道的链支持时返回nil,false //找不到。 GetChain(chainID string) *multichannel.ChainSupport }
chainegetter获取给定通道的chainSupport实例
type Config ¶
type Config struct { WALDir string //<my channel>的wal数据存储在waldir/<my channel> SnapDir string //<my channel>的快照存储在snapdir/<my channel> }
配置包含ETCDraft配置
type Configurator ¶
type Configurator interface {
Configure(channel string, newNodes []cluster.RemoteNode)
}
配置器用于配置通信层 当链条启动时。
type Consenter ¶
type Consenter struct { Dialer *cluster.PredicateDialer Communication cluster.Communicator *Dispatcher Chains ChainGetter Logger *flogging.FabricLogger EtcdRaftConfig Config OrdererConfig localconfig.TopLevel Cert []byte }
同意人执行ETDDraft同意人
func New ¶
func New(clusterDialer *cluster.PredicateDialer, conf *localconfig.TopLevel, srvConf comm.ServerConfig, srv *comm.GRPCServer, r *multichannel.Registrar) *Consenter
新建一个ETCDraft同意者
func (*Consenter) HandleChain ¶
func (c *Consenter) HandleChain(support consensus.ConsenterSupport, metadata *common.Metadata) (consensus.Chain, error)
handlechain返回新的链实例或失败时出错
func (*Consenter) ReceiverByChain ¶
func (c *Consenter) ReceiverByChain(channelID string) MessageReceiver
ReceiverByChain返回给定channelID或nil的messageReceiver 如果找不到。
type ConsenterCertificate ¶
type ConsenterCertificate []byte
同意证书表示同意人的TLS证书
func (ConsenterCertificate) IsConsenterOfChannel ¶
func (conCert ConsenterCertificate) IsConsenterOfChannel(configBlock *common.Block) error
isconsenterfchannel返回调用方是否同意某个通道 通过检查给定的配置块。 如果为真,则返回零,否则返回错误。
type Dispatcher ¶
type Dispatcher struct { Logger *flogging.FabricLogger ChainSelector ReceiverGetter }
调度程序将提交请求和步骤请求分派给指定的每个链实例
func (*Dispatcher) OnStep ¶
func (d *Dispatcher) OnStep(channel string, sender uint64, request *orderer.StepRequest) (*orderer.StepResponse, error)
onstep通知调度员在给定通道上接收来自给定发送方的step请求。
func (*Dispatcher) OnSubmit ¶
func (d *Dispatcher) OnSubmit(channel string, sender uint64, request *orderer.SubmitRequest) (*orderer.SubmitResponse, error)
OnSubmit通知调度程序在给定通道上接收来自给定发送者的提交请求。
type MembershipChanges ¶
type MembershipChanges struct { AddedNodes []*etcdraft.Consenter RemovedNodes []*etcdraft.Consenter TotalChanges uint32 }
成员身份更改保留有关成员身份的信息 配置更新期间引入的更改
func ComputeMembershipChanges ¶
func ComputeMembershipChanges(oldConsenters map[uint64]*etcdraft.Consenter, newConsenters []*etcdraft.Consenter) *MembershipChanges
ComputemMembershipChanges根据有关新使用者和返回的信息计算成员身份更新 两片:一片添加的同意者和一片要移除的同意者
func (*MembershipChanges) UpdateRaftMetadataAndConfChange ¶
func (mc *MembershipChanges) UpdateRaftMetadataAndConfChange(raftMetadata *etcdraft.RaftMetadata) *raftpb.ConfChange
根据成员资格更改和raftmetadata方法计算更新raftmetadata和confchange 将应用于raft集群配置的更新,以及更新之间的映射 元数据中的同意者及其ID
type MemoryStorage ¶
type MemoryStorage interface { raft.Storage Append(entries []raftpb.Entry) error SetHardState(st raftpb.HardState) error CreateSnapshot(i uint64, cs *raftpb.ConfState, data []byte) (raftpb.Snapshot, error) Compact(compactIndex uint64) error ApplySnapshot(snap raftpb.Snapshot) error }
memoryStorage目前由etcd/raft.memoryStorage支持。这个接口是 定义为公开FSM的依赖项,以便在 未来。todo(jay)在需要时向该接口添加其他必要的方法 它们在实现中,例如applysnapshot。
type MessageReceiver ¶
type MessageReceiver interface { //步骤将给定的步骤请求消息传递给消息接收者 Step(req *orderer.StepRequest, sender uint64) error //Submit将给定的SubmitRequest消息传递给MessageReceiver Submit(req *orderer.SubmitRequest, sender uint64) error }
messagereceiver接收消息
type Options ¶
type Options struct { RaftID uint64 Clock clock.Clock WALDir string SnapDir string SnapInterval uint64 //这主要是为测试目的而配置的。用户不是 //应更改此。而是使用默认快照TChupentries。 SnapshotCatchUpEntries uint64 MemoryStorage MemoryStorage Logger *flogging.FabricLogger TickInterval time.Duration ElectionTick int HeartbeatTick int MaxSizePerMsg uint64 MaxInflightMsgs int RaftMetadata *etcdraft.RaftMetadata }
选项包含与链相关的所有配置。
type RPC ¶
type RPC interface { Step(dest uint64, msg *orderer.StepRequest) (*orderer.StepResponse, error) SendSubmit(dest uint64, request *orderer.SubmitRequest) error }
RPC用于模拟测试中的传输层。
type RaftStorage ¶
type RaftStorage struct { SnapshotCatchUpEntries uint64 // contains filtered or unexported fields }
raftstorage封装了ETCD/raft数据所需的存储,即内存、wal
func CreateStorage ¶
func CreateStorage( lg *flogging.FabricLogger, applied uint64, walDir string, snapDir string, ram MemoryStorage, ) (*RaftStorage, error)
createStorage试图创建一个存储来保存etcd/raft数据。 如果数据出现在指定的磁盘中,则加载它们以重建存储状态。
func (*RaftStorage) ApplySnapshot ¶
func (rs *RaftStorage) ApplySnapshot(snap raftpb.Snapshot)
ApplySnapshot将快照应用于本地内存存储
func (*RaftStorage) Store ¶
func (rs *RaftStorage) Store(entries []raftpb.Entry, hardstate raftpb.HardState, snapshot raftpb.Snapshot) error
保存保存的ETCD/RAFT数据
func (*RaftStorage) TakeSnapshot ¶
takesnapshot从memorystorage在索引I处获取快照,并将其保存到wal和disk。
type ReceiverGetter ¶
type ReceiverGetter interface { //ReceiverByChain返回messageReceiver(如果存在),否则返回nil ReceiverByChain(channelID string) MessageReceiver }
Receivergetter获取给定通道ID的MessageReceiver实例
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
此源码被清华学神尹成大魔王专业翻译分析并修改 尹成QQ77025077 尹成微信18510341407 尹成所在QQ群721929980 尹成邮箱 yinc13@mails.tsinghua.edu.cn 尹成毕业于清华大学,微软区块链领域全球最有价值专家 https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 伪造者生成的代码。
|
此源码被清华学神尹成大魔王专业翻译分析并修改 尹成QQ77025077 尹成微信18510341407 尹成所在QQ群721929980 尹成邮箱 yinc13@mails.tsinghua.edu.cn 尹成毕业于清华大学,微软区块链领域全球最有价值专家 https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 伪造者生成的代码。 |