Package it.unimi.dsi.law.util
Interface ConsistentHashFunction.SkipStrategy<T>
- Enclosing class:
- ConsistentHashFunction<T extends Comparable<? super T>>
public static interface ConsistentHashFunction.SkipStrategy<T>
Allows to skip suitable items when searching for the closest replica.
Sometimes it is useful to restrict the set of buckets that can be returned without
modifying a consistent hash function (if not else, because any change requires removing or
adding ConsistentHashFunction.REPLICAE_PER_BUCKET
replicae).
To do so, it is possible to
provide at construction time a strategy that, at each call to
ConsistentHashFunction.hash(long)
, will be used to test whether the bucket of a
certain replica can be returned or not. Of course, in the latter case the search will
continue with the next replica.
-
Method Summary
Modifier and Type Method Description boolean
isSkippable(T bucket)
Checks whether a bucket can be returned or should be skipped.
-
Method Details
-
isSkippable
Checks whether a bucket can be returned or should be skipped.- Parameters:
bucket
- the bucket to test.- Returns:
- true if the bucket should be skipped.
-