Skip to main content

CacheManifest

Struct CacheManifest 

Source
pub struct CacheManifest {
    pub version: u32,
    pub entries: HashMap<String, CacheEntry>,
    /* private fields */
}
Expand description

On-disk cache manifest mapping output paths to their cache entries.

Lookups go through a runtime content_index that maps "{source_hash}:{params_hash}" to the stored output path, making the cache resilient to album renames and file renumbering.

Fields§

§version: u32§entries: HashMap<String, CacheEntry>

Implementations§

Source§

impl CacheManifest

Source

pub fn empty() -> Self

Create an empty manifest (used for --no-cache or first build).

Source

pub fn load(output_dir: &Path) -> Self

Load from the output directory. Returns an empty manifest if the file doesn’t exist or can’t be parsed (version mismatch, corruption).

Source

pub fn save(&self, output_dir: &Path) -> Result<()>

Save to the output directory.

Source

pub fn find_cached( &self, source_hash: &str, params_hash: &str, output_dir: &Path, ) -> Option<String>

Look up a cached output file by content hashes.

Returns Some(stored_output_path) if an entry with matching source_hash and params_hash exists and the file is still on disk. The returned path may differ from the caller’s expected output path (e.g. after an album rename); the caller is responsible for copying the file to the new location if needed.

Source

pub fn insert( &mut self, output_path: String, source_hash: String, params_hash: String, )

Record a cache entry for an output file.

If an entry with the same content (source_hash + params_hash) already exists under a different output path, the old entry is removed to keep the manifest clean when images move (e.g. album rename).

If the output path already has an entry for different content (e.g. image swap: file A moved to where B used to be), the old content’s content_index entry is removed so stale lookups don’t return a file whose content has been overwritten.

Source

pub fn prune(&mut self, live_paths: &HashSet<String>, output_dir: &Path) -> u32

Remove all entries whose output path is not in live_paths, and delete the corresponding files from output_dir.

Call this after a full build to clean up processed files for images that were deleted, renumbered, or belong to renamed/removed albums.

Trait Implementations§

Source§

impl Clone for CacheManifest

Source§

fn clone(&self) -> CacheManifest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CacheManifest

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CacheManifest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CacheManifest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> To for T
where T: ?Sized,

Source§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
Source§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,