Repository navigation
Description
Measured on rewrite/main at ff045445: crates/nostreamd/src/main.rs resolves the storage backend name, logs it, and then builds the relay over nostream_services::unavailable::stores() and nostream_relay::unavailable::stores(). The comment above the two lines says so plainly: the LMDB environment is a stub, so the wire is served in full and nothing is stored. crates/nostreamd/src/mcp_stdio.rs:78 composes the same empty bundle for the MCP door, so there are two sites, not one.
Where the wiring already exists
The pattern is not to be designed: the CLI already does it. crates/nostream-cli/src/store.rs has selected_backend(settings) (:65) reading the configured backend, Opened (:25-28) as the enum over LmdbBackend and PostgresBackend, accessors that hand out the repositories whatever answered (events :32, invites :40, invoices :48, users :56), and open() (:97) as the one match over the backend.
The gap is scope, measured: Opened exposes 4 repositories, while the two bundles the daemon needs cover 9 between them —
- relay
Stores(crates/nostream-relay/src/handlers/mod.rs:61-68): events, users, nip05, invites, dvm_jobs, reports - services
ServiceStores(crates/nostream-services/src/unavailable.rs:24-32): events, users, invoices, nip05, dvm_jobs, notification_outbox, notification_delivery_log
The five Opened does not expose are already implemented by both backends — nip05 (lmdb/mod.rs:893, postgres/repository.rs:249), dvm_jobs (lmdb/mod.rs:1012, postgres/repository.rs:308), reports (lmdb/mod.rs:1075, postgres/repository.rs:339), outbox (lmdb/mod.rs:1169, postgres/repository.rs:402), delivery log (lmdb/mod.rs:1122, postgres/repository.rs:372) — so the work is to expose them and compose the two bundles, not to write repositories.
Also in scope
- LMDB has no transaction type. The payments flow that needs
BEGIN ISOLATION LEVEL SERIALIZABLEisPostgresTransaction-only, so the same code path has no atomic equivalent on LMDB, and no crate doc flags it. user_subscriptionshas no repository trait. Nine of ten repositories are ported; the tenth is the subscriptions/payments surface.
Acceptance:
-
nostreamdboots on the LMDB backend and stores an event that a second process reads back after a restart. - The same on Postgres, from the same binary, selected by configuration rather than by rebuild.
-
--mcp-stdiocomposes the same wired stores as the relay door; neither path buildsunavailable::stores(). - The storage parity suite runs against the daemon's own composition, not only against the crate's seams.
- The payments write path either gets an LMDB transaction equivalent or refuses with a typed error naming the backend, and the limitation is written down where the flow is defined.
Activity
cameri commentedon Nov 21, 2026
One thing that makes this smaller than it looks: the wiring pattern already exists — the CLI does it.
crates/nostream-cli/src/store.rsopen()picks the backend throughselected_backend()(configured_backend), opensLmdbBackend::open(root)or Postgres, and hands the repositories out throughOpened. The daemon can follow that instead of designing the wiring from scratch.The gap is scope, not design.
Openedexposes 4 repositories (events, invites, invoices, users); the two bundles the daemon needs cover 9 between them — servicesServiceStores(events, users, invoices, nip05, dvm_jobs, notification_outbox, notification_delivery_log) and relayStores(handlers/mod.rs:61-68: events, users, nip05, invites, dvm_jobs, reports). The other five are already implemented by both backends (nip05:lmdb/mod.rs:893,postgres/repository.rs:249; dvm_jobs:lmdb/mod.rs:1012,postgres/repository.rs:308; reports:lmdb/mod.rs:1075,postgres/repository.rs:339; outbox:lmdb/mod.rs:1169,postgres/repository.rs:402; delivery log:lmdb/mod.rs:1122,postgres/repository.rs:372), so the remaining work is exposing them and composing the two bundles — plus the LMDB-transaction point already in the issue.chappie-daemon commentedon Nov 21, 2026
Verified all of it at
ff045445and folded it into the body, so whoever picks this up starts from the CLI's pattern rather than re-deriving it:Openedhas exactly four accessors —events :32,invites :40,invoices :48,users :56— overselected_backend :65andopen :97Storesis six (handlers/mod.rs:61-68), servicesServiceStoresis seven (unavailable.rs:24-32), union nineimpl Nip05VerificationRepository for LmdbBackendatlmdb/mod.rs:893andimpl ReportRepository for PostgresBackendatpostgres/repository.rs:339One addition: the daemon has a second composition point —
mcp_stdio.rs:78builds the sameunavailable::stores()bundle for the MCP door — so the acceptance now names both paths and fails if either one still composes an empty bundle. That also makes the parity test meaningful: it has to run through the daemon's own composition, because a crate's seams being green is exactly what let this gap survive three merged jobs.AgrimTawani commentedon Nov 28, 2026
Hey @cameri, I'd like to take this on next.
My approach would be:
Openedto expose all nine repositories and build both the relay and services store bundles from itmain.rsandmcp_stdio.rs, so neither one buildsunavailable::stores()anymorecameri commentedon Nov 28, 2026
@AgrimTawani Assigned to you
fix(nostreamd): serve from the store the settings name instead of an …
AgrimTawani commentedon Nov 29, 2026
Hey @cameri, the fix for this is ready on
AgrimTawani:fix/1206-daemon-real-stores(one commit, bb0b2d9, on the latestrewrite/main):nostream_storage::Repositories(nine handles over one opened backend, also behind the CLI'sOpenednow) feeds bothStoresandServiceStores;nostreamd --data-diropens it for the relay door and--mcp-stdioalike, and LMDB without the flag or an unreachable Postgres refuses to start instead of serving an empty store--mcp-stdiobeside a running relay is the case ADR 0012 D9 said would overturn it, soopenalso takes a file lock across the search-index check and rebuild (ADR amended); the payments write-path limitation is written onconfirm_invoice(three writes, no transaction, on either backend)store_wiringtarget publishes to one daemon and reads the event back from a second on LMDB and on Postgres (added to CI as "Daemon store against Postgres"); the MCP tests now prove real reads and writes; the five checks and the Postgres suites pass locallydocs(adr): 0014 records the wired store, and both compositions wired …
chappie-daemon commentedon Nov 29, 2026
Shipped in PR #1281, merged as
1514e7f2e84806f5e3320dbb03b536aa19aba7d7onrewrite/mainat 2026-11-29T14:42Z.Closesis inert because the base is not the repository's default branch, so this closes by hand.The daemon opens the store its settings name and hands the same nine repositories to both doors; LMDB without
--data-dirand an unreachable Postgres both refuse to start. Accepted throughput is no longer 0, so #868's benchmark gate and 72 h soak rows can measure.