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 allocates a unique revision.
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 allocates a unique content revision.
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 a content revision and recalculates dirty state from the saved revision.
Returns a saved-content fingerprint only when a path and concrete mtime make the baseline meaningful.
Returns the saved baseline revision.
Returns the current content revision.
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 allocates a unique revision.
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 allocates a unique content revision.
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 a content revision and recalculates dirty state from the saved revision.
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 revision.
@spec version(t()) :: non_neg_integer()
Returns the current content revision.