pub fn load_or_create_digest_key_at(
path: &Path,
) -> Result<TraceDigestKey, TraceKeyError>Expand description
Load (or atomically create) the digest key at path.
Guarantees:
- the parent directory is created
0700via the Phase 1 private-fs helper; the key file is created0600with no broader interval (mode set atopen, never create-then-chmod); - a symlink planted at the key path is refused, never followed;
- a non-regular file (FIFO, device, directory) at the key path is refused
with
TraceKeyError::NotRegularFile, promptly and without blocking; - a pre-existing key file with a broader mode is repaired to exactly
0600via the already-open handle (no path re-resolution); - at most 33 bytes are read; any length other than exactly 32 is
TraceKeyError::Corrupt; - concurrent first-time creation converges: the key is fully written to a
0600temp file and published with an atomiclink(2); losers read the winner’s key, so every caller observes the same key bytes.