Skip to content
/ stroming Public

Traits for a stream store, and an in-memory implementation.

Notifications You must be signed in to change notification settings

hgrsd/stroming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages