Tracks whether a buffer has diverged from its last saved baseline.
This module owns the pure save-point model: mutation versions, the saved version, dirty calculation, and the saved file fingerprint used by persistence conflict checks. It does not read or write files; Minga.Buffer.Persistence still owns storage I/O.
Summary
Functions
Accepts replacement content as a new saved baseline and advances the mutation version once.
Acknowledges the latest disk metadata while preserving the saved content fingerprint.
Returns true when the backing file differs from the saved baseline.
Fingerprints content with the algorithm used to track saved file baselines.
Returns whether the buffer differs from its saved version.
Returns the saved content fingerprint, if one is known.
Returns the saved file size.
Returns a clean save state for content loaded from storage.
Marks the buffer as changed and advances the mutation version.
Records the current version as the saved baseline.
Returns the saved file mtime.
Returns a clean save state for a new buffer with no saved file baseline.
Records a content change that should not by itself make a clean buffer dirty.
Restores the mutation version and recalculates dirty state from the saved version.
Returns a saved-content fingerprint only when a path and concrete mtime make the baseline meaningful.
Returns the saved baseline version.
Returns the current mutation version.
Types
@type metadata() :: {mtime :: integer() | nil, size :: non_neg_integer() | nil}
@type saved_content_status() :: :same | :changed | :unknown
@opaque t()
Functions
Accepts replacement content as a new saved baseline and advances the mutation version once.
Acknowledges the latest disk metadata while preserving the saved content fingerprint.
@spec changed_since_saved?( t(), integer() | nil, non_neg_integer() | nil, saved_content_status() ) :: boolean()
Returns true when the backing file differs from the saved baseline.
Fingerprints content with the algorithm used to track saved file baselines.
Returns whether the buffer differs from its saved version.
Returns the saved content fingerprint, if one is known.
@spec file_size(t()) :: non_neg_integer() | nil
Returns the saved file size.
Returns a clean save state for content loaded from storage.
Marks the buffer as changed and advances the mutation version.
Records the current version as the saved baseline.
Returns the saved file mtime.
@spec new() :: t()
Returns a clean save state for a new buffer with no saved file baseline.
Records a content change that should not by itself make a clean buffer dirty.
@spec restore_version(t(), non_neg_integer()) :: t()
Restores the mutation version and recalculates dirty state from the saved version.
Returns a saved-content fingerprint only when a path and concrete mtime make the baseline meaningful.
@spec saved_version(t()) :: non_neg_integer()
Returns the saved baseline version.
@spec version(t()) :: non_neg_integer()
Returns the current mutation version.