storage

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: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltStorage

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

BoltStorage is the storage implementation of data.Storage interface that uses BoltDB as its storage engine.

func NewBoltStorage

func NewBoltStorage(path string) (*BoltStorage, error)

NewBoltStorage creates a new BoltStorage instance with the database filename given in parameter.

func (*BoltStorage) ConfirmPendingFeedSetting added in v0.1.2

func (bs *BoltStorage) ConfirmPendingFeedSetting(value []byte) error

func (*BoltStorage) ConfirmRebalanceQuadratic added in v0.1.1

func (bs *BoltStorage) ConfirmRebalanceQuadratic(data []byte) error

ConfirmRebalanceQuadratic confirm pending equation save it to confirmed bucket and remove pending equation

func (*BoltStorage) ConfirmStableTokenParams added in v0.1.1

func (bs *BoltStorage) ConfirmStableTokenParams(value []byte) error

func (*BoltStorage) ConfirmTargetQtyV2 added in v0.1.1

func (bs *BoltStorage) ConfirmTargetQtyV2(value []byte) error

ConfirmTargetQtyV2 check if confirm data match pending data and save it to confirm bucket remove pending data from pending bucket

func (*BoltStorage) ConfirmTokenUpdateInfo added in v0.1.1

func (bs *BoltStorage) ConfirmTokenUpdateInfo(tarQty common.TokenTargetQtyV2, pwi common.PWIEquationRequestV2, quadEq common.RebalanceQuadraticRequest) error

func (*BoltStorage) CurrentAuthDataVersion added in v0.1.1

func (bs *BoltStorage) CurrentAuthDataVersion(timepoint uint64) (common.Version, error)

func (*BoltStorage) CurrentBTCInfoVersion added in v0.1.1

func (bs *BoltStorage) CurrentBTCInfoVersion(timepoint uint64) (common.Version, error)

CurrentBTCInfoVersion returns the most recent time point of gold info record. It implements data.GlobalStorage interface.

func (*BoltStorage) CurrentGoldInfoVersion added in v0.1.1

func (bs *BoltStorage) CurrentGoldInfoVersion(timepoint uint64) (common.Version, error)

CurrentGoldInfoVersion returns the most recent time point of gold info record. It implements data.GlobalStorage interface.

func (*BoltStorage) CurrentPriceVersion

func (bs *BoltStorage) CurrentPriceVersion(timepoint uint64) (common.Version, error)

func (*BoltStorage) CurrentRateVersion

func (bs *BoltStorage) CurrentRateVersion(timepoint uint64) (common.Version, error)

CurrentRateVersion return current rate version

func (*BoltStorage) CurrentUSDInfoVersion added in v0.1.1

func (bs *BoltStorage) CurrentUSDInfoVersion(timepoint uint64) (common.Version, error)

CurrentUSDInfoVersion returns the most recent time point of gold info record. It implements data.GlobalStorage interface.

func (*BoltStorage) ExportExpiredAuthData added in v0.1.1

func (bs *BoltStorage) ExportExpiredAuthData(currentTime uint64, fileName string) (nRecord uint64, err error)

func (*BoltStorage) GetActivity added in v0.1.1

func (bs *BoltStorage) GetActivity(id common.ActivityID) (common.ActivityRecord, error)

GetActivity get activity

func (*BoltStorage) GetAllFetcherConfiguration added in v0.1.1

func (bs *BoltStorage) GetAllFetcherConfiguration() (config common.FetcherConfiguration, err error)

GetAllFetcherConfiguration returns config for fetcher

func (*BoltStorage) GetAllPrices

func (bs *BoltStorage) GetAllPrices(version common.Version) (common.AllPriceEntry, error)

GetAllPrices returns the corresponding AllPriceEntry to a particular Version

func (*BoltStorage) GetAllRecords

func (bs *BoltStorage) GetAllRecords(fromTime, toTime uint64) ([]common.ActivityRecord, error)

func (*BoltStorage) GetAuthData added in v0.1.1

func (bs *BoltStorage) GetAuthData(version common.Version) (common.AuthDataSnapshot, error)

func (*BoltStorage) GetBTCInfo added in v0.1.1

func (bs *BoltStorage) GetBTCInfo(version common.Version) (common.BTCData, error)

GetBTCInfo returns BTC info at given time point. It implements data.GlobalStorage interface.

func (*BoltStorage) GetExchangeNotifications added in v0.1.1

func (bs *BoltStorage) GetExchangeNotifications() (common.ExchangeNotifications, error)

func (*BoltStorage) GetExchangeStatus added in v0.1.1

func (bs *BoltStorage) GetExchangeStatus() (common.ExchangesStatus, error)

GetExchangeStatus get exchange status to dashboard and analytics

func (*BoltStorage) GetFeedConfiguration added in v0.1.1

func (bs *BoltStorage) GetFeedConfiguration() ([]common.FeedConfiguration, error)

func (*BoltStorage) GetFeedSetting added in v0.1.2

func (bs *BoltStorage) GetFeedSetting() (common.MapFeedSetting, error)

func (*BoltStorage) GetGoldInfo added in v0.1.1

func (bs *BoltStorage) GetGoldInfo(version common.Version) (common.GoldData, error)

GetGoldInfo returns gold info at given time point. It implements data.GlobalStorage interface.

func (*BoltStorage) GetMetric added in v0.1.1

func (bs *BoltStorage) GetMetric(tokens []common.Token, fromTime, toTime uint64) (map[string]common.MetricList, error)

GetMetric return metric data

func (*BoltStorage) GetNumberOfVersion added in v0.1.1

func (bs *BoltStorage) GetNumberOfVersion(tx *bolt.Tx, bucket string) int

GetNumberOfVersion return number of version storing in a bucket

func (*BoltStorage) GetOnePrice

func (bs *BoltStorage) GetOnePrice(pair common.TokenPairID, version common.Version) (common.OnePrice, error)

func (*BoltStorage) GetPWIEquationV2 added in v0.1.1

func (bs *BoltStorage) GetPWIEquationV2() (common.PWIEquationRequestV2, error)

GetPWIEquationV2 returns the current PWI equations from database.

func (*BoltStorage) GetPendingActivities

func (bs *BoltStorage) GetPendingActivities() ([]common.ActivityRecord, error)

GetPendingActivities return pending activities

func (*BoltStorage) GetPendingFeedSetting added in v0.1.2

func (bs *BoltStorage) GetPendingFeedSetting() (common.MapFeedSetting, error)

func (*BoltStorage) GetPendingPWIEquationV2 added in v0.1.1

func (bs *BoltStorage) GetPendingPWIEquationV2() (common.PWIEquationRequestV2, error)

GetPendingPWIEquationV2 returns the stored PWIEquationRequestV2 in database.

func (*BoltStorage) GetPendingRebalanceQuadratic added in v0.1.1

func (bs *BoltStorage) GetPendingRebalanceQuadratic() (common.RebalanceQuadraticRequest, error)

GetPendingRebalanceQuadratic return pending rebalance quadratic equation Return err if occur, or if the DB is empty

func (*BoltStorage) GetPendingStableTokenParams added in v0.1.1

func (bs *BoltStorage) GetPendingStableTokenParams() (map[string]interface{}, error)

func (*BoltStorage) GetPendingTargetQtyV2 added in v0.1.1

func (bs *BoltStorage) GetPendingTargetQtyV2() (common.TokenTargetQtyV2, error)

GetPendingTargetQtyV2 return current pending target quantity

func (*BoltStorage) GetRate added in v0.1.1

func (bs *BoltStorage) GetRate(version common.Version) (common.AllRateEntry, error)

func (*BoltStorage) GetRates added in v0.1.1

func (bs *BoltStorage) GetRates(fromTime, toTime uint64) ([]common.AllRateEntry, error)

GetRates return rates history

func (*BoltStorage) GetRebalanceControl added in v0.1.1

func (bs *BoltStorage) GetRebalanceControl() (common.RebalanceControl, error)

func (*BoltStorage) GetRebalanceQuadratic added in v0.1.1

func (bs *BoltStorage) GetRebalanceQuadratic() (common.RebalanceQuadraticRequest, error)

GetRebalanceQuadratic return current confirm rebalance quadratic equation

func (*BoltStorage) GetSetrateControl added in v0.1.1

func (bs *BoltStorage) GetSetrateControl() (common.SetrateControl, error)

func (*BoltStorage) GetStableTokenParams added in v0.1.1

func (bs *BoltStorage) GetStableTokenParams() (map[string]interface{}, error)

func (*BoltStorage) GetTargetQtyV2 added in v0.1.1

func (bs *BoltStorage) GetTargetQtyV2() (common.TokenTargetQtyV2, error)

GetTargetQtyV2 return the current target quantity

func (*BoltStorage) GetTokenTargetQty added in v0.1.1

func (bs *BoltStorage) GetTokenTargetQty() (common.TokenTargetQty, error)

GetTokenTargetQty get target quantity

func (*BoltStorage) GetUSDInfo added in v0.1.1

func (bs *BoltStorage) GetUSDInfo(version common.Version) (common.USDData, error)

GetUSDInfo returns USD info at given time point. It implements data.GlobalStorage interface.

func (*BoltStorage) HasPendingDeposit added in v0.1.1

func (bs *BoltStorage) HasPendingDeposit(token common.Token, exchange common.Exchange) (bool, error)

HasPendingDeposit check if a deposit is pending

func (*BoltStorage) PendingSetRate added in v0.1.1

func (bs *BoltStorage) PendingSetRate(minedNonce uint64) (*common.ActivityRecord, uint64, error)

PendingSetRate return pending set rate activity

func (*BoltStorage) PruneExpiredAuthData added in v0.1.1

func (bs *BoltStorage) PruneExpiredAuthData(currentTime uint64) (nRecord uint64, err error)

func (*BoltStorage) PruneOutdatedData added in v0.1.1

func (bs *BoltStorage) PruneOutdatedData(tx *bolt.Tx, bucket string) error

PruneOutdatedData Remove first version out of database

func (*BoltStorage) Record

func (bs *BoltStorage) Record(
	action string,
	id common.ActivityID,
	destination string,
	params map[string]interface{}, result map[string]interface{},
	estatus string,
	mstatus string,
	timepoint uint64) error

Record save activity

func (*BoltStorage) RejectPendingFeedSetting added in v0.1.2

func (bs *BoltStorage) RejectPendingFeedSetting() error

func (*BoltStorage) RemovePendingPWIEquationV2 added in v0.1.1

func (bs *BoltStorage) RemovePendingPWIEquationV2() error

RemovePendingPWIEquationV2 deletes the pending equation request.

func (*BoltStorage) RemovePendingRebalanceQuadratic added in v0.1.1

func (bs *BoltStorage) RemovePendingRebalanceQuadratic() error

RemovePendingRebalanceQuadratic remove pending rebalance quadratic equation use when admin want to reject a config for rebalance quadratic equation

func (*BoltStorage) RemovePendingStableTokenParams added in v0.1.1

func (bs *BoltStorage) RemovePendingStableTokenParams() error

func (*BoltStorage) RemovePendingTargetQtyV2 added in v0.1.1

func (bs *BoltStorage) RemovePendingTargetQtyV2() error

RemovePendingTargetQtyV2 remove pending data from db

func (*BoltStorage) RemoveStalePendingActivities added in v0.1.1

func (bs *BoltStorage) RemoveStalePendingActivities(tx *bolt.Tx, stales []common.ActivityRecord) error

RemovePendingActivities remove it

func (*BoltStorage) SetStableTokenParams added in v0.1.1

func (bs *BoltStorage) SetStableTokenParams(value []byte) error

func (*BoltStorage) StoreAuthSnapshot added in v0.1.1

func (bs *BoltStorage) StoreAuthSnapshot(
	data *common.AuthDataSnapshot, timepoint uint64) error

func (*BoltStorage) StoreBTCInfo added in v0.1.1

func (bs *BoltStorage) StoreBTCInfo(data common.BTCData) error

StoreBTCInfo stores the given BTC information to database. It implements fetcher.GlobalStorage interface.

func (*BoltStorage) StoreGoldInfo added in v0.1.1

func (bs *BoltStorage) StoreGoldInfo(data common.GoldData) error

StoreGoldInfo stores the given gold information to database. It implements fetcher.GlobalStorage interface.

func (*BoltStorage) StoreMetric added in v0.1.1

func (bs *BoltStorage) StoreMetric(data *common.MetricEntry, timepoint uint64) error

StoreMetric store metric info

func (*BoltStorage) StorePWIEquationV2 added in v0.1.1

func (bs *BoltStorage) StorePWIEquationV2(data string) error

StorePWIEquationV2 moved the pending equation request to pwiEquationV2 bucket and remove it from pending bucket if the given data matched what stored.

func (*BoltStorage) StorePendingFeedSetting added in v0.1.2

func (bs *BoltStorage) StorePendingFeedSetting(value []byte) error

func (*BoltStorage) StorePendingPWIEquationV2 added in v0.1.1

func (bs *BoltStorage) StorePendingPWIEquationV2(data []byte) error

StorePendingPWIEquationV2 stores the given PWIs equation data for later approval. Return error if occur or there is no pending PWIEquation

func (*BoltStorage) StorePendingRebalanceQuadratic added in v0.1.1

func (bs *BoltStorage) StorePendingRebalanceQuadratic(data []byte) error

StorePendingRebalanceQuadratic store pending data (stand for rebalance quadratic equation) to db data byte for json {"KNC": {"a": 0.9, "b": 1.2, "c": 1.4}}

func (*BoltStorage) StorePendingTargetQtyV2 added in v0.1.1

func (bs *BoltStorage) StorePendingTargetQtyV2(value []byte) error

StorePendingTargetQtyV2 store value into pending target qty v2 bucket

func (*BoltStorage) StorePrice

func (bs *BoltStorage) StorePrice(data common.AllPriceEntry, timepoint uint64) error

func (*BoltStorage) StoreRate

func (bs *BoltStorage) StoreRate(data common.AllRateEntry, timepoint uint64) error

StoreRate store rate history

func (*BoltStorage) StoreRebalanceControl added in v0.1.1

func (bs *BoltStorage) StoreRebalanceControl(status bool) error

func (*BoltStorage) StoreSetrateControl added in v0.1.1

func (bs *BoltStorage) StoreSetrateControl(status bool) error

func (*BoltStorage) StoreUSDInfo added in v0.1.1

func (bs *BoltStorage) StoreUSDInfo(data common.USDData) error

StoreUSDInfo stores the given USD information to database. It implements fetcher.GlobalStorage interface.

func (*BoltStorage) UpdateActivity added in v0.1.1

func (bs *BoltStorage) UpdateActivity(id common.ActivityID, activity common.ActivityRecord) error

UpdateActivity update activity info

func (*BoltStorage) UpdateExchangeNotification added in v0.1.1

func (bs *BoltStorage) UpdateExchangeNotification(
	exchange, action, token string, fromTime, toTime uint64, isWarning bool, msg string) error

func (*BoltStorage) UpdateExchangeStatus added in v0.1.1

func (bs *BoltStorage) UpdateExchangeStatus(data common.ExchangesStatus) error

func (*BoltStorage) UpdateFeedConfiguration added in v0.1.1

func (bs *BoltStorage) UpdateFeedConfiguration(name string, enabled bool) error

func (*BoltStorage) UpdateFetcherConfiguration added in v0.1.1

func (bs *BoltStorage) UpdateFetcherConfiguration(config common.FetcherConfiguration) (err error)

UpdateFetcherConfiguration save btc fetcher config to db

Jump to

Keyboard shortcuts

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