storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRICE_BUCKET            string = "prices"
	BALANCE_BUCKET          string = "balances"
	EXCHANGE_BALANCE_BUCKET string = "ebalances"
	RATE_BUCKET             string = "rates"
	ORDER_BUCKET            string = "orders"
	ACTIVITY_BUCKET         string = "activities"
	PENDING_ACTIVITY_BUCKET string = "pending_activities"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltStorage

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

func NewBoltStorage

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

func (*BoltStorage) CurrentBalanceVersion

func (self *BoltStorage) CurrentBalanceVersion(timepoint uint64) (common.Version, error)

func (*BoltStorage) CurrentEBalanceVersion

func (self *BoltStorage) CurrentEBalanceVersion(timepoint uint64) (common.Version, error)

func (*BoltStorage) CurrentPriceVersion

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

func (*BoltStorage) CurrentRateVersion

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

func (*BoltStorage) GetAllBalances

func (self *BoltStorage) GetAllBalances(version common.Version) (map[string]common.BalanceEntry, error)

func (*BoltStorage) GetAllEBalances

func (self *BoltStorage) GetAllEBalances(version common.Version) (map[common.ExchangeID]common.EBalanceEntry, error)

func (*BoltStorage) GetAllPrices

func (self *BoltStorage) GetAllPrices(version common.Version) (map[common.TokenPairID]common.OnePrice, error)

func (*BoltStorage) GetAllRates

func (self *BoltStorage) GetAllRates(version common.Version) (common.AllRateEntry, error)

func (*BoltStorage) GetAllRecords

func (self *BoltStorage) GetAllRecords() ([]common.ActivityRecord, error)

func (*BoltStorage) GetOnePrice

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

func (*BoltStorage) GetPendingActivities

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

func (*BoltStorage) Record

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

func (*BoltStorage) StoreBalance

func (self *BoltStorage) StoreBalance(data map[string]common.BalanceEntry, timepoint uint64) error

func (*BoltStorage) StoreEBalance

func (self *BoltStorage) StoreEBalance(data map[common.ExchangeID]common.EBalanceEntry, timepoint uint64) error

func (*BoltStorage) StorePrice

func (self *BoltStorage) StorePrice(data map[common.TokenPairID]common.OnePrice, timepoint uint64) error

func (*BoltStorage) StoreRate

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

func (*BoltStorage) UpdateActivityStatus

func (self *BoltStorage) UpdateActivityStatus(action string, id common.ActivityID, destination string, status string) error

type RamActivityStorage

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

func NewRamActivityStorage

func NewRamActivityStorage() *RamActivityStorage

func (*RamActivityStorage) GetAllRecords

func (self *RamActivityStorage) GetAllRecords() ([]common.ActivityRecord, error)

func (*RamActivityStorage) GetPendingRecords

func (self *RamActivityStorage) GetPendingRecords() ([]common.ActivityRecord, error)

func (*RamActivityStorage) StoreNewData

func (self *RamActivityStorage) StoreNewData(
	action string,
	id common.ActivityID,
	destination string,
	params map[string]interface{}, result map[string]interface{},
	status string,
	timepoint uint64) error

func (*RamActivityStorage) UpdateActivityStatus

func (self *RamActivityStorage) UpdateActivityStatus(action string, id common.ActivityID, destination string, status string) error

type RamBalanceStorage

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

func NewRamBalanceStorage

func NewRamBalanceStorage() *RamBalanceStorage

func (*RamBalanceStorage) CurrentVersion

func (self *RamBalanceStorage) CurrentVersion(timepoint uint64) (int64, error)

func (*RamBalanceStorage) GetAllBalances

func (self *RamBalanceStorage) GetAllBalances(version int64) (map[string]common.BalanceEntry, error)

func (*RamBalanceStorage) StoreNewData

func (self *RamBalanceStorage) StoreNewData(data map[string]common.BalanceEntry, timepoint uint64) error

type RamEBalanceStorage

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

func NewRamEBalanceStorage

func NewRamEBalanceStorage() *RamEBalanceStorage

func (*RamEBalanceStorage) CurrentVersion

func (self *RamEBalanceStorage) CurrentVersion(timepoint uint64) (int64, error)

func (*RamEBalanceStorage) GetAllBalances

func (self *RamEBalanceStorage) GetAllBalances(version int64) (map[common.ExchangeID]common.EBalanceEntry, error)

func (*RamEBalanceStorage) StoreNewData

func (self *RamEBalanceStorage) StoreNewData(data map[common.ExchangeID]common.EBalanceEntry, timepoint uint64) error

type RamPriceStorage

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

func NewRamPriceStorage

func NewRamPriceStorage() *RamPriceStorage

func (*RamPriceStorage) CurrentVersion

func (self *RamPriceStorage) CurrentVersion(timepoint uint64) (int64, error)

func (*RamPriceStorage) GetAllPrices

func (self *RamPriceStorage) GetAllPrices(version int64) (map[common.TokenPairID]common.OnePrice, error)

func (*RamPriceStorage) GetOnePrice

func (self *RamPriceStorage) GetOnePrice(pair common.TokenPairID, version int64) (common.OnePrice, error)

func (*RamPriceStorage) StoreNewData

func (self *RamPriceStorage) StoreNewData(data map[common.TokenPairID]common.OnePrice, timepoint uint64) error

type RamRateStorage

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

func NewRamRateStorage

func NewRamRateStorage() *RamRateStorage

func (*RamRateStorage) CurrentVersion

func (self *RamRateStorage) CurrentVersion(timepoint uint64) (int64, error)

func (*RamRateStorage) GetRates

func (self *RamRateStorage) GetRates(version int64) (common.AllRateEntry, error)

func (*RamRateStorage) StoreNewData

func (self *RamRateStorage) StoreNewData(data common.AllRateEntry, timepoint uint64) error

type RamStorage

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

RamStorage is a simple and fast storage that eliminate all old data but the newest one RamStorage works fine when Core doesn't use historical data and doesn't take timestamp into account

If Core uses such data, please use other kind of storage such as bolt.

func NewRamStorage

func NewRamStorage() *RamStorage

func (*RamStorage) CurrentBalanceVersion

func (self *RamStorage) CurrentBalanceVersion(timepoint uint64) (common.Version, error)

func (*RamStorage) CurrentEBalanceVersion

func (self *RamStorage) CurrentEBalanceVersion(timepoint uint64) (common.Version, error)

func (*RamStorage) CurrentPriceVersion

func (self *RamStorage) CurrentPriceVersion(timepoint uint64) (common.Version, error)

func (*RamStorage) CurrentRateVersion

func (self *RamStorage) CurrentRateVersion(timepoint uint64) (common.Version, error)

func (*RamStorage) GetAllBalances

func (self *RamStorage) GetAllBalances(version common.Version) (map[string]common.BalanceEntry, error)

func (*RamStorage) GetAllEBalances

func (self *RamStorage) GetAllEBalances(version common.Version) (map[common.ExchangeID]common.EBalanceEntry, error)

func (*RamStorage) GetAllPrices

func (self *RamStorage) GetAllPrices(version common.Version) (map[common.TokenPairID]common.OnePrice, error)

func (*RamStorage) GetAllRates

func (self *RamStorage) GetAllRates(version common.Version) (common.AllRateEntry, error)

func (*RamStorage) GetAllRecords

func (self *RamStorage) GetAllRecords() ([]common.ActivityRecord, error)

func (*RamStorage) GetOnePrice

func (self *RamStorage) GetOnePrice(pair common.TokenPairID, version common.Version) (common.OnePrice, error)

func (*RamStorage) GetPendingActivities

func (self *RamStorage) GetPendingActivities() ([]common.ActivityRecord, error)

func (*RamStorage) Record

func (self *RamStorage) Record(
	action string,
	id common.ActivityID,
	destination string,
	params map[string]interface{}, result map[string]interface{},
	status string,
	timepoint uint64) error

func (*RamStorage) StoreBalance

func (self *RamStorage) StoreBalance(data map[string]common.BalanceEntry, timepoint uint64) error

func (*RamStorage) StoreEBalance

func (self *RamStorage) StoreEBalance(data map[common.ExchangeID]common.EBalanceEntry, timepoint uint64) error

func (*RamStorage) StorePrice

func (self *RamStorage) StorePrice(data map[common.TokenPairID]common.OnePrice, timepoint uint64) error

func (*RamStorage) StoreRate

func (self *RamStorage) StoreRate(data common.AllRateEntry, timepoint uint64) error

func (*RamStorage) UpdateActivityStatus

func (self *RamStorage) UpdateActivityStatus(action string, id common.ActivityID, destination string, status string) error

Jump to

Keyboard shortcuts

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