Skip to content

wip: introduce postgres db as storage#75

Draft
zdravko61 wants to merge 20 commits intoTHCLab:masterfrom
VereignAG:feat/pg-db
Draft

wip: introduce postgres db as storage#75
zdravko61 wants to merge 20 commits intoTHCLab:masterfrom
VereignAG:feat/pg-db

Conversation

@zdravko61
Copy link

Adds an optional PostgreSQL storage backend for both keri-core and teliox, gated behind a postgres-backend feature flag.

What's included

  • keri-core: PostgresDatabase implementing EventDatabase, LogDatabase, escrow, KSN log, and OOBI storage — backed by sqlx with migrations
  • teliox: PostgresLogDatabase implementing TEL-specific log and receipt storage
  • OobiManager generalized to support both ReDB and Postgres backends via OobiStorageBackend trait
  • SimpleController generalized over OOBI storage backend
  • EventStorage refactored to support Option<MailboxData> for Postgres compatibility

Notes

This overlaps in scope with PR #69 which introduces a similar storage abstraction. Coordination may be needed to align trait interfaces and feature flag conventions before merging either.

Remaining

  • B2: Make KnownEvents generic over D, T, S (known_events.rs)
  • B3: Make Controller generic (controller/mod.rs)
  • B4: Make Identifier generic (identifier/mod.rs)
  • B5: Thread generics through mechanics modules

build was failing with rust 1.85, with around 20+ errors, added batch on
two deps in order to make the build work with 1.85, it does work with
latest version now too.
- Add location_oobis and end_role_oobis tables to migrations
- Introduce OobiStorageBackend trait for pluggable storage
- Refactor OobiManager to be generic over storage backend
- Implement RedbOobiStorage as default backend
- Update methods to use new trait and error handling

Signed-off-by: Zdravko Iliev <zdravko.iliev@vereign.com>
- Implement PostgresOobiStorage as an OOBI storage backend
- Make SimpleController and OobiManager generic over OOBI storage
- Add test for SimpleController with Postgres backend
- Preserve backward compatibility with RedbOobiStorage

Signed-off-by: Zdravko Iliev <zdravko.iliev@vereign.com>
- Refactor EventStorage to support Option<MailboxData> for Postgres
- Implement log_event for PostgresLogDatabase
- Add log_event_with_tx for transactional event logging
- Implement get_from_sn for PostgresSnKeyEscrow
- Add update_key_state and save_to_kel for PostgresDatabase
- Update tests to handle mailbox_data as Option
- Adjust trait bounds for OobiManager and process_reply

Signed-off-by: Zdravko Iliev <zdravko.iliev@vereign.com>
event retrieval methods

Signed-off-by: Zdravko Iliev <zdravko.iliev@vereign.com>
Signed-off-by: Zdravko Iliev <zdravko.iliev@vereign.com>
Signed-off-by: Zdravko Iliev <zdravko.iliev@vereign.com>
Signed-off-by: Zdravko Iliev <zdravko.iliev@vereign.com>
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