15 stable releases

2.3.0 Jul 21, 2021
2.2.4 Mar 26, 2021
2.2.3 Jan 15, 2021
2.2.1 Oct 5, 2020
0.1.0 Aug 22, 2019

#116 in Database implementations

Download history 139/week @ 2021-04-09 144/week @ 2021-04-16 139/week @ 2021-04-23 88/week @ 2021-04-30 140/week @ 2021-05-07 198/week @ 2021-05-14 113/week @ 2021-05-21 71/week @ 2021-05-28 98/week @ 2021-06-04 80/week @ 2021-06-11 93/week @ 2021-06-18 72/week @ 2021-06-25 71/week @ 2021-07-02 51/week @ 2021-07-09 111/week @ 2021-07-16 69/week @ 2021-07-23

434 downloads per month

Apache-2.0

750KB
5K SLoC

Rust 4K SLoC // 0.1% comments JavaScript 637 SLoC // 0.4% comments

Build Status Crates.io Documentation #seshat

Seshat

Seshat is a database and indexer for Matrix events.

Its main use is to be used as a full text search backend for Matrix clients.

JavaScript bindings

Seshat provides JavaScript bindings which can be found in the seshat-node subdir.

Usage

There are two modes of operation for Seshat, adding live events as they come in:

use seshat::{Database, Event, Profile};
use tempfile::tempdir;

let tmpdir = tempdir().unwrap();
let mut db = Database::new(tmpdir.path()).unwrap();

/// Method to call for every live event that gets received during a sync.
fn add_live_event(event: Event, profile: Profile, database: &Database) {
    database.add_event(event, profile);
}
/// Method to call on every successful sync after live events were added.
fn on_sync(database: &mut Database) {
    database.commit().unwrap();
}

The other mode is to add events from the room history using the /room/{room_id}/messages Matrix API endpoint. This method supports storing checkpoints which remember the arguments to continue fetching events from the /room/{room_id}/messages API:

database.add_historic_events(events, old_checkpoint, new_checkpoint)?;

Once events have been added a search can be done:

let result = database.search("test", &SearchConfig::new()).unwrap();

Dependencies

~28MB
~497K SLoC