Pds: provide a persistent store package (ATProtoNet.Pds.EntityFrameworkCore) for IAccountStore/IRepoStore #38

Open
opened 2026-06-10 22:46:51 +00:00 by Grandiras · 0 comments
Owner

ATProtoNet.Pds ships only InMemoryAccountStore / InMemoryRepoStore — fine for development, but every production consumer has to hand-roll persistent IAccountStore/IRepoStore implementations.

For Updraft we wrote Postgres-backed stores over EF Core (DbAccountStore, DbRepoStore in https://git.grandiras.net/Grandiras/Updraft, src/Updraft.Pds/Stores) — entities mirroring PdsAccount/RepoRecord/RepoBlob, cursor pagination on rkey, content-addressed blob dedup.

Suggestion: an ATProtoNet.Pds.EntityFrameworkCore package (parallel to the existing ATProtoNet.Server.EntityFrameworkCore token store): a PdsDbContext (or model-configuration hook for an existing context), EF-backed store implementations, and an AddAtProtoPdsEfCoreStores<TContext>() registration. Our implementation can serve as a starting point.

One design note from our build: if columns like handle/email are encrypted at rest with a non-deterministic scheme, equality lookups (GetByHandleAsync) must happen in memory — worth keeping the store contract documented as "implementations may load-and-filter".

`ATProtoNet.Pds` ships only `InMemoryAccountStore` / `InMemoryRepoStore` — fine for development, but every production consumer has to hand-roll persistent `IAccountStore`/`IRepoStore` implementations. For Updraft we wrote Postgres-backed stores over EF Core (`DbAccountStore`, `DbRepoStore` in https://git.grandiras.net/Grandiras/Updraft, src/Updraft.Pds/Stores) — entities mirroring `PdsAccount`/`RepoRecord`/`RepoBlob`, cursor pagination on rkey, content-addressed blob dedup. Suggestion: an `ATProtoNet.Pds.EntityFrameworkCore` package (parallel to the existing `ATProtoNet.Server.EntityFrameworkCore` token store): a `PdsDbContext` (or model-configuration hook for an existing context), EF-backed store implementations, and an `AddAtProtoPdsEfCoreStores<TContext>()` registration. Our implementation can serve as a starting point. One design note from our build: if columns like handle/email are encrypted at rest with a non-deterministic scheme, equality lookups (`GetByHandleAsync`) must happen in memory — worth keeping the store contract documented as "implementations may load-and-filter".
Sign in to join this conversation.
No description provided.