pub fn write_cache(
workspace_dir: &Path,
status: &WorkspaceIndexStatus,
) -> Result<(), WorkspaceError>Expand description
Atomically persist status to the aggregate cache for
workspace_dir.
Writes to a sibling <status>.json.tmp.<pid>.<nanos> file inside the
cache directory and then renames over the canonical path, so a
concurrent reader either sees the previous payload or the new one in
full (no torn reads). Creates the cache directory if missing.
§Errors
Returns WorkspaceError::Io for filesystem failures and
WorkspaceError::Serialization when the payload cannot be encoded.
§Panics
Panics if cache_path returns a path without a parent directory,
which is structurally impossible — cache_path always returns a
path with at least three components (<dir>/.sqry/workspace-cache/status.json).