-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.go
32 lines (28 loc) · 933 Bytes
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package tomox
import (
"github.com/tomochain/tomochain/common"
"github.com/tomochain/tomochain/ethdb"
"github.com/tomochain/tomochain/tomox/tomox_state"
"github.com/globalsign/mgo"
)
type OrderDao interface {
// for both leveldb and mongodb
IsEmptyKey(key []byte) bool
Close()
// mongodb methods
HasObject(hash common.Hash) (bool, error)
GetObject(hash common.Hash, val interface{}) (interface{}, error)
PutObject(hash common.Hash, val interface{}) error
DeleteObject(hash common.Hash) error // won't return error if key not found
GetOrderByTxHash(txhash common.Hash) []*tomox_state.OrderItem
GetListOrderByHashes(hashes []string) []*tomox_state.OrderItem
DeleteTradeByTxHash(txhash common.Hash)
InitBulk() *mgo.Session
CommitBulk() error
// leveldb methods
Put(key []byte, value []byte) error
Get(key []byte) ([]byte, error)
Has(key []byte) (bool, error)
Delete(key []byte) error
NewBatch() ethdb.Batch
}