PrimalHQ / primal-caching-service

Primal’s caching service for Nostr connects to the specified set of relays, collects all events in real time, stores them locally, and makes them available to nostr clients through a web socket-based API.
https://primal.net
MIT License
85 stars 13 forks source link

Question: Does this store events in SQLite? #8

Closed alexgleason closed 9 months ago

alexgleason commented 1 year ago

I'm trying to understand this code. I see SQLite being used. Is that really the main data store? You're indexing almost the entirety of Nostr with SQLite? If so, how?

pritk commented 1 year ago

Is that really the main data store?

yes, sqlite is the main data store. all supported nostr events are imported into a number of sqlite DB files.

structure of tables: https://github.com/PrimalHQ/primal-caching-service/blob/9ecb8718b4133d90a786e57a62d97a0991e95eab/src/cache_storage.jl#L206-L376

main event import function: https://github.com/PrimalHQ/primal-caching-service/blob/9ecb8718b4133d90a786e57a62d97a0991e95eab/src/cache_storage.jl#L704

alexgleason commented 9 months ago

Thank you, very awesome design!