Documentation
¶
Index ¶
- Constants
- func ComparePrice(hi, hj *cc.CrossTransactionWithSignatures) bool
- func NewCacheDb(chainID *big.Int, db ethdb.KeyValueStore, cacheSize uint64) *cacheDB
- func NewIndexDB(chainID *big.Int, rootDB *storm.DB, cacheSize uint64) *indexDB
- func OpenEtherDB(ctx ServiceContext, name string) (ethdb.Database, error)
- func OpenStormDB(ctx ServiceContext, name string) (*storm.DB, error)
- type CrossTransactionIndexed
- type CtxDB
- type CtxSortedByBlockNum
- func (m *CtxSortedByBlockNum) Get(txId common.Hash) *cc.CrossTransactionWithSignatures
- func (m *CtxSortedByBlockNum) Len() int
- func (m *CtxSortedByBlockNum) Put(ctx *cc.CrossTransactionWithSignatures, number uint64)
- func (m *CtxSortedByBlockNum) RemoveByHash(hash common.Hash)
- func (m *CtxSortedByBlockNum) RemoveUnderNum(num uint64)
- type CtxSortedByPrice
- func (t *CtxSortedByPrice) Add(tx *cc.CrossTransactionWithSignatures)
- func (t *CtxSortedByPrice) Cap() uint64
- func (t *CtxSortedByPrice) Count() int
- func (t *CtxSortedByPrice) Get(id common.Hash) *cc.CrossTransactionWithSignatures
- func (t *CtxSortedByPrice) GetAll() map[common.Hash]*cc.CrossTransactionWithSignatures
- func (t *CtxSortedByPrice) GetList(filter func(*cc.CrossTransactionWithSignatures) bool, pageSize int) []*cc.CrossTransactionWithSignatures
- func (t *CtxSortedByPrice) Remove(id common.Hash) bool
- func (t *CtxSortedByPrice) Update(id common.Hash, updater func(*cc.CrossTransactionWithSignatures))
- type CtxToBlockHash
- type ErrCtxDbFailure
- type Filter
- type IndexDbCache
- type ServiceContext
Constants ¶
View Source
const ( //index PK = "PK" CtxIdIndex = "CtxId" PriceIndex = "Price" //field StatusField = "Status" FromField = "From" )
Variables ¶
This section is empty.
Functions ¶
func ComparePrice ¶
func ComparePrice(hi, hj *cc.CrossTransactionWithSignatures) bool
func NewCacheDb ¶
func NewCacheDb(chainID *big.Int, db ethdb.KeyValueStore, cacheSize uint64) *cacheDB
func NewIndexDB ¶
func OpenEtherDB ¶
func OpenEtherDB(ctx ServiceContext, name string) (ethdb.Database, error)
func OpenStormDB ¶
func OpenStormDB(ctx ServiceContext, name string) (*storm.DB, error)
Types ¶
type CrossTransactionIndexed ¶
type CrossTransactionIndexed struct {
PK uint64 `storm:"id,increment"`
CtxId common.Hash `storm:"unique"`
From common.Address `storm:"index"`
Price *big.Float `storm:"index"`
// normal field
Status cc.CtxStatus
Value *big.Int
TxHash common.Hash
BlockHash common.Hash
DestinationId *big.Int
DestinationValue *big.Int
Input []byte
V []*big.Int
R []*big.Int
S []*big.Int
}
func NewCrossTransactionIndexed ¶
func NewCrossTransactionIndexed(ctx *cc.CrossTransactionWithSignatures) *CrossTransactionIndexed
func (CrossTransactionIndexed) ToCrossTransaction ¶
func (c CrossTransactionIndexed) ToCrossTransaction() *cc.CrossTransactionWithSignatures
type CtxDB ¶
type CtxDB interface {
io.Closer
Size() int
Height() int
Load() error
Write(ctx *cc.CrossTransactionWithSignatures) error
Read(ctxId common.Hash) (*cc.CrossTransactionWithSignatures, error)
ReadAll(ctxId common.Hash) (common.Hash, error)
Delete(ctxId common.Hash) error
Update(id common.Hash, updater func(ctx *CrossTransactionIndexed)) error
Has(id common.Hash) bool
QueryByPK(pageSize int, startPage int, filter ...interface{}) []*cc.CrossTransactionWithSignatures
QueryByPrice(pageSize int, startPage int, filter ...interface{}) []*cc.CrossTransactionWithSignatures
Range(pageSize int, startCtxID *common.Hash, endCtxID *common.Hash) []*cc.CrossTransactionWithSignatures
}
type CtxSortedByBlockNum ¶
type CtxSortedByBlockNum struct {
// contains filtered or unexported fields
}
func NewCtxSortedMap ¶
func NewCtxSortedMap() *CtxSortedByBlockNum
func (*CtxSortedByBlockNum) Get ¶
func (m *CtxSortedByBlockNum) Get(txId common.Hash) *cc.CrossTransactionWithSignatures
func (*CtxSortedByBlockNum) Len ¶
func (m *CtxSortedByBlockNum) Len() int
func (*CtxSortedByBlockNum) Put ¶
func (m *CtxSortedByBlockNum) Put(ctx *cc.CrossTransactionWithSignatures, number uint64)
func (*CtxSortedByBlockNum) RemoveByHash ¶
func (m *CtxSortedByBlockNum) RemoveByHash(hash common.Hash)
func (*CtxSortedByBlockNum) RemoveUnderNum ¶
func (m *CtxSortedByBlockNum) RemoveUnderNum(num uint64)
type CtxSortedByPrice ¶
type CtxSortedByPrice struct {
// contains filtered or unexported fields
}
func NewCtxSortedByPrice ¶
func NewCtxSortedByPrice(cap uint64) *CtxSortedByPrice
func (*CtxSortedByPrice) Add ¶
func (t *CtxSortedByPrice) Add(tx *cc.CrossTransactionWithSignatures)
func (*CtxSortedByPrice) Cap ¶
func (t *CtxSortedByPrice) Cap() uint64
func (*CtxSortedByPrice) Count ¶
func (t *CtxSortedByPrice) Count() int
Count returns the current number of items in the all.
func (*CtxSortedByPrice) Get ¶
func (t *CtxSortedByPrice) Get(id common.Hash) *cc.CrossTransactionWithSignatures
func (*CtxSortedByPrice) GetAll ¶
func (t *CtxSortedByPrice) GetAll() map[common.Hash]*cc.CrossTransactionWithSignatures
func (*CtxSortedByPrice) GetList ¶
func (t *CtxSortedByPrice) GetList(filter func(*cc.CrossTransactionWithSignatures) bool, pageSize int) []*cc.CrossTransactionWithSignatures
func (*CtxSortedByPrice) Remove ¶
func (t *CtxSortedByPrice) Remove(id common.Hash) bool
Remove removes a transaction from the all.
func (*CtxSortedByPrice) Update ¶
func (t *CtxSortedByPrice) Update(id common.Hash, updater func(*cc.CrossTransactionWithSignatures))
Update
type CtxToBlockHash ¶
func NewCtxToBlockHash ¶
func NewCtxToBlockHash(cap int) *CtxToBlockHash
type ErrCtxDbFailure ¶
type ErrCtxDbFailure struct {
// contains filtered or unexported fields
}
func (ErrCtxDbFailure) Error ¶
func (e ErrCtxDbFailure) Error() string
type Filter ¶
type Filter func(ctx *cc.CrossTransactionWithSignatures) bool
type IndexDbCache ¶
func (*IndexDbCache) Get ¶
func (m *IndexDbCache) Get(ctxID common.Hash) *CrossTransactionIndexed
func (*IndexDbCache) Put ¶
func (m *IndexDbCache) Put(ctxID common.Hash, ctx *CrossTransactionIndexed)
func (*IndexDbCache) Remove ¶
func (m *IndexDbCache) Remove(ctxID common.Hash)
Click to show internal directories.
Click to hide internal directories.