-
Notifications
You must be signed in to change notification settings - Fork 45
/
gaseconomy.go
34 lines (25 loc) · 939 Bytes
/
gaseconomy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package messages
import (
"context"
"go.opencensus.io/tag"
"github.com/filecoin-project/sentinel-visor/metrics"
"github.com/filecoin-project/sentinel-visor/model"
)
type MessageGasEconomy struct {
tableName struct{} `pg:"message_gas_economy"` // nolint: structcheck,unused
Height int64 `pg:",pk,notnull,use_zero"`
StateRoot string `pg:",pk,notnull"`
BaseFee float64 `pg:",use_zero"`
BaseFeeChangeLog float64 `pg:",use_zero"`
GasLimitTotal int64 `pg:",use_zero"`
GasLimitUniqueTotal int64 `pg:",use_zero"`
GasFillRatio float64 `pg:",use_zero"`
GasCapacityRatio float64 `pg:",use_zero"`
GasWasteRatio float64 `pg:",use_zero"`
}
func (g *MessageGasEconomy) Persist(ctx context.Context, s model.StorageBatch) error {
ctx, _ = tag.New(ctx, tag.Upsert(metrics.Table, "message_gas_economy"))
stop := metrics.Timer(ctx, metrics.PersistDuration)
defer stop()
return s.PersistModel(ctx, g)
}