github.com/osdi23p228/fabric@v0.0.0-20221218062954-77808885f5db/orderer/consensus/follower/follower_chain.go (about) 1 /* 2 Copyright IBM Corp. 2017 All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package follower 8 9 import ( 10 "github.com/hyperledger/fabric-protos-go/common" 11 "github.com/osdi23p228/fabric/orderer/common/types" 12 ) 13 14 //TODO skeleton 15 16 // Chain implements a component that allows the orderer to follow a specific channel when is not a cluster member, 17 // that is, be a "follower" of the cluster. This means that the current orderer is not a member of the consenters set 18 // of the channel, and is only pulling blocks from other orderers. 19 // 20 // The follower is inspecting config blocks as they are pulled and if it discovers that it was introduced into the 21 // consenters set, it will trigger the creation of a regular etcdraft.Chain, that is, turn into a "member" of the 22 // cluster. 23 // 24 // The follower is started in one of two ways: 1) following an API Join request with a join-block that does not include 25 // the orderer in its conseters set, or 2) when the orderer was a cluster member and was removed from the consenters 26 // set. 27 // 28 // The follower is in status "onboarding" when it pulls blocks below the join-block number, or "active" when it 29 // pulls blocks equal or above the join-block number. 30 type Chain struct { 31 Err error 32 //TODO skeleton 33 } 34 35 func (c *Chain) Order(_ *common.Envelope, _ uint64) error { 36 return c.Err 37 } 38 39 func (c *Chain) Configure(_ *common.Envelope, _ uint64) error { 40 return c.Err 41 } 42 43 func (c *Chain) WaitReady() error { 44 return c.Err 45 } 46 47 func (*Chain) Errored() <-chan struct{} { 48 closedChannel := make(chan struct{}) 49 close(closedChannel) 50 return closedChannel 51 } 52 53 func (c *Chain) Start() { 54 //TODO skeleton 55 } 56 57 func (c *Chain) Halt() { 58 //TODO skeleton 59 } 60 61 // StatusReport returns the ClusterRelation & Status 62 func (c *Chain) StatusReport() (types.ClusterRelation, types.Status) { 63 status := types.StatusActive 64 //TODO if (height is >= join-block.height) return "active"; else return "onboarding" 65 return types.ClusterRelationFollower, status 66 }