Struct ackr::Ackr
[−]
[src]
pub struct Ackr { /* fields omitted */ }
Track tuple acks across multiple tasks with minimal memory requirements. The algorithm is from the stream-processing system Storm.
The only allocation needed is two 64-bit values per task (task_id, ack value) and scales to 264 tuples.
To track a tuple, you call tuple
. The tuple's id will be XORed with the previous
ack value. As tuples are acked (marked as arbitrarily completed), the ack value will
once again be XORed. Once all tuples are acked/completed, the ack value will be 0.
Methods
impl Ackr
[src]
fn new() -> Ackr
Create a new Ackr with no buckets/tasks.
fn insert(&mut self, source_id: Source, task_id: Task)
Insert a new bucket entry with the Source id as the initial ack value.
fn add_tuple(&mut self, source_id: Source, tuple_id: Tuple)
Add a tuple to the Source's ack value. This is essentially just the first XOR.
fn ack(&mut self, source_id: Source, tuple_id: Tuple) -> Option<()>
XOR the ack value for a given Source and the result is the new ack value. Acking once adds the tuple to the Source, acking it twice removes it.
fn get(&mut self, source_id: Source) -> Tuple
fn has_completed(&mut self, source_id: Source) -> bool
Trait Implementations
impl PartialEq for Ackr
[src]
fn eq(&self, __arg_0: &Ackr) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Ackr) -> bool
This method tests for !=
.