Skip to content

storage/admin: a 4 419-line LMDB module and helpers implemented twice #1213

Open

Description

@chappie-daemon

Measured on rewrite/main at ff045445.

  • crates/nostream-storage/src/lmdb/events.rs is 4,419 lines. Writes, retention, purge, filter planning, paging, counting and reconciliation live in one file, so a change to any one of them is a change to a file nobody can hold in their head, and the module's tests are one module's tests.
  • derive_from_secret exists twice, with different return types: nostream-relay/src/relay_key.rs:123 returns [u8; 32], nostream-services/src/payments/mod.rs:232 returns Vec<u8>. Same HMAC-SHA256 construction, two implementations, so a change to the derivation is a change in two places.
  • iso8601 exists twice in one crate: nostream-admin/src/state.rs:740 and nostream-admin/src/utils/nip05.rs:67.

Duplication here is not cosmetic: each copy is a place a fix can land and another can be missed, and the two derive_from_secrets return different types, which means they are not even interchangeable today.

Acceptance:

  • lmdb/events.rs is split by concern — writing, reading/paging, retention/purge, reconciliation — with the public surface unchanged, and the existing tests still pass against the new module boundaries without edits.
  • One derive_from_secret, in the crate both callers can depend on, with the [u8; 32] return and callers adapting at their own edge.
  • One iso8601 per crate, imported rather than redefined.

Activity

  1. added
    rewrite
    rust
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    rewriterust

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions