Struct accumulator::Accumulator [] [src]

pub struct Accumulator<K, V> where K: PartialOrd + Ord + Clone, V: Clone {
    // some fields omitted
}

Accumulator for various message types

Methods

impl<K: PartialOrd + Ord + Clone, V: Clone> Accumulator<K, V>
[src]

fn with_capacity(quorum: usize, capacity: usize) -> Accumulator<K, V>

Construct an accumulator and pass size to accumulate unil

fn with_duration(quorum: usize, duration: Duration) -> Accumulator<K, V>

Construct an accumulator and pass duration to accumulate until

fn contains_key(&self, name: &K) -> bool

Check for existence of any key

fn is_quorum_reached(&mut self, name: &K) -> bool

Check if requested size is accumulated

fn add(&mut self, key: K, value: V) -> Option<Vec<V>>

Add a key / value pair, returns key and vector of values if size reached if already reached then keep adding to this value (we cannot tell values are all valid)

fn get(&mut self, name: &K) -> Option<Vec<V>>

Retrieve a ky/value from the store

fn delete(&mut self, name: &K)

Remove an entry (all values for a key will be removed)

fn cache_size(&mut self) -> usize

Return size of container

fn set_quorum_size(&mut self, new_size: usize)

Sets new size for quorum