Crates.io | stroming |
lib.rs | stroming |
version | 0.0.10 |
source | src |
created_at | 2022-07-30 23:55:13.732945 |
updated_at | 2022-08-01 16:29:36.30826 |
description | Traits for a stream store, with an in-memory implementation. |
homepage | |
repository | https://github.com/hgrsd/stroming |
max_upload_size | |
id | 635856 |
size | 21,699 |
A set of traits for reading from and writing to a stream store, together with an in-memory implementation. This project is mostly academic.
[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");
MIT