10 releases
0.0.10 | Aug 1, 2022 |
---|---|
0.0.9 | Aug 1, 2022 |
0.0.7 | Jul 31, 2022 |
#12 in #event-store
22KB
414 lines
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.
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
Dependencies
~225KB