Expand description
The application’s files: bytes by path in named sets, written whole and
replaced whole, checked against their SHA-256 when read whole, and kept
inline in blobs/blobs.db up to 16 KiB or as a file each past it.
let store = tinystore::Store::open("data", Default::default())?;
let avatars = store.files("avatars").open()?;
avatars.key("42.png").content_type("image/png").put(b"...")?;
let mut avatar = avatars.get("42.png")?.expect("just written");
assert_eq!(avatar.info().content_type, "image/png");
let bytes = avatar.read_all()?; // checked against the SHA-256 taken when it was writtenStructs§
- All
- Every file of a folder, a page at a time, as
Files::allwalks them. - File
Call - One path and the options of a call on it, which ends in its verb.
- File
Info - A file’s fields: what serving it needs, and nothing a query would search.
- Files
- A set of files by path, or a folder of it: bytes written whole and replaced whole, each with a type, an ETag and a few strings of the program’s.
- Files
Builder - What opens a set of files: its name, and the term and the bound of the files written in it.
- List
- A page of a folder’s files, its options before
List::page. - Maintenance
- What one maintenance did.
- Page
- A page of a folder’s files, in the byte order of their paths, and where the next page starts when one follows.
- Stored
File - A file and its bytes as
Files::getfound it. A whole read, from its first byte to its last in order, is checked against the SHA-256 taken when it was written, and its last bytes are held back until it matches; a range is not checked. - TxFiles
- A set of files’ calls inside a transaction of the database it was opened from: what they write commits with the transaction, and what they read sees what it wrote.
- Upload
- A file written a piece at a time, as
Files::uploadbegins it: bytes go in withwrite, the file appears atcommitand never before, and an upload dropped without it leaves nothing. - Usage
- What a folder holds now: its files and their bytes.
Constants§
- PAGE_
FILES - Files a page holds at most, and when a list does not say.
Functions§
- maintain
- Removes expired files, the files large clears hid, and bytes no file names any more, and scrubs a slice of the stored bytes. The store runs it every minute; a store opened without background work leaves it to the caller.