Expand description
Files on disk: the store layout, directory, settings and exclusive lock.
Structs§
- Atomic
File - One named file capability. It reads, creates, replaces and removes bytes without exposing a path. Replacement atomically installs a complete version.
- Bootstrap
Store - An unpublished store at its permanent path, protected by a bootstrap lease.
Dropping preserves resumable work;
cancelremoves it after its database closes. Publication removes the marker without moving any open files. - Cache
Write Lock - A held lock on the cache’s range writes: shared by a write in progress, exclusive while opening finds abandoned ones. Dropping it unlocks.
- Closed
Store Lock - The writer lock, held while a closed store is read without opening it: holding it shows that no handle runs the store’s sync. Registered in this process as closing from the start, so an open waits for its release. Dropping it unlocks.
- Copy
Folder - The folder the person picked, open for the copies one call makes.
- Copy
Plan - What one call makes below the folder: the folders that don’t exist yet, each before the folders inside it, and each file’s path, in the order of the relative paths.
- Copy
Writer - A copy being written under its temporary name. Dropping it leaves the bytes for the caller’s recorded cleanup.
- Device
Reset - A replacement of this installation, not a membership removal (E5).
- Directory
Bytes - What a store’s directory holds, in file sizes.
- File
Lock - An OS lock on an open file, released when dropped. Separate opens of one file exclude each other, within a process and across processes.
- File
Name - A portable single filename: ASCII letters, digits,
-,_and interior dots, up to 255 bytes. Windows device names are refused on every platform. - File
Reader - An open read-only file. Renaming or unlinking its path never redirects reads. Reads return what’s on disk, as the platform’s own positioned reads do.
- File
Writer - An unpublished file’s open writer. Its OS handle and path stay private. Dropping it leaves the named bytes for the caller’s recorded cleanup. The shared store lock lasts until its handle and any cancelled I/O finish, and, for a file finished into a batch, until the batch’s flush ends.
- Flush
Batch - Files written for one commit, each synced as it finished, whose folders
and drive cache are flushed together by
FlushBatch::flush. The commit that records them takes theFlushedit returns, so nothing commits ahead of its bytes reaching the drive. - Flushed
- A batch’s files reached the drive: what a commit recording them takes.
- Made
Folder - A folder coven made for copies in a folder the person picked, as its record reads back (§17.3). It is made only where coven reads that record.
- Observed
File - Facts captured while reading one original; validation never rereads its bytes.
- Path
Bytes Error - Bytes that
path_bytesnever gives on this operating system, so no path here: on Windows, bytes that aren’t WTF-8. Unix takes any bytes. - Recorded
Copy - A copy coven recorded writing in a folder the person picked, as its record reads back (§17.3): its bytes still at their temporary name, or placed at its path with the size and modification time they had there. It is made only where coven reads that record.
- Relative
Path - A path below a folder, as the names the app gives, outermost first: an
album’s name, then a track’s. Each name is one name on every platform,
whatever it holds,
/and\included. Coven writes each through one rule that makes it valid on any volume (§17.3), so joined to the folder the path stays inside it. - Replacement
Record - The durable record of a replacement past its point of no return: from just before the fresh device registers until it is published (§19.3).
- Replacement
Store - A replacement of the installation in a published store’s directory. It holds the store’s bootstrap lease, and its writer lock until the new installation is in place. Dropping it keeps its work for the next call.
- Staged
Name - Where a staged copy lies among the store’s app-provided files: in the
folder its staging made, under its own name, recorded as
<folder>/<copy>(Appendix C.3). - Store
Closing Guard - Marks an owning scope as closing on drop, without retaining its lock.
Share an
Arcof this guard across clones of that owner. A distinct owner scope can useclosing_guard; ending either scope marks the instance. - Store
Deletion Lock - Exclusive access to the writer, readers and bootstrap, authorizing
deletion. Holding the bootstrap lock keeps every restore, join and
replacement of the store out, including a
reset_deviceorrestore_devicethat holds only that lock between the steps of an unfinished swap (§19.3), and lets deletion remove its lock file too. - Store
Dir - One store’s directory, owning the paths to its database, app-provided files, cache, settings and sibling locks. It never exposes the directory as a raw path.
- Store
Directories - The stores under
app_dir, one directory each (E1). - Store
Lock - An exclusive writer lock. Dropping it unlocks and closes the OS handle. Readers use a separate shared lock so they can coexist with the writer.
- Store
Read Lock - A shared lock that prevents deletion while a reader holds store files open.
- Store
Settings - The settings written when creating, restoring or joining a store (E1). Storage settings belong to coven-storage’s own named file.
- Temporary
Folder - The folder an app names for SQLite’s temporary tables (§21.2), outside coven’s directories. It is made where the app’s call names it.
- User
Original - A user’s original: a file outside coven’s directories, at the path the app named for it, which coven reads and never changes (§17.3). It is made where the app’s call hands the path in, or where coven reads back the path it recorded.
- Writer
Folder - One area’s folder, held for a run of files made in it: the store’s read lock, taken once, and the folder’s resolved path, shared by every writer made here. The lock lasts until the last of those writers, and any batch one finished into, lets go of it.
Enums§
- Bootstrap
Directory Error - Filesystem failures while reserving, publishing or cancelling a new device.
- Copy
Path Error - Why a copy can’t go where the app named.
- Directory
Creation Error - A store creation failure, with publication and rollback failures explicit.
- File
Area - The two places coven keeps file bytes inside a store (E1).
- File
Error - A file operation’s cause, including whether replacement already happened.
- File
Name Error - A name that could escape its directory or alias a Windows device.
- IfUnsent
- What
delete_storedoes with writes and files not yet uploaded. - Lock
Mode - Whether other holders may share the lock.
- Observation
Error - A missing or changed original is distinct from an operating-system failure.
- Relative
Path Error - Why names can’t be a
RelativePath. - Replaced
By - The call that began a replacement, and so the only call that finishes it (§19.3). The other call would load under different keys, or keep or remove a different copy, so it is refused before anything changes.
- Replacement
Phase - How far a recorded replacement has come (§19.3).
- Settings
Error - Missing, damaged or unreadable store settings remain distinct errors.
- Staging
Folder Error - Why a staging’s folder could not be made.
- Store
File - One file owned by a crate, beside the database and store settings. The enum reserves the name so a caller cannot replace the database or settings.
- Store
Lock Error - A store in use is distinct from a filesystem failure.
- Writer
Error - Why a store’s file could not be created for writing: the store’s read lock, which the writer holds, or the file itself.
Traits§
- Store
DirAccess - Crate-to-crate operations for coven’s owners; not re-exported by the app API.
- Store
Lock Probe - Probes the OS writer lock without waiting, for lifetime assertions in
tests. Production opens take the lock through
StoreDirAccess.
Functions§
- assert_
no_ open_ files_ under - Panic naming every file under
dirthis process has open. - bootstrap_
lock - The bootstrap lock file of the store at
directory, which a test waits on to know an open finds the store’s bootstrap closing and waits for it. - cache_
writes_ lock - The cache-write lock file of the store at
store, which a test waits on to know a range write or an open waits for it. - copy_
tree - Copy the tree at
fromintoto, makingtoand every folder below it, as restoring a backup of an installation does. - copy_
tree_ keeping - Copy the tree at
fromintoto, ascopy_treedoes, with only the files whose namekeepaccepts. - open_
files_ under - Every file under
dirthis process has open, once per open descriptor or handle. Directories are not files: a handle on one, the kind resolving a path takes for a moment on Windows, holds no file open. Panics if the directory cannot be resolved or enumeration fails. Descriptors closed while being inspected may disappear from the result. - path_
bytes - The path’s bytes as coven records them. On Unix they are the path’s own
bytes. On Windows they are its UTF-16 units in WTF-8: UTF-8, with each
unpaired surrogate written as the three bytes UTF-8 would give its code
point. Rust’s
OsStr::as_encoded_bytesholds the same bytes today, but its encoding is unspecified and not to be stored, so coven writes them itself. A path that is valid Unicode is its UTF-8 on every platform. - path_
bytes_ text - The text that shows a path from its recorded bytes, as SQL’s
coven_path_textgives it: valid UTF-8 as it is, and each byte that isn’t as\xand two uppercase hex digits.Caf\xE9.flacshows a Latin-1 name. A backslash already in the name stays as it is, so a name spelledCaf\xE9.flacshows the same: the text can’t be turned back into the path, and nothing opens a file by it. - path_
from_ bytes - The path
path_bytesrecorded. Bytes it never gives fail withPathBytesError: on Windows, bytes that aren’t WTF-8, such as Latin-1 from a Linux device. On Unix any bytes are a path. - path_
text - The text that shows
path:path_bytes_textof its bytes. - read_
existing - The complete file at
path, which must exist, for a test reading back bytes it saved withreplace. - settle_
files - Remove what unfinished writes left at the top of the store
lockholds for writing (Appendix C.3), and the joining keys a published store still holds when the join that published it stopped before deleting them (§13.4), then give every folder and file the class its layout gives the store’s files, asdirectorynames it, unless the store’s record shows they were last given it (E1). Blocks while it walks the store. - verify_
lock - Check that
lockprotects exactly the store atdirectory. - when_
reached - Told once file work reaches
path: about to open it, or finding its lock held and about to wait for it. - windows_
device - Whether
base, a name’s part before its first.without trailing spaces, names a Windows device: Windows opens the device for it, with any extension on some versions, and in any ASCII case.¹,²and³count as digits. - write_
atomic - Write and sync a temporary sibling, atomically replace
path, then sync its directory. The parent must exist. Concurrent readers see whole versions. A pre-replacement failure leaves the target unchanged;FileError::AfterReplacereports that new bytes are visible but directory syncing failed. Windows requires the POSIX replacement support described byAtomicFile::replace. - writer_
lock - The writer lock file of the store at
directory, which a test waits on (when_reached) to know an open finds the store’s writer closing and waits for it.
Type Aliases§
- Flush
Hook - Run where a batch’s flush has returned, in tests; an error from it fails the flush as the drive’s would.