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(
&mut self,
checker: impl Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe + Sized + 'static
) -> &mut Self
pub fn consistency_checker(
&mut self,
checker: impl Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe + Sized + 'static
) -> &mut 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.
Sets the consistency checker function to
crate::byte_equality_checker: the contents of all cache
hits must be bytewise identical, without considering any
metadata.
Sets the consistency checker function to
crate::panicking_byte_equality_checker: the contents of
all cache hits must be bytewise identical, without considering
any metadata, and the call will panic on mismatch.
Removes the consistency checker function, if any.
pub fn arc_consistency_checker(
&mut self,
checker: Option<Arc<dyn Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe>>
) -> &mut Self
pub fn arc_consistency_checker(
&mut self,
checker: Option<Arc<dyn Fn(&mut File, &mut File) -> Result<()> + Sync + Send + RefUnwindSafe + UnwindSafe>>
) -> &mut 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.
pub fn plain_caches<P>(
&mut self,
paths: impl IntoIterator<Item = P>
) -> &mut Self where
P: AsRef<Path>,
pub fn plain_caches<P>(
&mut self,
paths: impl IntoIterator<Item = P>
) -> &mut Self where
P: AsRef<Path>,
Adds a new plain cache directory for each path in paths.
The caches are appended in order to the end of the cache
builder’s search list.
Adds a new sharded cache directory at path to the end of the
cache builder’s search list.
Returns the contents of self as a fresh value; self is
reset to the default empty builder state. This makes it
possible to declare simple configurations in a single
expression, with .take().build().
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