Documentation ¶
Overview ¶
Package stateapiupdater is responsible for generating and storing the object response of the GET /state endpoint exposed through the api package. This object is extensively defined at the OpenAPI spec located at api/swagger.yml.
Deployment considerations: in a setup where multiple processes are used (dedicated api process, separated coord / sync, ...), only one process should care of using this package.
Index ¶
- type RecommendedFeePolicy
- type RecommendedFeePolicyType
- type Updater
- func (u *Updater) SetSCVars(vars *common.SCVariablesPtr)
- func (u *Updater) Store() error
- func (u *Updater) UpdateMetrics() error
- func (u *Updater) UpdateNetworkInfo(lastEthBlock, lastSyncBlock common.Block, lastBatchNum common.BatchNum, ...) error
- func (u *Updater) UpdateNetworkInfoBlock(lastEthBlock, lastSyncBlock common.Block)
- func (u *Updater) UpdateRecommendedFee() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RecommendedFeePolicy ¶
type RecommendedFeePolicy struct { PolicyType RecommendedFeePolicyType `validate:"required"` StaticValue float64 }
RecommendedFeePolicy describes how the recommended fee is calculated
type RecommendedFeePolicyType ¶
type RecommendedFeePolicyType string
RecommendedFeePolicyType describes the different available recommended fee strategies
const ( // RecommendedFeePolicyTypeStatic always give the same StaticValue as recommended fee RecommendedFeePolicyTypeStatic RecommendedFeePolicyType = "Static" // RecommendedFeePolicyTypeAvgLastHour set the recommended fee using the average fee of the last hour RecommendedFeePolicyTypeAvgLastHour RecommendedFeePolicyType = "AvgLastHour" )
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater is an utility object to facilitate updating the StateAPI
func NewUpdater ¶
func NewUpdater(hdb *historydb.HistoryDB, config *historydb.NodeConfig, vars *common.SCVariables, consts *historydb.Constants, rfp *RecommendedFeePolicy) (*Updater, error)
NewUpdater creates a new Updater
func (*Updater) SetSCVars ¶
func (u *Updater) SetSCVars(vars *common.SCVariablesPtr)
SetSCVars sets the smart contract vars (ony updates those that are not nil)
func (*Updater) UpdateMetrics ¶
UpdateMetrics update Status.Metrics information
func (*Updater) UpdateNetworkInfo ¶
func (u *Updater) UpdateNetworkInfo( lastEthBlock, lastSyncBlock common.Block, lastBatchNum common.BatchNum, currentSlot int64, ) error
UpdateNetworkInfo update Status.Network information
func (*Updater) UpdateNetworkInfoBlock ¶
UpdateNetworkInfoBlock update Status.Network block related information
func (*Updater) UpdateRecommendedFee ¶
UpdateRecommendedFee update Status.RecommendedFee information