Expand description
Flat Event Storage Module
This module provides the generic event storage layer aligned with Nostr’s protocol model. All events (messages, reactions, attachments, etc.) are stored as flat rows in the database, with relationships computed at query/render time.
§Architecture
┌─────────────────────────────────────────────────────────────────┐
│ STORAGE LAYER (this module) │
│ - Stores raw events as-is, including unknown types │
│ - Schema: id, kind, content, tags, timestamp, pubkey, etc. │
│ - Can sync/store events Vector doesn't understand yet │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ PROCESSING LAYER (rumor.rs) │
│ - Transforms raw events → typed structs │
│ - Unknown kind? → UnknownEvent (renders as placeholder) │
│ - New event type = add enum variant + processing logic │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ DISPLAY LAYER (message.rs - unchanged) │
│ - Message, Reaction, Attachment, etc. │
│ - Standardized interface for UI rendering │
│ - Materialized views: compose events → Message with reactions │
└─────────────────────────────────────────────────────────────────┘§Benefits
- Protocol alignment: Matches Nostr’s event-centric model
- Future-proof: Unknown event types are stored, not dropped
- Easy extensibility: New event types need no schema changes
- Uniform storage: DMs, community channels, and public events all stored the same way
Modules§
- event_
kind - Nostr event kinds used in Vector
Structs§
- Stored
Event - A stored event - the flat, protocol-aligned storage format
- Stored
Event Builder - Builder for creating StoredEvent from rumor processing
Enums§
- System
Event Type - System event types for group member changes (stored as integers).