Add transaction refresh support to store crawlers#5042
Add transaction refresh support to store crawlers#5042pwojcikdev merged 1 commit intonanocurrency:developfrom
Conversation
cef1655 to
f131db8
Compare
Test Results for Commit 7eb4cd0Pull Request 5042: Results Test Case Results
Last updated: 2026-04-03 10:24:01 UTC |
There was a problem hiding this comment.
Pull request overview
Adds support for long-running store scans by allowing crawlers to refresh their underlying transaction and restore iterator position, plus iterator/crawler reset APIs and a new block_view::crawl() entry point.
Changes:
- Add
transaction::refresh()and implement transaction refresh + position restoration instore::crawler. - Add
reset()to backend iterators (lmdb/rocksdb), genericstore::iterator, andtyped_iteratorto release iterator resources. - Extend ledger views (
account,pending,block) withcrawl(transaction&)and add unit tests for rewind/reset/refresh behavior.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| nano/store/crawler.hpp | Adds transaction refresh + iterator position restoration; introduces rewind() and reset() semantics. |
| nano/store/transaction.hpp | Adds pure-virtual transaction::refresh() and overrides in read/write transactions. |
| nano/store/iterator.hpp | Refactors backend iterator variant into an alias and adds iterator::reset(). |
| nano/store/iterator.cpp | Implements iterator::reset() by releasing backend iterator state. |
| nano/store/typed_iterator.hpp | Exposes typed_iterator::reset(). |
| nano/store/typed_iterator_templ.hpp | Implements typed_iterator::reset(). |
| nano/store/lmdb/iterator.hpp | Adds lmdb::iterator::reset(). |
| nano/store/lmdb/iterator.cpp | Implements LMDB iterator reset by releasing the cursor. |
| nano/store/rocksdb/iterator.hpp | Adds rocksdb::iterator::reset(). |
| nano/store/rocksdb/iterator.cpp | Implements RocksDB iterator reset by releasing the underlying RocksDB iterator. |
| nano/store/ledger/account.hpp | Changes crawl to accept transaction& to allow refresh. |
| nano/store/ledger/account.cpp | Implements updated account_view::crawl(transaction&). |
| nano/store/ledger/pending.hpp | Changes crawl to accept transaction& to allow refresh. |
| nano/store/ledger/pending.cpp | Implements updated pending_view::crawl(transaction&). |
| nano/store/ledger/block.hpp | Adds block_view::crawler type + crawl(transaction&) declaration. |
| nano/store/ledger/block.cpp | Implements block_view::crawl(transaction&). |
| nano/secure/transaction.hpp | Adds non-const conversion operator to nano::store::transaction&. |
| nano/store/CMakeLists.txt | Removes now-empty typed_iterator.cpp from build. |
| nano/core_test/crawler.cpp | Updates tests for rewind/reset split and adds refresh coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
aef91a3 to
94e6245
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds support for refreshing long-lived store crawlers by refreshing the underlying transaction and re-establishing iterator position, enabling long-running scans without holding a transaction open indefinitely.
Changes:
- Added
nano::store::transaction::refresh()and wired it into read/write transactions. - Updated
nano::store::crawlerto be parameterized by transaction type and addedrefresh()/refresh_if_needed()plusrewind()(renamed fromreset()). - Updated ledger views (
account_view,pending_view,block_view) to expose templatedcrawl()returning the new crawler type, and added/updated unit tests.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| nano/store/typed_iterator.hpp | Minor namespace closing formatting. |
| nano/store/typed_iterator.cpp | Removed empty translation unit; no longer built. |
| nano/store/typed_iterator_templ.hpp | Minor formatting change. |
| nano/store/transaction.hpp | Adds virtual refresh() to transaction interface and overrides in read/write transactions. |
| nano/store/rocksdb/iterator.cpp | Minor namespace closing formatting fix. |
| nano/store/ledger/pending.hpp | Makes crawl() templated and returns new crawler type. |
| nano/store/ledger/pending.cpp | Removes non-templated crawl() definition. |
| nano/store/ledger/block.hpp | Adds crawl() for blocks and includes crawler header. |
| nano/store/ledger/account.hpp | Makes crawl() templated and returns new crawler type. |
| nano/store/ledger/account.cpp | Removes non-templated crawl() definition. |
| nano/store/iterator.hpp | Introduces backend_iterator alias and updates iterator ctor signature. |
| nano/store/iterator.cpp | Updates iterator ctor to use backend_iterator. |
| nano/store/crawler.hpp | Adds transaction refresh + iterator re-establishment, renames reset() to rewind(), templates on transaction type. |
| nano/store/CMakeLists.txt | Removes typed_iterator.cpp from build sources. |
| nano/secure/transaction.hpp | Adds mutable access/conversion to underlying store transaction. |
| nano/core_test/crawler.cpp | Updates tests for rewind() and adds refresh behavior tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
94e6245 to
7eb4cd0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Crawlers can now refresh their underlying transaction and re-establish iterator position, enabling long-running crawls without holding transactions open indefinitely. Also adds block_view::crawl() and reset() to iterators/crawlers.