Documentation ¶
Index ¶
- type RateStorage
- func (rs *RateStorage) GetRatesByTimePoint(addrs []ethereum.Address, fromTime, toTime uint64) (map[string]map[string][]common.ReserveRates, error)
- func (rs *RateStorage) LastBlock() (int64, error)
- func (rs *RateStorage) UpdateRatesRecords(blockNumber uint64, rateRecords map[string]map[string]common.ReserveRateEntry) error
- type RateStorageOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateStorage ¶
type RateStorage struct {
// contains filtered or unexported fields
}
RateStorage is the implementation of influxclient to serve as ReserveRate storage
func NewRateInfluxDBStorage ¶
func NewRateInfluxDBStorage( sugar *zap.SugaredLogger, client influxClient.Client, dbName string, blkTimeRsv blockchain.BlockTimeResolverInterface, options ...RateStorageOption, ) (*RateStorage, error)
NewRateInfluxDBStorage return an instance of influx client to store ReserveRate
func (*RateStorage) GetRatesByTimePoint ¶
func (rs *RateStorage) GetRatesByTimePoint(addrs []ethereum.Address, fromTime, toTime uint64) (map[string]map[string][]common.ReserveRates, error)
GetRatesByTimePoint returns all the rate record in a period of time of a reserve
func (*RateStorage) LastBlock ¶
func (rs *RateStorage) LastBlock() (int64, error)
LastBlock returns last stored rate block number from database.
func (*RateStorage) UpdateRatesRecords ¶
func (rs *RateStorage) UpdateRatesRecords(blockNumber uint64, rateRecords map[string]map[string]common.ReserveRateEntry) error
UpdateRatesRecords update all the rate records from different reserve to influxDB in one go. It take a map[reserveAddress] ReserveRates and return error if occurs.
type RateStorageOption ¶
type RateStorageOption func(rs *RateStorage)
RateStorageOption configures the RateStorage constructor behaviour.
func RateStorageOptionWithRetentionPolicy ¶
func RateStorageOptionWithRetentionPolicy(duration, shardDuration time.Duration) RateStorageOption
RateStorageOptionWithRetentionPolicy configures the database with given retention policy.