Trait foca::Invalidates
source · [−]pub trait Invalidates {
fn invalidates(&self, other: &Self) -> bool;
}Expand description
A type that’s able to look at another and decide wether it’s newer/fresher (i.e. invalidates) than it.
As you send/receive broadcasts, Foca will hold them for a while as it disseminates the data to other cluster members. This trait helps with replacing data that hasn’t been fully disseminated yet but you already know it’s stale.
Example: Assume a versioned broadcast like {key,version,...};
After you receive {K, 0, ...} and keep it, Foca will be
disseminating it. Soon after you receive {K, 1, ...} which
is a newer version for this broadcast. This trait enables
Foca to immediately stop disseminating the previous version,
even if it hasn’t sent it to everyone it can yet.
Required Methods
fn invalidates(&self, other: &Self) -> bool
fn invalidates(&self, other: &Self) -> bool
When item.invalidates(&other) it means that Foca will
keep item and discard other from its dissemination
backlog.