MCPcopy Create free account
hub / github.com/apache/datafusion / try_new

Method try_new

datafusion/execution/src/cache/list_files_cache.rs:104–121  ·  view source on GitHub ↗
(
        cached_file_list: CachedFileList,
        ttl: Option<Duration>,
        now: Instant,
    )

Source from the content-addressed store, hash-verified

102
103impl ListFilesEntry {
104 fn try_new(
105 cached_file_list: CachedFileList,
106 ttl: Option<Duration>,
107 now: Instant,
108 ) -> Option<Self> {
109 let size_bytes = (cached_file_list.files.capacity() * size_of::<ObjectMeta>())
110 + cached_file_list
111 .files
112 .iter()
113 .map(meta_heap_bytes)
114 .reduce(|acc, b| acc + b)?;
115
116 Some(Self {
117 metas: cached_file_list,
118 size_bytes,
119 expires: ttl.map(|t| now + t),
120 })
121 }
122}
123
124/// Calculates the number of bytes an [`ObjectMeta`] occupies in the heap.

Callers

nothing calls this directly

Calls 3

capacityMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected