github.com/aergoio/aergo@v1.3.1/pkg/component/messages.go (about)

     1  /**
     2   *  @file
     3   *  @copyright defined in aergo/LICENSE.txt
     4   */
     5  
     6  package component
     7  
     8  import "time"
     9  
    10  // CompStatReq is an actor message; requesting component's statics
    11  // When a component gets this message, then it collects infos and
    12  // returns CompStatRsp to the requester
    13  type CompStatReq struct {
    14  	SentTime time.Time
    15  }
    16  
    17  // CompStatRsp contains component's internal info, used to help debugging
    18  // - Status is a string representation of a component's status
    19  // - AccProcessedMsg is an accumulated number of message that this component processes
    20  // - MsgQueueLen is an current number of message at this component's mailbox
    21  // - MsgProcessLatency is an estimated latency to process a msg
    22  // - Error is an error msg when a requester fails to get statics
    23  // - Actor is a reserved field to get component's internal debug info
    24  type CompStatRsp struct {
    25  	Status            string      `json:"status"`
    26  	AccProcessedMsg   uint64      `json:"acc_processed_msg"`
    27  	MsgQueueLen       uint64      `json:"msg_queue_len"`
    28  	MsgProcessLatency string      `json:"msg_latency"`
    29  	Error             string      `json:"error"`
    30  	Actor             interface{} `json:"actor"`
    31  }
    32  
    33  // Status represents a component's current running status
    34  type Status = uint32
    35  
    36  const (
    37  	// StartedStatus means a component is working
    38  	StartedStatus Status = 1 + iota
    39  	// StoppingStatus means a component is stopping
    40  	StoppingStatus
    41  	// StoppedStatus means a component is already stopped
    42  	StoppedStatus
    43  	// RestartingStatus means a component is now restarting
    44  	RestartingStatus
    45  )