Back to godoc.org

Package data

v0.1.2
Latest Go to latest

The latest major version is .

Published: Jan 9, 2020 | License: MIT | Module: github.com/KyberNetwork/reserve-data

Index

type Fetcher

type Fetcher interface {
	Run() error
	Stop() error
}

Fetcher is the common interface of a fetcher service.

type GlobalStorage

type GlobalStorage interface {
	GetGoldInfo(version common.Version) (common.GoldData, error)
	CurrentGoldInfoVersion(timepoint uint64) (common.Version, error)

	GetBTCInfo(version common.Version) (common.BTCData, error)
	GetUSDInfo(version common.Version) (common.USDData, error)
	CurrentBTCInfoVersion(timepoint uint64) (common.Version, error)
	CurrentUSDInfoVersion(timepoint uint64) (common.Version, error)

	UpdateFeedConfiguration(string, bool) error
	GetFeedConfiguration() ([]common.FeedConfiguration, error)
	StorePendingFeedSetting(value []byte) error
	ConfirmPendingFeedSetting(value []byte) error
	RejectPendingFeedSetting() error
	GetPendingFeedSetting() (common.MapFeedSetting, error)
	GetFeedSetting() (common.MapFeedSetting, error)

	UpdateFetcherConfiguration(common.FetcherConfiguration) error
	GetAllFetcherConfiguration() (common.FetcherConfiguration, error)
}

GlobalStorage is the interfaces that wraps database operations of real world pricing information of ReserveData.

type ReserveData

type ReserveData struct {
	// contains filtered or unexported fields
}

ReserveData struct for reserve data

func NewReserveData

func NewReserveData(storage Storage,
	fetcher Fetcher, storageControllerRunner datapruner.StorageControllerRunner,
	arch archive.Archive, globalStorage GlobalStorage,
	exchanges []common.Exchange, setting Setting) *ReserveData

NewReserveData initiate a new reserve instance

func (ReserveData) ConfirmPendingFeedSetting

func (rd ReserveData) ConfirmPendingFeedSetting(value []byte) error

func (ReserveData) ControlAuthDataSize

func (rd ReserveData) ControlAuthDataSize() error

ControlAuthDataSize pack old data to file, push to S3 and prune outdated data

func (ReserveData) CurrentAuthDataVersion

func (rd ReserveData) CurrentAuthDataVersion(timepoint uint64) (common.Version, error)

func (ReserveData) CurrentBTCInfoVersion

func (rd ReserveData) CurrentBTCInfoVersion(timepoint uint64) (common.Version, error)

func (ReserveData) CurrentGoldInfoVersion

func (rd ReserveData) CurrentGoldInfoVersion(timepoint uint64) (common.Version, error)

func (ReserveData) CurrentPriceVersion

func (rd ReserveData) CurrentPriceVersion(timepoint uint64) (common.Version, error)

func (ReserveData) CurrentUSDInfoVersion

func (rd ReserveData) CurrentUSDInfoVersion(timepoint uint64) (common.Version, error)

func (ReserveData) GetAllFetcherConfiguration

func (rd ReserveData) GetAllFetcherConfiguration() (common.FetcherConfiguration, error)

GetAllFetcherConfiguration returns current fetcher configuration for all tokens

func (ReserveData) GetAllPrices

func (rd ReserveData) GetAllPrices(timepoint uint64) (common.AllPriceResponse, error)

func (ReserveData) GetAuthData

func (rd ReserveData) GetAuthData(timepoint uint64) (common.AuthDataResponse, error)

func (ReserveData) GetBTCData

func (rd ReserveData) GetBTCData(timestamp uint64) (common.BTCData, error)

func (ReserveData) GetExchangeStatus

func (rd ReserveData) GetExchangeStatus() (common.ExchangesStatus, error)

func (ReserveData) GetFeedConfiguration

func (rd ReserveData) GetFeedConfiguration() ([]common.FeedConfiguration, error)

func (ReserveData) GetFeedSetting

func (rd ReserveData) GetFeedSetting() (common.MapFeedSetting, error)

func (ReserveData) GetGoldData

func (rd ReserveData) GetGoldData(timestamp uint64) (common.GoldData, error)

func (ReserveData) GetNotifications

func (rd ReserveData) GetNotifications() (common.ExchangeNotifications, error)

func (ReserveData) GetOnePrice

func (rd ReserveData) GetOnePrice(pairID common.TokenPairID, timepoint uint64) (common.OnePriceResponse, error)

func (ReserveData) GetPendingActivities

func (rd ReserveData) GetPendingActivities() ([]common.ActivityRecord, error)

func (ReserveData) GetPendingFeedSetting

func (rd ReserveData) GetPendingFeedSetting() (common.MapFeedSetting, error)

func (ReserveData) GetRate

func (rd ReserveData) GetRate(timepoint uint64) (common.AllRateResponse, error)

func (ReserveData) GetRates

func (rd ReserveData) GetRates(fromTime, toTime uint64) ([]common.AllRateResponse, error)

func (ReserveData) GetRecords

func (rd ReserveData) GetRecords(fromTime, toTime uint64) ([]common.ActivityRecord, error)

func (ReserveData) GetTradeHistory

func (rd ReserveData) GetTradeHistory(fromTime, toTime uint64) (common.AllTradeHistory, error)

func (ReserveData) GetUSDData

func (rd ReserveData) GetUSDData(timestamp uint64) (common.USDData, error)

func (ReserveData) RejectPendingFeedSetting

func (rd ReserveData) RejectPendingFeedSetting() error

func (ReserveData) Run

func (rd ReserveData) Run() error

Run run fetcher

func (ReserveData) RunStorageController

func (rd ReserveData) RunStorageController() error

func (ReserveData) Stop

func (rd ReserveData) Stop() error

Stop stop the fetcher

func (ReserveData) StorePendingFeedSetting

func (rd ReserveData) StorePendingFeedSetting(value []byte) error

func (ReserveData) UpdateExchangeNotification

func (rd ReserveData) UpdateExchangeNotification(
	exchange, action, tokenPair string, fromTime, toTime uint64, isWarning bool, msg string) error

func (ReserveData) UpdateExchangeStatus

func (rd ReserveData) UpdateExchangeStatus(exchange string, status bool, timestamp uint64) error

func (ReserveData) UpdateFeedConfiguration

func (rd ReserveData) UpdateFeedConfiguration(name string, enabled bool) error

func (ReserveData) UpdateFetcherConfiguration

func (rd ReserveData) UpdateFetcherConfiguration(query common.FetcherConfiguration) error

UpdateFetcherConfiguration save btc fetcher configuration to db and return new configuration

type Setting

type Setting interface {
	GetInternalTokenByID(tokenID string) (common.Token, error)
	GetExchangeStatus() (common.ExchangesStatus, error)
	UpdateExchangeStatus(data common.ExchangesStatus) error
	UpdateExchangeNotification(exchange, action, tokenPair string, fromTime, toTime uint64, isWarning bool, msg string) error
	GetExchangeNotifications() (common.ExchangeNotifications, error)
}

type Storage

type Storage interface {
	CurrentPriceVersion(timepoint uint64) (common.Version, error)
	GetAllPrices(common.Version) (common.AllPriceEntry, error)
	GetOnePrice(common.TokenPairID, common.Version) (common.OnePrice, error)

	CurrentAuthDataVersion(timepoint uint64) (common.Version, error)
	GetAuthData(common.Version) (common.AuthDataSnapshot, error)
	//ExportExpiredAuthData: Write all expired records into a predetermined filepath
	//each record will be represented in JSON format, and seperates by endline character
	//Return: Number of records exported (uint64) and error
	ExportExpiredAuthData(timepoint uint64, filePath string) (uint64, error)
	PruneExpiredAuthData(timepoint uint64) (uint64, error)
	CurrentRateVersion(timepoint uint64) (common.Version, error)
	GetRate(common.Version) (common.AllRateEntry, error)
	GetRates(fromTime, toTime uint64) ([]common.AllRateEntry, error)

	GetAllRecords(fromTime, toTime uint64) ([]common.ActivityRecord, error)
	GetPendingActivities() ([]common.ActivityRecord, error)
}

Storage is the interface that wraps all database operations of ReserveData.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier