Struct kismet_cache::ReadOnlyCacheBuilder [−][src]
pub struct ReadOnlyCacheBuilder { /* fields omitted */ }Expand description
Construct a ReadOnlyCache with this builder. The resulting
cache will access each constituent cache directory in the order
they were added.
The default builder is a fresh builder with no constituent cache and no consistency check function.
Implementations
pub fn consistency_checker(
self,
checker: impl Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe + Sized + 'static
) -> Self
pub fn consistency_checker(
self,
checker: impl Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe + Sized + 'static
) -> Self
Sets the consistency checker function: when the function is
provided, the ReadOnlyCache will keep searching after the
first cache hit, and compare subsequent hits with the first
one by calling checker. The checker function should
return Ok(()) if the two files are compatible (identical),
and Err otherwise.
Kismet will propagate the error on mismatch.
Removes the consistency checker function, if any.
pub fn arc_consistency_checker(
self,
checker: Option<Arc<dyn Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe>>
) -> Self
pub fn arc_consistency_checker(
self,
checker: Option<Arc<dyn Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe>>
) -> Self
Sets the consistency checker function. None clears the
checker function. See
ReadOnlyCacheBuilder::consistency_checker.
Adds a new cache directory at path to the end of the cache
builder’s search list.
Adds a plain cache directory if num_shards <= 1, and an
actual sharded directory otherwise.
Adds a new plain cache directory at path to the end of the
cache builder’s search list. A plain cache directory is
merely a directory of files where the files’ names match their
key’s name.
Adds a new sharded cache directory at path to the end of the
cache builder’s search list.
Returns a fresh ReadOnlyCache for the builder’s search list
of constituent cache directories.
Trait Implementations
Returns the “default value” for a type. Read more