Skip to content
4 changes: 2 additions & 2 deletions sei-db/config/receipt_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ func ReadReceiptConfig(opts AppOptions) (ReceiptStoreConfig, error) {
}
backend = strings.ToLower(strings.TrimSpace(backend))
switch backend {
case "pebbledb", "pebble":
case "pebbledb", "pebble", "littidx":
cfg.Backend = backend
default:
return cfg, fmt.Errorf("unsupported receipt-store backend %q; supported: pebbledb", backend)
return cfg, fmt.Errorf("unsupported receipt-store backend %q; supported: pebbledb, littidx", backend)
}
}
if v := opts.Get(flagRSAsyncWriteBuffer); v != nil {
Expand Down
9 changes: 9 additions & 0 deletions sei-db/db_engine/pebbledb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ func (p *pebbleDB) Delete(key []byte, opts types.WriteOptions) error {
return nil
}

// DeleteRange deletes every key in [start, end) with a single range tombstone
// (O(1) write) rather than iterating and point-deleting each key.
func (p *pebbleDB) DeleteRange(start, end []byte, opts types.WriteOptions) error {
if err := p.db.DeleteRange(start, end, toPebbleWriteOpts(opts)); err != nil {
return fmt.Errorf("failed to delete range in database: %w", err)
}
return nil
}

func (p *pebbleDB) NewIter(opts *types.IterOptions) (dbm.Iterator, error) {
var iopts *pebble.IterOptions
if opts != nil {
Expand Down
7 changes: 7 additions & 0 deletions sei-db/ledger_db/receipt/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ func RecoverReceiptStore(changelogPath string, db types2.StateStore) error {
func GetLogsForTx(receipt *types.Receipt, logStartIndex uint) []*ethtypes.Log {
return getLogsForTx(receipt, logStartIndex)
}

// PruneLittIdx runs a synchronous prune on a littidx store, removing every
// block below cutoff. Test-only hook so prune behavior can be asserted without
// waiting on the background interval.
func PruneLittIdx(store ReceiptStore, cutoff uint64) error {
return store.(*littReceiptStore).pruneBlocksBelow(cutoff)
}
Loading
Loading