Documentation ¶
Index ¶
- type KVBatchRepo
- type KVIndexRepo
- func (repo *KVIndexRepo) DeleteOldBlocks(untilTime *big.Int) (int, error)
- func (repo *KVIndexRepo) GetBlocks(blockNumber string, rows int, start int) (int, []types.BlockIndex)
- func (repo *KVIndexRepo) GetFirstBlock() (types.BlockIndex, error)
- func (repo *KVIndexRepo) GetLastBlock() (types.BlockIndex, error)
- func (repo *KVIndexRepo) GetTotalTransaction(address string, fromTime time.Time, toTime time.Time) int
- func (repo *KVIndexRepo) GetTransactionByAddress(address string, rows int, start int, fromTime time.Time, toTime time.Time) (int, []types.AddressIndex)
- func (repo *KVIndexRepo) HandleReorg(blockTime *big.Int, reorgAddresses []types.AddressSequence) error
- func (repo *KVIndexRepo) SaveAddressIndex(addressIndex []*types.AddressIndex) error
- func (repo *KVIndexRepo) SaveBlockIndex(blockIndex *types.BlockIndex) error
- func (repo *KVIndexRepo) Store(addressIndex []*types.AddressIndex, blockIndex *types.BlockIndex, isBatch bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KVBatchRepo ¶
type KVBatchRepo struct {
// contains filtered or unexported fields
}
KVBatchRepo implement BatchRepo
func NewKVBatchRepo ¶
func NewKVBatchRepo(batchDAO dao.KeyValueDAO) *KVBatchRepo
NewKVBatchRepo new KVBatchRepo instance
func (*KVBatchRepo) GetAllBatchStatuses ¶
func (repo *KVBatchRepo) GetAllBatchStatuses() []types.BatchStatus
GetAllBatchStatuses get all batches
func (*KVBatchRepo) ReplaceBatch ¶
ReplaceBatch replace a batch with new "to"
func (*KVBatchRepo) UpdateBatch ¶
func (repo *KVBatchRepo) UpdateBatch(batch types.BatchStatus) error
UpdateBatch update a batch
type KVIndexRepo ¶
type KVIndexRepo struct {
// contains filtered or unexported fields
}
KVIndexRepo implementation of IndexRepo
func NewKVIndexRepo ¶
func NewKVIndexRepo(addressDAO dao.KeyValueDAO, blockDAO dao.KeyValueDAO) *KVIndexRepo
NewKVIndexRepo create an instance of KVIndexRepo
func (*KVIndexRepo) DeleteOldBlocks ¶
func (repo *KVIndexRepo) DeleteOldBlocks(untilTime *big.Int) (int, error)
DeleteOldBlocks delete blocks where CreatedAt < untilTime
func (*KVIndexRepo) GetBlocks ¶
func (repo *KVIndexRepo) GetBlocks(blockNumber string, rows int, start int) (int, []types.BlockIndex)
GetBlocks by blockNumber. blockNumber = blank => latest block
func (*KVIndexRepo) GetFirstBlock ¶
func (repo *KVIndexRepo) GetFirstBlock() (types.BlockIndex, error)
GetFirstBlock first saved block in newHead block DB
func (*KVIndexRepo) GetLastBlock ¶
func (repo *KVIndexRepo) GetLastBlock() (types.BlockIndex, error)
GetLastBlock latest saved block in newHead block DB
func (*KVIndexRepo) GetTotalTransaction ¶ added in v1.0.0
func (repo *KVIndexRepo) GetTotalTransaction(address string, fromTime time.Time, toTime time.Time) int
GetTotalTransaction get total transaction of an account
func (*KVIndexRepo) GetTransactionByAddress ¶
func (repo *KVIndexRepo) GetTransactionByAddress(address string, rows int, start int, fromTime time.Time, toTime time.Time) (int, []types.AddressIndex)
GetTransactionByAddress main thing for this indexer
func (*KVIndexRepo) HandleReorg ¶
func (repo *KVIndexRepo) HandleReorg(blockTime *big.Int, reorgAddresses []types.AddressSequence) error
HandleReorg handle reorg scenario: get block again
func (*KVIndexRepo) SaveAddressIndex ¶
func (repo *KVIndexRepo) SaveAddressIndex(addressIndex []*types.AddressIndex) error
SaveAddressIndex save to address db
func (*KVIndexRepo) SaveBlockIndex ¶
func (repo *KVIndexRepo) SaveBlockIndex(blockIndex *types.BlockIndex) error
SaveBlockIndex save to block db
func (*KVIndexRepo) Store ¶
func (repo *KVIndexRepo) Store(addressIndex []*types.AddressIndex, blockIndex *types.BlockIndex, isBatch bool) error
Store implements IndexRepo