github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/consensus/cluster_status.go (about)

     1  /*
     2  Copyright hechain. 2017 All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package consensus
     8  
     9  import "github.com/hechain20/hechain/orderer/common/types"
    10  
    11  // StatusReporter is implemented by cluster-type Chain implementations.
    12  // It allows the node to report its cluster relation and its status within that relation.
    13  // This information is used to generate the channelparticipation.ChannelInfo in response
    14  // to a "List" request on a particular channel.
    15  //
    16  // Not all chains must implement this, in particular non-cluster-type (solo, kafka) are
    17  // assigned a StaticStatusReporter at construction time.
    18  type StatusReporter interface {
    19  	// StatusReport provides the cluster relation and status.
    20  	// See:  channelparticipation.ChannelInfo for more details.
    21  	StatusReport() (types.ConsensusRelation, types.Status)
    22  }
    23  
    24  // StaticStatusReporter is intended for chains that do not implement the StatusReporter interface.
    25  type StaticStatusReporter struct {
    26  	ConsensusRelation types.ConsensusRelation
    27  	Status            types.Status
    28  }
    29  
    30  func (s StaticStatusReporter) StatusReport() (types.ConsensusRelation, types.Status) {
    31  	return s.ConsensusRelation, s.Status
    32  }