Add SQLite event store implementation#502
Conversation
…ory, and extensions - Add Microsoft.Data.Sqlite 9.0.6 to Directory.Packages.props - Make SqlEventStoreBase.AppendEvents virtual for SQLite override - Promote _serializer/_metaSerializer to protected properties (Serializer/MetaSerializer) - Create Eventuous.Sqlite project with .csproj, Schema.cs, ConnectionFactory.cs, SqliteExtensions.cs - Add SQLite DDL schema script with streams, messages, and checkpoints tables Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement SqliteStore extending SqlEventStoreBase<SqliteConnection, SqliteTransaction> with SQLite-specific logic. Since SQLite has no stored procedures, the AppendEvents method is overridden directly with C# logic for stream creation, version validation, event insertion with RETURNING global_position, and stream version update. Includes read forward/backward queries using JOIN, stream existence check, and truncation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…re, and projector for SQLite Implements the remaining infrastructure for the SQLite event store: - SchemaInitializer: hosted service for database schema creation on startup - RegistrationExtensions: DI registration for SqliteStore, SchemaInitializer, and checkpoint store - SqliteSubscriptionBase: base class for SQLite polling subscriptions - SqliteAllStreamSubscription: subscription for all events across streams - SqliteStreamSubscription: subscription for events in a single stream - SqliteCheckpointStore: checkpoint persistence in SQLite - SqliteProjector: base class for SQLite read model projections - SqliteConnectionOptions: connection configuration record Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create Eventuous.Tests.Sqlite with: - SqliteStoreFixtureBase: Docker-free fixture using temp SQLite files - Store tests (Append, Read, OtherMethods) inheriting from base classes - Subscription tests (SubscribeToAll, SubscribeToStream) with custom fixture - Registration tests for DI container resolution - Parallel limiter for test execution Fix base class issues for SQLite compatibility: - Change StoreFixtureBase.EventStore setter to protected (was private protected) - Use Convert.ToBoolean in SqlEventStoreBase.StreamExists for SQLite int returns - Add InternalsVisibleTo for Eventuous.Tests.Sqlite in Persistence project - Fix SqliteStore version mismatch message to include WrongExpectedVersion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test Results 60 files + 41 60 suites +41 34m 52s ⏱️ + 23m 41s Results for commit 4f90f5c. ± Comparison against base commit 3c727b3. This pull request removes 5 and adds 36 tests. Note that renamed tests count towards both. |
There was a problem hiding this comment.
Pull request overview
Adds a new SQLite-backed Eventuous event store implementation (store + subscriptions + checkpointing + schema init + DI extensions) and introduces corresponding SQLite test coverage, plus small base-class tweaks to support SQLite’s non-stored-procedure append path and cross-DB boolean handling.
Changes:
- Introduce
Eventuous.Sqlitepackage with schema creation, event store, subscriptions (all/stream), checkpoint store, and projector base. - Add DI registration extensions and a hosted schema initializer (optional init on startup).
- Add a new SQLite test project with store/subscription/registration tests and fixture infrastructure; adjust
SqlEventStoreBaseandStoreFixtureBasevisibility/virtualization to enable overrides.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Sqlite/test/Eventuous.Tests.Sqlite/Subscriptions/SubscriptionFixture.cs | New SQLite subscription fixture wiring DI + schema init + temp DB lifecycle for tests |
| src/Sqlite/test/Eventuous.Tests.Sqlite/Subscriptions/SubscribeTests.cs | New tests for all-stream and per-stream SQLite subscriptions + checkpoint behavior |
| src/Sqlite/test/Eventuous.Tests.Sqlite/Store/StoreTests.cs | Hooks SQLite store into shared store conformance test suites |
| src/Sqlite/test/Eventuous.Tests.Sqlite/Store/StoreFixture.cs | Registers SQLite store in test DI container using SQLite fixture base |
| src/Sqlite/test/Eventuous.Tests.Sqlite/Registrations/RegistrationTests.cs | Verifies DI registration paths resolve the SQLite store correctly |
| src/Sqlite/test/Eventuous.Tests.Sqlite/Limiter.cs | Limits SQLite test parallelism to reduce file/db contention |
| src/Sqlite/test/Eventuous.Tests.Sqlite/Fixtures/SqliteStoreFixtureBase.cs | Base fixture for SQLite store tests using temp DB files and hosted schema init |
| src/Sqlite/test/Eventuous.Tests.Sqlite/Eventuous.Tests.Sqlite.csproj | New SQLite test project referencing SQLite package and shared test infrastructure |
| src/Sqlite/src/Eventuous.Sqlite/Subscriptions/SqliteSubscriptionBase.cs | Base subscription implementation for SQLite (connection mgmt + EOS queries) |
| src/Sqlite/src/Eventuous.Sqlite/Subscriptions/SqliteStreamSubscription.cs | Stream subscription implementation (stream id bootstrap + page reads) |
| src/Sqlite/src/Eventuous.Sqlite/Subscriptions/SqliteCheckpointStore.cs | SQLite-backed checkpoint store implementation |
| src/Sqlite/src/Eventuous.Sqlite/Subscriptions/SqliteAllStreamSubscription.cs | All-stream subscription implementation (global position paging) |
| src/Sqlite/src/Eventuous.Sqlite/SqliteStore.cs | SQLite event store implementation with overridden append path |
| src/Sqlite/src/Eventuous.Sqlite/Scripts/1_Schema.sql | Embedded schema script for SQLite tables and indexes |
| src/Sqlite/src/Eventuous.Sqlite/SchemaInitializer.cs | Hosted service to initialize schema on startup (optional) |
| src/Sqlite/src/Eventuous.Sqlite/Schema.cs | Schema/table naming + embedded script execution for schema creation |
| src/Sqlite/src/Eventuous.Sqlite/Projections/SqliteProjector.cs | Projector base to write read models to SQLite via commands |
| src/Sqlite/src/Eventuous.Sqlite/Projections/SqliteConnectionOptions.cs | Options record for projection/subscription/store connection + schema |
| src/Sqlite/src/Eventuous.Sqlite/Extensions/SqliteExtensions.cs | Helpers to create text commands and add parameters |
| src/Sqlite/src/Eventuous.Sqlite/Extensions/RegistrationExtensions.cs | DI extensions for SQLite store, schema init, and checkpoint store |
| src/Sqlite/src/Eventuous.Sqlite/Eventuous.Sqlite.csproj | New SQLite library project, dependencies, and embedded schema resource |
| src/Sqlite/src/Eventuous.Sqlite/ConnectionFactory.cs | SQLite connection factory enabling WAL mode |
| src/Relational/src/Eventuous.Sql.Base/SqlEventStoreBase.cs | Base store adjustments: serializer visibility, virtual append, bool conversion |
| src/Core/test/Eventuous.Tests.Persistence.Base/Fixtures/StoreFixtureBase.cs | Fixture setter visibility change to support derived fixtures |
| src/Core/src/Eventuous.Persistence/Eventuous.Persistence.csproj | Expose internals to new SQLite test assembly |
| Eventuous.slnx | Add SQLite projects to solution structure |
| Directory.Packages.props | Add central package version entry for Microsoft.Data.Sqlite |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Sqlite/test/Eventuous.Tests.Sqlite/Subscriptions/SubscriptionFixture.cs
Show resolved
Hide resolved
src/Sqlite/src/Eventuous.Sqlite/Subscriptions/SqliteStreamSubscription.cs
Show resolved
Hide resolved
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f90f5cf84
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ⓘ Your monthly quota for Qodo has expired. Upgrade your plan ⓘ Paying users. Check that your Qodo account is linked with this Git user account |
2 similar comments
ⓘ Your monthly quota for Qodo has expired. Upgrade your plan ⓘ Paying users. Check that your Qodo account is linked with this Git user account |
ⓘ Your monthly quota for Qodo has expired. Upgrade your plan ⓘ Paying users. Check that your Qodo account is linked with this Git user account |
Summary
Eventuous.Sqlitepackage — a full SQLite-based event store implementation for embedded/local appsSqlEventStoreBase<SqliteConnection, SqliteTransaction>fromEventuous.Sql.Base, following the same patterns as PostgreSQL and SQL Server implementationsMicrosoft.Data.SqliteADO.NET provider with WAL mode enabled by defaultBase class changes
SqlEventStoreBase.AppendEvents— madevirtual(SQLite overrides it since it can't use stored procedures)SqlEventStoreBase.Serializer/MetaSerializer— madeprotected(wereprivate readonly)SqlEventStoreBase.StreamExists— usesConvert.ToBoolean()for cross-DB compatibility (SQLite returnslong0/1, notbool)StoreFixtureBase.EventStoresetter —protected set(wasprotected private set)SQLite-specific design decisions
eventuous_streams,eventuous_messages) instead of SQL schema namespacesRETURNING global_positionIsTransientalways returnsfalse(embedded DB, no network errors)Test plan
🤖 Generated with Claude Code