Skip to main content

Module blobs

Module blobs 

Source
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 written

Structs§

All
Every file of a folder, a page at a time, as Files::all walks them.
FileCall
One path and the options of a call on it, which ends in its verb.
FileInfo
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.
FilesBuilder
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.
StoredFile
A file and its bytes as Files::get found 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::upload begins it: bytes go in with write, the file appears at commit and 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.