Documentation ¶
Index ¶
- Variables
- type LevelDBMovStore
- func (m *LevelDBMovStore) Clear()
- func (m *LevelDBMovStore) GetMovDatabaseState() (*common.MovDatabaseState, error)
- func (m *LevelDBMovStore) InitDBState(height uint64, hash *bc.Hash) error
- func (m *LevelDBMovStore) ListOrders(orderAfter *common.Order) ([]*common.Order, error)
- func (m *LevelDBMovStore) ListTradePairsWithStart(fromAssetIDAfter, toAssetIDAfter *bc.AssetID) ([]*common.TradePair, error)
- func (m *LevelDBMovStore) ProcessOrders(addOrders []*common.Order, delOrders []*common.Order, ...) error
- type MovStore
- type OrderIterator
- type TradePairIterator
Constants ¶
This section is empty.
Variables ¶
var ErrNotInitDBState = errors.New("database state of mov store is not initialized")
ErrNotInitDBState represent the database state of mov store is not initialized
Functions ¶
This section is empty.
Types ¶
type LevelDBMovStore ¶ added in v1.0.5
type LevelDBMovStore struct {
// contains filtered or unexported fields
}
LevelDBMovStore is the LevelDB implementation for MovStore
func NewLevelDBMovStore ¶ added in v1.0.5
func NewLevelDBMovStore(db dbm.DB) *LevelDBMovStore
NewLevelDBMovStore create a new LevelDBMovStore object
func (*LevelDBMovStore) Clear ¶ added in v1.1.1
func (m *LevelDBMovStore) Clear()
Clear will clear all the data of store
func (*LevelDBMovStore) GetMovDatabaseState ¶ added in v1.0.5
func (m *LevelDBMovStore) GetMovDatabaseState() (*common.MovDatabaseState, error)
GetMovDatabaseState return the current DB's image status
func (*LevelDBMovStore) InitDBState ¶ added in v1.0.5
func (m *LevelDBMovStore) InitDBState(height uint64, hash *bc.Hash) error
InitDBState set the DB's image status
func (*LevelDBMovStore) ListOrders ¶ added in v1.0.5
ListOrders return n orders after the input order
func (*LevelDBMovStore) ListTradePairsWithStart ¶ added in v1.0.5
func (m *LevelDBMovStore) ListTradePairsWithStart(fromAssetIDAfter, toAssetIDAfter *bc.AssetID) ([]*common.TradePair, error)
ListTradePairsWithStart return n trade pairs after the input trade pair
func (*LevelDBMovStore) ProcessOrders ¶ added in v1.0.5
func (m *LevelDBMovStore) ProcessOrders(addOrders []*common.Order, delOrders []*common.Order, blockHeader *types.BlockHeader) error
ProcessOrders update the DB's image by add new orders, delete the used order
type MovStore ¶
type MovStore interface { Clear() GetMovDatabaseState() (*common.MovDatabaseState, error) InitDBState(height uint64, hash *bc.Hash) error ListOrders(orderAfter *common.Order) ([]*common.Order, error) ListTradePairsWithStart(fromAssetIDAfter, toAssetIDAfter *bc.AssetID) ([]*common.TradePair, error) ProcessOrders(addOrders []*common.Order, delOrders []*common.Order, blockHeader *types.BlockHeader) error }
MovStore is the interface for mov's persistent storage
type OrderIterator ¶ added in v1.0.5
type OrderIterator struct {
// contains filtered or unexported fields
}
OrderIterator wrap read order from DB action
func NewOrderIterator ¶ added in v1.0.5
func NewOrderIterator(movStore MovStore, tradePair *common.TradePair) *OrderIterator
NewOrderIterator create the new OrderIterator object
func (*OrderIterator) HasNext ¶ added in v1.0.5
func (o *OrderIterator) HasNext() bool
HasNext check if there are more orders in memory or DB
func (*OrderIterator) NextBatch ¶ added in v1.0.5
func (o *OrderIterator) NextBatch() []*common.Order
NextBatch return the next batch of orders in memory or DB
type TradePairIterator ¶ added in v1.0.5
type TradePairIterator struct {
// contains filtered or unexported fields
}
TradePairIterator wrap read trade pair from DB action
func NewTradePairIterator ¶ added in v1.0.5
func NewTradePairIterator(movStore MovStore) *TradePairIterator
NewTradePairIterator create the new TradePairIterator object
func (*TradePairIterator) HasNext ¶ added in v1.0.5
func (t *TradePairIterator) HasNext() bool
HasNext check if there are more trade pairs in memory or DB
func (*TradePairIterator) Next ¶ added in v1.0.5
func (t *TradePairIterator) Next() *common.TradePair
Next return the next available trade pair in memory or DB