Yuki Kishimoto on Nostr: Nostr SDK now support in-memory and persistent storages. Currently are available the ...
Nostr SDK now support in-memory and persistent storages.
Currently are available the MemoryDatabase (RAM, by default store only the seen event ids but it's configurable to store the full events), RocksDB, SQLite and IndexedDB (for web apps).
It's possible to use custom database just implementing the NostrDatabase trait.
NostrDatabase trait provide some very generic methods, useful to improve the efficiency and performance of nostr apps, like: query events by filters, get user profile and get items for negentropy reconciliation.
If anyone is interested in testing new changes can find 2 examples in nostr-sdk crate (rocksdb.rs and sqlite.rs, more docs coming soon) and 1 example in nostr-indexeddb crate. Let me know if there are issues.
https://github.com/rust-nostr/nostr/blob/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-database/src/lib.rs#L88
https://github.com/rust-nostr/nostr/tree/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-indexeddb/examples/webapp
https://github.com/rust-nostr/nostr/blob/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-sdk/examples/sqlite.rs
Currently are available the MemoryDatabase (RAM, by default store only the seen event ids but it's configurable to store the full events), RocksDB, SQLite and IndexedDB (for web apps).
It's possible to use custom database just implementing the NostrDatabase trait.
NostrDatabase trait provide some very generic methods, useful to improve the efficiency and performance of nostr apps, like: query events by filters, get user profile and get items for negentropy reconciliation.
If anyone is interested in testing new changes can find 2 examples in nostr-sdk crate (rocksdb.rs and sqlite.rs, more docs coming soon) and 1 example in nostr-indexeddb crate. Let me know if there are issues.
https://github.com/rust-nostr/nostr/blob/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-database/src/lib.rs#L88
https://github.com/rust-nostr/nostr/tree/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-indexeddb/examples/webapp
https://github.com/rust-nostr/nostr/blob/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-sdk/examples/sqlite.rs