Skip to content

Comments

feat: abstract NotificationBus for swappable dispatch#70

Open
seriouscoderone wants to merge 2 commits intoTHCLab:masterfrom
seriouscoderone:feat/swappable-notification-dispatch
Open

feat: abstract NotificationBus for swappable dispatch#70
seriouscoderone wants to merge 2 commits intoTHCLab:masterfrom
seriouscoderone:feat/swappable-notification-dispatch

Conversation

@seriouscoderone
Copy link

Summary

  • Replace concrete HashMap-based NotificationBus with a trait-based dispatch architecture (Arc<dyn NotificationDispatch>)
  • Enables alternative notification backends (e.g. SQS for serverless Lambda) without adding generic type parameters anywhere in the codebase
  • All register_observer methods now take &self instead of &mut self (interior mutability via RwLock)

Design

NotificationBus is now a Clone-able newtype wrapper. Internally it delegates to InProcessDispatch (preserving current behavior) or any custom NotificationDispatch implementation via NotificationBus::from_dispatch().

Changes

  • notification.rs: NotificationDispatch trait, InProcessDispatch struct, refactored NotificationBus wrapper
  • error/mod.rs: Added RwLockingError variant
  • mod.rs / basic_processor.rs / witness_processor.rs: &mut self&self on register_observer
  • escrow/mod.rs, witness.rs, controller, watcher: Removed unnecessary mut bindings
  • 12 test files: Removed mut from processor bindings

What does NOT change

  • Notifier trait signature
  • Notification / JustNotification enums
  • Any escrow implementation code
  • TelNotificationBus (teliox)
  • No new generic type parameters

Test plan

  • cargo check --all-features compiles
  • cargo check --package keri-core --no-default-features --features query compiles (no redb)
  • cargo test --all-features — all 120+ tests pass

🤖 Generated with Claude Code

seriouscoderone and others added 2 commits February 18, 2026 17:47
…tecture

Gate redb behind `storage-redb` feature flag (default ON) in keri-core and
teliox so the core protocol logic can compile and run without redb. This
enables future alternative storage backends (e.g., DynamoDB for serverless).

Key changes:
- Split EventStorage constructors: generic `new()` (no mailbox) vs
  `new_redb()` (RedbDatabase with mailbox) vs `new_with_mailbox()` (inject)
- Make mailbox_data an Option<MailboxData> to support non-redb backends
- Remove Any bound from EventValidator
- Gate TelLogDatabase, teliox EscrowDatabase, and escrow module behind
  storage-redb feature
- Genericize teliox escrow structs over K: EventDatabase for KEL storage
- Add in-memory MemoryDatabase implementing all database traits for
  validation and testing
- Move rkyv_adapter to database::rkyv_adapter (not under database::redb)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the concrete HashMap-based NotificationBus with a trait-based
dispatch architecture. NotificationBus is now a Clone-able wrapper around
Arc<dyn NotificationDispatch>, enabling alternative notification backends
(e.g. SQS for serverless) without adding generic type parameters anywhere
in the codebase.

- Add NotificationDispatch trait with dispatch() and register_observer()
- Extract current HashMap logic into InProcessDispatch (RwLock + OnceLock)
- Add NotificationBus::from_dispatch() for custom implementations
- Change register_observer from &mut self to &self across all processors
- Add RwLockingError variant to keri-core Error enum

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@seriouscoderone seriouscoderone force-pushed the feat/swappable-notification-dispatch branch from 495e705 to 75c8a50 Compare February 19, 2026 03:50
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