From 2403f82dac7050e4c1c913fea7ce70907346ec76 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 13 Jan 2025 17:37:57 -0300 Subject: [PATCH] improve eventstore page. --- docs/core/eventstore.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/core/eventstore.md b/docs/core/eventstore.md index cd08932..1195bf4 100644 --- a/docs/core/eventstore.md +++ b/docs/core/eventstore.md @@ -2,14 +2,15 @@ outline: deep --- +# Event Storage + +Khatru doesn't make any assumptions about how you'll want to store events. Any function can be plugged in to the `StoreEvent`, `DeleteEvent`, `ReplaceEvent` and `QueryEvents` hooks. + +However the [`eventstore`](https://github.com/fiatjaf/eventstore) library has adapters that you can easily plug into `khatru`'s hooks. + # Using the `eventstore` library -The [`eventstore`](https://github.com/fiatjaf/eventstore) library has adapters that you can easily plug into `khatru`'s: - -* `StoreEvent` -* `DeleteEvent` -* `QueryEvents` -* `CountEvents` +The library includes many different adapters -- often called "backends" --, written by different people and with different levels of quality, reliability and speed. For all of them you start by instantiating a struct containing some basic options and a pointer (a file path for local databases, a connection string for remote databases) to the data. Then you call `.Init()` and if all is well you're ready to start storing, querying and deleting events, so you can pass the respective functions to their `khatru` counterparts. These eventstores also expose a `.Close()` function that must be called if you're going to stop using that store and keep your application open.