stroming

Crates.iostroming
lib.rsstroming
version0.0.10
sourcesrc
created_at2022-07-30 23:55:13.732945
updated_at2022-08-01 16:29:36.30826
descriptionTraits for a stream store, with an in-memory implementation.
homepage
repositoryhttps://github.com/hgrsd/stroming
max_upload_size
id635856
size21,699
Daniƫl (hgrsd)

documentation

README

Stroming

A set of traits for reading from and writing to a stream store, together with an in-memory implementation. This project is mostly academic.

View docs View crate

Use

[dependencies]
stroming = "0.0.10"
let mut store = MemoryStreamStore::new();
let data = r#"{"test": "data"}"#.as_bytes().to_vec();
let msg = Message {
    message_type: "TestMessage".to_owned(),
    data,
    metadata: vec![],
};

let _ = store.write_to_stream("TestStream-1", StreamVersion::NoStream, &[msg]);

let (version, messages) = store.read_from_stream("TestStream-1", ReadDirection::Forwards);

assert_eq!(version, StreamVersion::Revision(0));
assert_eq!(messages.len(), 1);
assert_eq!(messages[0].message_type, "TestMessage");

License

MIT

Commit count: 32

cargo fmt