ListFilesCache

Trait ListFilesCache 

Source
pub trait ListFilesCache: CacheAccessor<TableScopedPath, Arc<Vec<ObjectMeta>>, Extra = Option<Path>> {
    // Required methods
    fn cache_limit(&self) -> usize;
    fn cache_ttl(&self) -> Option<Duration>;
    fn update_cache_limit(&self, limit: usize);
    fn update_cache_ttl(&self, ttl: Option<Duration>);
    fn list_entries(&self) -> HashMap<TableScopedPath, ListFilesEntry>;
    fn drop_table_entries(
        &self,
        table_ref: &Option<TableReference>,
    ) -> Result<()>;
}
Expand description

Cache for storing the ObjectMetas that result from listing a path

Listing a path means doing an object store “list” operation or ls command on the local filesystem. This operation can be expensive, especially when done over remote object stores.

The cache key is always the table’s base path, ensuring a stable cache key. The Extra type is Option<Path>, representing an optional prefix filter (relative to the table base path) for partition-aware lookups.

When get_with_extra(key, Some(prefix)) is called:

  • The cache entry for key (table base path) is fetched
  • Results are filtered to only include files matching key/prefix
  • Filtered results are returned without making a storage call

This enables efficient partition pruning: a single cached listing of the full table can serve queries for any partition subset.

See crate::runtime_env::RuntimeEnv for more details.

Required Methods§

Source

fn cache_limit(&self) -> usize

Returns the cache’s memory limit in bytes.

Source

fn cache_ttl(&self) -> Option<Duration>

Returns the TTL (time-to-live) for cache entries, if configured.

Source

fn update_cache_limit(&self, limit: usize)

Updates the cache with a new memory limit in bytes.

Source

fn update_cache_ttl(&self, ttl: Option<Duration>)

Updates the cache with a new TTL (time-to-live).

Source

fn list_entries(&self) -> HashMap<TableScopedPath, ListFilesEntry>

Retrieves the information about the entries currently cached.

Source

fn drop_table_entries(&self, table_ref: &Option<TableReference>) -> Result<()>

Trait Implementations§

Source§

impl Debug for dyn ListFilesCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§