Skip to main content

Module file

Module file 

Source
Expand description

Private files: written whole and atomically, read within a bound, told apart by stamp; and FileTable, a Table kept in one of them in a serde format the caller supplies through a Codec.

Needs the file feature.

Structs§

CodecError
A format refused a document. It carries nothing of the document, which may hold secrets.
FileSource
A table kept in one private file.
FileTable
A table of T kept in one private file: a document with one key, section, holding the list of records, written by codec C.
Source
Where a table is kept: an object holding exactly one source kind, open to more kinds (a SQL database, an HTTP API) without changing what sits beside it.
Stamp
Which writing of a file is there: told apart from any other by when it was written, how long it is and, on Unix, which inode it is (every writing here is a new file put in the old one’s place, and a coarse clock alone cannot tell two apart).

Constants§

DEFAULT_MAX_BYTES
The most a table file may hold unless FileTable::max_bytes says otherwise: 1 MiB.

Traits§

Codec
A serde text format a FileTable keeps its records in. The kit names no format: the caller implements this over the format crate it picks.

Functions§

read_bounded
Reads the UTF-8 text of the file at path, refusing more than max_bytes. None when there is no such file: nothing has been kept yet.
stamp
The stamp of the file at path; None when there is no such file.
write_private
Writes bytes as the file at path: beside it first and then in its place, so it is never there half written, readable by its owner alone (0600 on Unix), and never written through a link or into a file someone else can read.