pub struct FileIndexCacheBuilder { /* private fields */ }Expand description
Builder for constructing a FileIndexCache with custom configuration.
Implementations§
Source§impl FileIndexCacheBuilder
impl FileIndexCacheBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new builder with no configuration.
All options use defaults if not explicitly set:
- Cache path: temp directory + “journal-engine-cache”
- Memory capacity: 128 entries
- Disk capacity: 16 MB
- Block size: 4 MB
Sourcepub fn with_cache_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_cache_path(self, path: impl Into<PathBuf>) -> Self
Sets the cache directory path.
Sourcepub fn with_cache_namespace(self, namespace: impl Into<String>) -> Self
pub fn with_cache_namespace(self, namespace: impl Into<String>) -> Self
Sets the consumer-visible cache namespace.
Use the returned namespace with FileIndexKey::new_with_namespace or
Self::file_index_key to force clean rebuilds for consumer semantic
migrations while keeping the same physical cache directory. The cache
object does not apply this namespace to keys constructed elsewhere.
Sourcepub fn cache_namespace(&self) -> &str
pub fn cache_namespace(&self) -> &str
Returns the namespace configured on this builder.
Sourcepub fn file_index_key(
&self,
file: &File,
facets: &Facets,
source_timestamp_field: Option<FieldName>,
) -> FileIndexKey
pub fn file_index_key( &self, file: &File, facets: &Facets, source_timestamp_field: Option<FieldName>, ) -> FileIndexKey
Creates a file-index cache key using this builder’s namespace.
Sourcepub fn with_memory_capacity(self, capacity: usize) -> Self
pub fn with_memory_capacity(self, capacity: usize) -> Self
Sets the memory capacity (number of items to keep in memory).
Sourcepub fn with_disk_capacity(self, capacity: usize) -> Self
pub fn with_disk_capacity(self, capacity: usize) -> Self
Sets the disk capacity in bytes.
Sourcepub fn with_block_size(self, size: usize) -> Self
pub fn with_block_size(self, size: usize) -> Self
Sets the block size in bytes.
Sourcepub fn without_disk_cache(self) -> Self
pub fn without_disk_cache(self) -> Self
Disables the disk-backed cache and keeps indexes in memory only.
Sourcepub async fn build(self) -> Result<FileIndexCache>
pub async fn build(self) -> Result<FileIndexCache>
Builds the FileIndexCache with the configured settings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileIndexCacheBuilder
impl RefUnwindSafe for FileIndexCacheBuilder
impl Send for FileIndexCacheBuilder
impl Sync for FileIndexCacheBuilder
impl Unpin for FileIndexCacheBuilder
impl UnsafeUnpin for FileIndexCacheBuilder
impl UnwindSafe for FileIndexCacheBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more