influx

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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