Skip to content

refactor(sei-db): encapsulate ReadOptions lifecycle in iterator constructors#2931

Open
pdrobnjak wants to merge 1 commit intopd/rocksdb-readopts-lifecyclefrom
pd/rocksdb-encapsulate-constructors
Open

refactor(sei-db): encapsulate ReadOptions lifecycle in iterator constructors#2931
pdrobnjak wants to merge 1 commit intopd/rocksdb-readopts-lifecyclefrom
pd/rocksdb-encapsulate-constructors

Conversation

@pdrobnjak
Copy link
Contributor

Stacked on #2929.

Summary

  • Pushes ReadOptions creation into the iterator constructors so callers never handle ReadOptions directly
  • newIterator() creates a versioned iterator with internally managed ReadOptions, used by Iterator() and ReverseIterator()
  • newRangeIterator() creates a timestamp-range iterator with internally managed ReadOptions, used by RawIterate()
  • Adds Timestamp() method on the iterator wrapper so RawIterate can access per-entry timestamps without reaching into the raw grocksdb.Iterator
  • Unexports the iterator constructor (NewRocksDBIterator -> buildIterator)

Test plan

  • No behavioral changes — purely structural refactor
  • All RocksDB tests should pass

🤖 Generated with Claude Code

…ructors

Push ReadOptions creation into the iterator constructors so callers
never handle ReadOptions directly:

- newIterator() creates a versioned iterator with internally managed
  ReadOptions, used by Iterator() and ReverseIterator()
- newRangeIterator() creates a timestamp-range iterator, used by
  RawIterate()
- Add Timestamp() method on the iterator wrapper so RawIterate can
  access per-entry timestamps without reaching into the raw source
- Unexport the iterator constructor (NewRocksDBIterator -> buildIterator)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 19, 2026, 10:16 AM

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.37%. Comparing base (73de9e4) to head (769e9be).

Files with missing lines Patch % Lines
sei-db/db_engine/rocksdb/mvcc/iterator.go 29.41% 12 Missing ⚠️
sei-db/db_engine/rocksdb/mvcc/db.go 50.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                        Coverage Diff                        @@
##           pd/rocksdb-readopts-lifecycle    #2931      +/-   ##
=================================================================
+ Coverage                          57.34%   57.37%   +0.02%     
=================================================================
  Files                               2095     2095              
  Lines                             172896   172900       +4     
=================================================================
+ Hits                               99145    99196      +51     
+ Misses                             64868    64823      -45     
+ Partials                            8883     8881       -2     
Flag Coverage Δ
sei-chain 52.87% <ø> (+0.03%) ⬆️
sei-cosmos 48.19% <ø> (ø)
sei-db 68.58% <33.33%> (-0.60%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/db_engine/rocksdb/mvcc/db.go 59.49% <50.00%> (+1.26%) ⬆️
sei-db/db_engine/rocksdb/mvcc/iterator.go 77.47% <29.41%> (-8.84%) ⬇️

... and 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments