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

Returns a fresh empty builder.

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.

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 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

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.