#[non_exhaustive]pub struct AutoDisk {
pub percent: u8,
pub ceiling: u64,
}Expand description
The automatic disk budget: a share of what the cache could occupy (its
own bytes plus the free space), at most a ceiling, and never more than
leaves auto_disk_reserve free.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.percent: u8Share of (free space + the cache’s own bytes), in percent.
ceiling: u64Upper bound, in bytes.
Implementations§
Source§impl AutoDisk
impl AutoDisk
Sourcepub const CEILING: u64
pub const CEILING: u64
Default ceiling: large enough for the inflated DEX of a phone’s worth of APKs (416 system and store APKs: 8.6 GB).
Sourcepub fn bytes_for(&self, space: Option<(u64, u64)>, used: u64) -> u64
pub fn bytes_for(&self, space: Option<(u64, u64)>, used: u64) -> u64
The budget for a cache holding used bytes on a file system with
(free, total) bytes (None: unknown, e.g. on Windows, giving
AUTO_DISK_UNKNOWN). When the disk is already below the reserve,
the last bound falls under used, so eviction gives the shortfall
back. (No separate floor: with a reserve of at least 1 GiB, the
reserve is always the tighter bound on a disk too small for 20 % to
reach 256 MiB.)