this commit also remove all the sonic envelope parsing and reintroduces filters in REQ as a slice instead of as a singleton. why? well, the sonic stuff wasn't really that fast, it was a little bit but only got fast enough once I introduced unsafe conversions between []byte and string and did weird unsafe reuse of []byte in order to save the values of tags, which would definitely cause issues in the future if the caller wasn't aware of it (and even if they were, like myself). and the filters stuff is because we abandoned the idea of changing NIP-01 to only accept one filter per REQ.
eventstore
A collection of reusable database connectors, wrappers and schemas that store Nostr events and expose a simple Go interface:
type Store interface {
// Init is called at the very beginning by [Server.Start], after [Relay.Init],
// allowing a storage to initialize its internal resources.
Init() error
// Close must be called after you're done using the store, to free up resources and so on.
Close()
// QueryEvents is invoked upon a client's REQ as described in NIP-01.
// it should return a channel with the events as they're recovered from a database.
// the channel should be closed after the events are all delivered.
QueryEvents(context.Context, nostr.Filter) (chan *nostr.Event, error)
// DeleteEvent is used to handle deletion events, as per NIP-09.
DeleteEvent(context.Context, *nostr.Event) error
// SaveEvent is called once Relay.AcceptEvent reports true.
SaveEvent(context.Context, *nostr.Event) error
}
command-line tool
There is an eventstore command-line tool that can be used to query these databases directly.