20 stable releases (3 major)

3.0.0 Apr 21, 2023
2.4.0 Apr 17, 2023
2.3.3 Jan 24, 2022
2.3.0 Jul 21, 2021
0.1.0 Aug 22, 2019

#319 in Database interfaces

Download history 208/week @ 2024-01-02 172/week @ 2024-01-09 203/week @ 2024-01-16 159/week @ 2024-01-23 280/week @ 2024-01-30 232/week @ 2024-02-06 382/week @ 2024-02-13 367/week @ 2024-02-20 330/week @ 2024-02-27 340/week @ 2024-03-05 381/week @ 2024-03-12 224/week @ 2024-03-19 211/week @ 2024-03-26 313/week @ 2024-04-02 218/week @ 2024-04-09 265/week @ 2024-04-16

1,026 downloads per month

Apache-2.0

670KB
4K SLoC

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();

Development

Seshat uses standard cargo commands build and test.

You can install pre-commit and then pre-commit install to ensure your work is linted on commit.

Dependencies

~41–55MB
~855K SLoC