Documentation ¶
Index ¶
- Constants
- func FormatBalance(balance *big.Int) float64
- func GetKey(prefix string, moment int64) string
- func GetMetricsServicePort(nodePort string) string
- func UpdateBlockHeight(blockHeight uint64)
- func UpdateBlockReward(blockReward *big.Int)
- func UpdateConnectionsNumber(connectionsNumber int)
- func UpdateIsLeader(isLeader bool)
- func UpdateLastConsensus(consensusTime int64)
- func UpdateNodeBalance(balance *big.Int)
- func UpdateTxPoolSize(txPoolSize uint64)
- type Service
- type Storage
Constants ¶
const ( BalanceScale int = 18 BalancePrecision int = 13 ConnectionsNumberPush int = 0 BlockHeightPush int = 1 NodeBalancePush int = 2 LastConsensusPush int = 3 BlockRewardPush int = 4 TxPoolPush int = 5 IsLeaderPush int = 6 )
Constants for metrics service.
const ( BalancePrefix = "bap" BlockHeightPrefix = "bhp" BlocksPrefix = "bp" BlockRewardPrefix = "brp" ConnectionsNumberPrefix = "cnp" ConsensusTimePrefix = "ltp" IsLeaderPrefix = "ilp" TxPoolPrefix = "tpp" )
Constants for storage.
Variables ¶
This section is empty.
Functions ¶
func FormatBalance ¶
FormatBalance formats big.Int balance with precision.
func GetMetricsServicePort ¶
GetMetricsServicePort returns the port serving metrics service dashboard. This port is metricsServicePortDifference less than the node port.
func UpdateBlockHeight ¶
func UpdateBlockHeight(blockHeight uint64)
UpdateBlockHeight updates block height.
func UpdateBlockReward ¶
UpdateBlockReward updates block reward.
func UpdateConnectionsNumber ¶
func UpdateConnectionsNumber(connectionsNumber int)
UpdateConnectionsNumber updates connections number.
func UpdateIsLeader ¶
func UpdateIsLeader(isLeader bool)
UpdateIsLeader updates if node is a leader.
func UpdateLastConsensus ¶
func UpdateLastConsensus(consensusTime int64)
UpdateLastConsensus updates last consensus time.
func UpdateNodeBalance ¶
UpdateNodeBalance updates node balance.
func UpdateTxPoolSize ¶
func UpdateTxPoolSize(txPoolSize uint64)
UpdateTxPoolSize updates tx pool size.
Types ¶
type Service ¶
type Service struct { BlsPublicKey string IP string Port string PushgatewayIP string PushgatewayPort string // contains filtered or unexported fields }
Service is the struct for metrics service.
func (*Service) NotifyService ¶
NotifyService notify service
func (*Service) PushMetrics ¶
func (s *Service) PushMetrics()
PushMetrics pushes metrics updates to prometheus pushgateway.
func (*Service) SetMessageChan ¶
SetMessageChan sets up message channel to service.
func (*Service) StartService ¶
func (s *Service) StartService()
StartService starts metrics service.
func (*Service) StopService ¶
func (s *Service) StopService()
StopService shutdowns metrics service.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage storage dump the block info into leveldb.
func GetStorageInstance ¶
GetStorageInstance returns attack model by using singleton pattern.
func (*Storage) GetDB ¶
func (storage *Storage) GetDB() *ethdb.LDBDatabase
GetDB returns the LDBDatabase of the storage.