spmc-logger
This is a single writer multi reader logger. If message x
is written to the logger, x
isn't dropped from the logger till y
number of readers have read it.
usage
// Eg. This means this logger will hold a maximum of 100 messages and will drop a single message when
// 3 readers have read it.
let l = new
// writing and reading
// Thread A
l.write
// Thread B
// message can be an error if more readers outside the quorum is trying to read a message.
// it can be none if we've read all the messages in the buffer and some if there is a message to be read.
// when the reader reads a message, it also has a `is_valid` key which tells us if the bytes have been
// malformed somewhere between the writing and reading. Think of it as an integrity hash.
match l.read
new
Example
The it_works
test in src/lib.rs
is a good example.