pub struct Baseline {
pub version: u32,
pub source_path: PathBuf,
pub rendered_hash: String,
pub rendered_content: String,
pub source_hash: String,
pub context_hash: String,
pub tracked_render: String,
pub timestamp: u64,
}Expand description
One baseline record — the cached state of a single processed file.
Fields§
§version: u32Schema version — see SCHEMA_VERSION.
source_path: PathBufAbsolute path of the source file at expansion time. Captured so
dodot transform check can re-find the template to patch
without re-walking the pack tree, and so cache-only diagnostics
can name the source even after pack reorganisation.
#[serde(default)] for forward compatibility with any v1
baseline written before this field existed (treated as empty;
transform check will skip such entries until they’re rewritten
by the next dodot up).
rendered_hash: StringSHA-256 of the rendered (visible, marker-free) output, hex-encoded.
rendered_content: StringThe full rendered output verbatim. Stored so reverse-merge can diff the deployed file against the baseline byte-for-byte without re-rendering the template.
source_hash: StringSHA-256 of the source file’s bytes at the moment of expansion, hex-encoded. Used to distinguish “user edited the source” from “user edited the deployed file” (the 4-state matrix in the pipeline spec §6.1).
context_hash: StringSHA-256 of the rendering context (variables, dodot.* values),
hex-encoded. Provided by the preprocessor; for templates this is
the deterministic projection computed by
compute_context_hash. May be
empty if the preprocessor has no meaningful context concept.
tracked_render: StringMarker-annotated rendered output (burgertocow’s “tracked”
stream). Empty when the preprocessor doesn’t produce one.
Persisted so the clean filter can rehydrate a TrackedRender
via burgertocow::TrackedRender::from_tracked_string and
drive the reverse-diff without re-rendering — re-rendering at
clean-filter time would re-trigger any secret-provider auth
prompts on every git status.
timestamp: u64Wall-clock unix timestamp (seconds) of when the baseline was
written. Used by dodot transform status to show “deployed
since …”. Not load-bearing for divergence detection.
Implementations§
Source§impl Baseline
impl Baseline
Sourcepub fn build(
source_path: &Path,
rendered_content: &[u8],
source_bytes: &[u8],
tracked_render: Option<&str>,
context_hash: Option<&[u8; 32]>,
) -> Self
pub fn build( source_path: &Path, rendered_content: &[u8], source_bytes: &[u8], tracked_render: Option<&str>, context_hash: Option<&[u8; 32]>, ) -> Self
Build a baseline from raw inputs. Hashes are computed here so
callers don’t repeat the SHA setup; the optional tracked_render
and context_hash come straight off the preprocessor’s
ExpandedFile.
source_path is the absolute path of the source file inside
the pack — recorded so reverse-merge knows where to write the
patched template back to.
Sourcepub fn write(
&self,
fs: &dyn Fs,
paths: &dyn Pather,
pack: &str,
handler: &str,
filename: &str,
) -> Result<PathBuf>
pub fn write( &self, fs: &dyn Fs, paths: &dyn Pather, pack: &str, handler: &str, filename: &str, ) -> Result<PathBuf>
Persist this baseline to its JSON path under the cache dir. Creates parent directories as needed. Overwrites any existing file at the target path.
Sourcepub fn load(
fs: &dyn Fs,
paths: &dyn Pather,
pack: &str,
handler: &str,
filename: &str,
) -> Result<Option<Self>>
pub fn load( fs: &dyn Fs, paths: &dyn Pather, pack: &str, handler: &str, filename: &str, ) -> Result<Option<Self>>
Load a baseline from its JSON path. Returns Ok(None) if the
file does not exist (a file with no baseline is a normal state
for a brand-new pack); returns an error for parse failures or
unsupported schema versions so the caller can suggest a manual
clear.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Baseline
impl<'de> Deserialize<'de> for Baseline
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Baseline
impl StructuralPartialEq for Baseline
Auto Trait Implementations§
impl Freeze for Baseline
impl RefUnwindSafe for Baseline
impl Send for Baseline
impl Sync for Baseline
impl Unpin for Baseline
impl UnsafeUnpin for Baseline
impl UnwindSafe for Baseline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.