mirror of
https://github.com/alexgo-io/gaze-indexer.git
synced 2026-04-29 04:05:12 +08:00
refactor: split reader and writer datagateway
This commit is contained in:
@@ -15,10 +15,27 @@ type FlushData struct {
|
||||
BlockHeight uint64
|
||||
}
|
||||
|
||||
type RunesProcessorDataGateway interface {
|
||||
type RunesDataGateway interface {
|
||||
RunesReaderDataGateway
|
||||
RunesWriterDataGateway
|
||||
}
|
||||
|
||||
type RunesReaderDataGateway interface {
|
||||
GetRunesBalancesAtOutPoint(ctx context.Context, outPoint wire.OutPoint) (map[runes.RuneId]uint128.Uint128, error)
|
||||
GetRuneIdByRune(ctx context.Context, rune runes.Rune) (runes.RuneId, error)
|
||||
GetRuneEntryByRuneId(ctx context.Context, runeId runes.RuneId) (*runes.RuneEntry, error)
|
||||
|
||||
FlushStates(ctx context.Context, data FlushData) error
|
||||
}
|
||||
|
||||
type RunesWriterDataGateway interface {
|
||||
// Begin starts a DB transaction. All write operations done after this call must call Commit() to persist the changes.
|
||||
Begin(ctx context.Context) error
|
||||
// Commit commits the DB transaction. All changes made after Begin() will be persisted.
|
||||
Commit(ctx context.Context) error
|
||||
// Rollback rolls back the DB transaction. All changes made after Begin() will be discarded.
|
||||
Rollback(ctx context.Context) error
|
||||
|
||||
SetRuneEntry(ctx context.Context, entry *runes.RuneEntry) error
|
||||
CreateRunesBalanceAtOutPoint(ctx context.Context, outPoint wire.OutPoint, balances map[runes.RuneId]uint128.Uint128) error
|
||||
CreateRuneBalance(ctx context.Context, pkScript string, runeId runes.RuneId, blockHeight uint64, balance uint128.Uint128) error
|
||||
UpdateLatestBlockHeight(ctx context.Context, blockHeight uint64) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user