Skip to content

feat(engine): add PersistenceGate and expose on RpcHandle#23590

Closed
decofe wants to merge 5 commits into
mainfrom
joshie/persistence-gate
Closed

feat(engine): add PersistenceGate and expose on RpcHandle#23590
decofe wants to merge 5 commits into
mainfrom
joshie/persistence-gate

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented Apr 16, 2026

Adds PersistenceGate, a shared gate that suppresses new persistence cycles during latency-critical windows (e.g. block proposal on fast-block-time chains).

RpcHandle.persistence_gate.set_enabled(false) causes should_persist() to return false, preventing new SaveBlocks from being dispatched. In-flight persistence is unaffected. Defaults to true.

Also refactors build_engine_orchestrator to accept a PersistenceHandle directly instead of spawning it internally.

Adds a persistence gate to PersistenceHandle so external callers can
suppress new persistence cycles during latency-critical windows (e.g.
block proposal on fast-block-time chains).

PersistenceHandle::set_persistence_enabled(false) causes
should_persist() to return false, preventing new SaveBlocks from being
dispatched. In-flight persistence is unaffected. Defaults to true.

Co-Authored-By: joshieDo <93316087+joshieDo@users.noreply.github.com>
Co-Authored-By: Georgios Konstantopoulos <17802178+gakonst@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d961d-12d6-73da-9a80-f732efbbd314
@decofe decofe force-pushed the joshie/persistence-gate branch from 3a6a81b to 8f18164 Compare April 16, 2026 12:25
@decofe decofe changed the title feat(engine): add persistence gate to EngineApiTreeHandler feat(engine): add persistence gate to PersistenceHandle Apr 16, 2026
Comment thread crates/engine/tree/src/tree/mod.rs Outdated
decofe and others added 4 commits April 16, 2026 12:32
Co-Authored-By: joshieDo <93316087+joshieDo@users.noreply.github.com>
Co-Authored-By: Georgios Konstantopoulos <17802178+gakonst@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d961d-12d6-73da-9a80-f732efbbd314
Introduces PersistenceGate, a shared gate that controls whether the
engine tree handler starts new persistence cycles. Exposed on RpcHandle
so external consumers (e.g. Tempo) can pause/resume persistence via
set_persistence_enabled()/is_persistence_enabled().

Also refactors build_engine_orchestrator to accept a PersistenceHandle
directly instead of spawning it internally, removing three parameters
and simplifying the return type.

Amp-Thread-ID: https://ampcode.com/threads/T-019d96a7-4bee-7528-8c27-75b8d57f247d
Co-authored-by: Amp <amp@ampcode.com>
@joshieDo joshieDo changed the title feat(engine): add persistence gate to PersistenceHandle feat(engine): add PersistenceGate and expose on RpcHandle Apr 16, 2026
@joshieDo joshieDo added A-db Related to the database A-engine Related to the engine implementation labels Apr 16, 2026
@joshieDo joshieDo marked this pull request as ready for review April 16, 2026 15:14
@joshieDo joshieDo requested a review from klkvr as a code owner April 16, 2026 15:14
@joshieDo joshieDo closed this Apr 17, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Reth Tracker Apr 17, 2026
@emmajam emmajam deleted the joshie/persistence-gate branch May 1, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-db Related to the database A-engine Related to the engine implementation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants