github.com/osdi23p228/fabric@v0.0.0-20221218062954-77808885f5db/orderer/consensus/cluster_status.go (about)

     1  /*
     2  Copyright IBM Corp. 2017 All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package consensus
     8  
     9  import "github.com/osdi23p228/fabric/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.ClusterRelation, types.Status)
    22  }
    23  
    24  // StaticStatusReporter is intended for chains that do not implement the StatusReporter interface.
    25  type StaticStatusReporter struct {
    26  	ClusterRelation types.ClusterRelation
    27  	Status          types.Status
    28  }
    29  
    30  func (s StaticStatusReporter) StatusReport() (types.ClusterRelation, types.Status) {
    31  	return s.ClusterRelation, s.Status
    32  }