Skip to main content

Module private_document

Module private_document 

Source
Available on non-target_family=wasm only.
Expand description

A small JSON document only its owner may read, replaced atomically.

A write lands whole or not at all: the bytes go to a temporary file beside the target, reach the disk, and only then take the target’s name. A reader that arrives mid-write sees the old document, never a half-written one. CommittedWrite::confirm_durability is the separate step that says the rename itself survives a power cut.

Errors here name the fault, not the path. The caller knows which of its documents it was writing, and says so when it wraps the failure.

Structs§

CommittedWrite
The document is in place. Whether the rename outlives a power cut is the separate question Self::confirm_durability answers.
PreparedWrite
Bytes on the disk under a temporary name. Dropping this instead of committing leaves the document as it was.
PrivateDocument
One document at one path. The byte ceiling is the caller’s: a document that outgrows it is a bug or a tampered file, never something to parse.

Enums§

DocumentError