Skip to content

feat: event-driven projector, connection pooling, async writes, handler registration, WriteBatch API#29

Merged
johnny-emp merged 4 commits intomainfrom
feat/event-driven-projector
Feb 13, 2026
Merged

feat: event-driven projector, connection pooling, async writes, handler registration, WriteBatch API#29
johnny-emp merged 4 commits intomainfrom
feat/event-driven-projector

Conversation

@johnny-emp
Copy link
Contributor

@johnny-emp johnny-emp commented Feb 13, 2026

Summary

  • Event-driven projector: FileEventLog fires tokio::sync::Notify after each successful append. Projector::run_continuous() and EventProcessor::run() now await the notification instead of blind-polling, giving near-zero-latency projection with zero CPU waste when idle. Falls back to poll_interval timeout as a safety net.
  • Projection read pool enabled by default: ProjectionConfig now creates a 4-connection read pool out of the box. Added projection_write_conn() / write_conn() for explicit write access; projection_connection() documented as deprecated.
  • Native async write API: LmdbCanonicalStore::submit_write() centralizes spawn_blocking + transaction lifecycle into a single closure-based method. Convenience wrappers async_put_state() and async_del_state() for common single-op writes. Exposed via AzothDb::submit_write().
  • Handler registration: EventProcessorBuilder::build_with_projection() opens a dedicated read-write SQLite connection to the projection DB automatically, removing the need for callers to pass one externally.
  • WriteBatch API: New WriteBatch struct for explicit multi-operation atomic commits with put(), delete(), append_event(), commit(), and commit_async(). Accessible via db.write_batch().

Test plan

  • cargo check passes across the full workspace
  • cargo test --workspace passes (all existing tests green, no regressions)
  • No linter errors on any modified files
  • Confirm read pool default doesn't break existing consumers that rely on disabled pool

johnny-emp and others added 2 commits February 13, 2026 17:56
…andler registration, and WriteBatch API

- Event-driven projector: FileEventLog fires tokio::sync::Notify after
  each append; Projector and EventProcessor await instead of polling,
  giving near-zero latency with zero idle CPU.
- Projection read pool enabled by default (4 connections); add
  projection_write_conn() for explicit write access.
- Native async write API: LmdbCanonicalStore::submit_write() centralizes
  spawn_blocking + txn lifecycle; convenience wrappers async_put_state
  and async_del_state.
- EventProcessorBuilder::build_with_projection() opens a dedicated
  connection to the projection DB, removing the need to pass one in.
- WriteBatch API for explicit multi-op atomic commits with commit_async
  support.

Co-authored-by: Cursor <cursoragent@cursor.com>
@johnny-emp johnny-emp changed the title feat: add event-driven projector, connection pooling, async writes, h… feat: event-driven projector, connection pooling, async writes, handler registration, WriteBatch API Feb 13, 2026
@johnny-emp johnny-emp merged commit ae3c2df into main Feb 13, 2026
8 checks passed
@johnny-emp johnny-emp deleted the feat/event-driven-projector branch February 13, 2026 23:31
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