stateapiupdater

package
v2.0.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

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

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

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) Store

func (u *Updater) Store() error

Store the State in the HistoryDB

func (*Updater) UpdateMetrics

func (u *Updater) UpdateMetrics() error

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

func (u *Updater) UpdateNetworkInfoBlock(lastEthBlock, lastSyncBlock common.Block)

UpdateNetworkInfoBlock update Status.Network block related information

func (*Updater) UpdateRecommendedFee

func (u *Updater) UpdateRecommendedFee() error

UpdateRecommendedFee update Status.RecommendedFee information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL