pub struct Best {
pub addr: Addr,
pub score: u64,
}Expand description
The best victim seen so far in one round of sampling.
It holds an address rather than a key, which is what confines it to a single
round: an address is only good until the next write, and the caller deletes
the winner before it writes anything. Pool is the version that survives a
round, and it pays for that by holding bytes.
This is what the random policies use, because they have no ordering for a pool to approximate and every eligible key is already the answer.
Fields§
§addr: AddrWhere the winner is, or Addr::NONE if nothing eligible turned up.
score: u64Its score, meaningful only against another score under the same policy.
Implementations§
Source§impl Best
impl Best
Sourcepub fn offer(&mut self, addr: Addr, score: u64)
pub fn offer(&mut self, addr: Addr, score: u64)
Take this candidate if it beats what is held.
Strictly better and not as good, so a tie leaves the earlier one in place. That is what makes the random policies pick the first key sampled rather than the last, and under the other policies it means the pick does not wander between keys that are equally stale.