pub struct LineageContext {
pub root_id: String,
pub root_title: String,
pub root_date: String,
pub parent_id: String,
pub edge_type: Option<EdgeType>,
pub status: ResolveStatus,
}Expand description
The resolved lineage of a single clip, threaded into naming, tagging, and change detection.
This is the bridge between the pure resolver (Resolution) and the parts
of the engine that turn a clip into files: it carries exactly the resolved
values that get embedded in a path or a tag (the root the clip folders
under, the immediate parent and how it derives from it), so those consumers
never re-read the now-defunct root_ancestor_id/album_title feed fields.
Fields§
§root_id: StringThe resolved root ancestor id (the clip’s own id when it is a root).
root_title: StringThe root ancestor’s title (empty when the root is outside the index).
When built via the lineage store (context_for/album_for_id) this
carries the effective album title: a manual override supplants the
derived title here, so the folder path, ALBUM tag, and change hash all
reflect it from one source. Contexts built without the store (e.g.
own_root) carry the raw title.
root_date: StringThe root ancestor’s creation timestamp (its raw created_at), or empty
when the root is outside the index.
Surfaced so the Year tag can group an album under its lineage root’s
year: a later revision that crosses a calendar boundary still carries the
root’s year. Contexts built without the store (own_root/for_clip)
carry the clip’s own created_at, so year falls back to the clip’s
own year when the root’s date is unavailable.
parent_id: StringThe immediate parent id (immediate_parent); empty for a root.
edge_type: Option<EdgeType>How the clip derives from its parent; None for a root.
status: ResolveStatusHow root resolution terminated.
Implementations§
Source§impl LineageContext
impl LineageContext
Sourcepub fn for_clip(clip: &Clip, resolution: &Resolution) -> LineageContext
pub fn for_clip(clip: &Clip, resolution: &Resolution) -> LineageContext
Build the context for clip from a whole-library Resolution.
Root id/title/status come from resolution.roots[clip.id]; when the clip
is absent (it was not part of the resolved set) it is treated as its own
resolved root. The parent id and edge come from immediate_parent,
which is empty/None for a root. root_date is the clip’s own
created_at: this store-less path has no window onto the root’s date, so
year falls back to the clip’s own year.
Sourcepub fn own_root(clip: &Clip) -> LineageContext
pub fn own_root(clip: &Clip) -> LineageContext
A self-rooted context for clip: it is treated as its own resolved root
with no parent. Used as a defensive fallback where a resolved context is
unavailable (a clip absent from the current desired set). root_date is
the clip’s own created_at, so it tags its own year.
Sourcepub fn album(&self, own_title: &str) -> String
pub fn album(&self, own_title: &str) -> String
The album the clip folders under: the root ancestor’s title when it is a
real, different root, otherwise own_title.
A root (or an unresolved clip whose root title is empty, or a clip whose root shares its title) folders under its own title; only a resolved, differently-titled ancestor pulls the clip into the ancestor’s album.
Sourcepub fn year(&self, own_created_at: &str) -> String
pub fn year(&self, own_created_at: &str) -> String
The album’s release year: the lineage root’s creation year when known,
otherwise own_created_at’s year.
The root anchors the year so an album whose tracks straddle a calendar
boundary (a December root with a January revision) groups under one year,
mirroring how album anchors the folder on the root’s
title. A root uses its own year; the fallback covers a root whose date is
outside the index.
Trait Implementations§
Source§impl Clone for LineageContext
impl Clone for LineageContext
Source§fn clone(&self) -> LineageContext
fn clone(&self) -> LineageContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LineageContext
impl Debug for LineageContext
impl Eq for LineageContext
Source§impl PartialEq for LineageContext
impl PartialEq for LineageContext
Source§fn eq(&self, other: &LineageContext) -> bool
fn eq(&self, other: &LineageContext) -> bool
self and other values to be equal, and is used by ==.