data

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

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

Fetcher is the common interface of a fetcher service.

type GlobalStorage added in v0.1.1

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 added in v0.1.2

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

func (ReserveData) ControlAuthDataSize added in v0.1.1

func (rd ReserveData) ControlAuthDataSize() error

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

func (ReserveData) CurrentAuthDataVersion added in v0.1.1

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

func (ReserveData) CurrentBTCInfoVersion added in v0.1.1

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

func (ReserveData) CurrentGoldInfoVersion added in v0.1.1

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

func (ReserveData) CurrentPriceVersion

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

func (ReserveData) CurrentUSDInfoVersion added in v0.1.1

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

func (ReserveData) GetAllFetcherConfiguration added in v0.1.1

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 added in v0.1.1

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

func (ReserveData) GetBTCData added in v0.1.1

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

func (ReserveData) GetExchangeStatus added in v0.1.1

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

func (ReserveData) GetFeedConfiguration added in v0.1.1

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

func (ReserveData) GetFeedSetting added in v0.1.2

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

func (ReserveData) GetGoldData added in v0.1.1

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

func (ReserveData) GetNotifications added in v0.1.1

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 added in v0.1.2

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

func (ReserveData) GetRate added in v0.1.1

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

func (ReserveData) GetRates added in v0.1.1

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 added in v0.1.1

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

func (ReserveData) GetUSDData added in v0.1.1

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

func (ReserveData) RejectPendingFeedSetting added in v0.1.2

func (rd ReserveData) RejectPendingFeedSetting() error

func (ReserveData) Run

func (rd ReserveData) Run() error

Run run fetcher

func (ReserveData) RunStorageController added in v0.1.1

func (rd ReserveData) RunStorageController() error

func (ReserveData) Stop

func (rd ReserveData) Stop() error

Stop stop the fetcher

func (ReserveData) StorePendingFeedSetting added in v0.1.2

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

func (ReserveData) UpdateExchangeNotification added in v0.1.1

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

func (ReserveData) UpdateExchangeStatus added in v0.1.1

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

func (ReserveData) UpdateFeedConfiguration added in v0.1.1

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

func (ReserveData) UpdateFetcherConfiguration added in v0.1.1

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

UpdateFetcherConfiguration save btc fetcher configuration to db and return new configuration

type Setting added in v0.1.1

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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