Expand description
A .bwx container in origin-private storage.
The container’s layout — which file, in what order, written before what
— is [blockworx_store]’s and is not repeated here. What this crate
answers is the trait under it: where the bytes of one container go in a
browser, and who holds the right to write them.
Two values, and the Root is where a session starts:
navigator.storage.getDirectory() Root the origin's own directory
doc.bwx/ Opfs one container's storage
manifest.jsonl revs/ assets/ Entry what the store namesEverything here really is asynchronous. Origin-private storage on
the main thread is promises all the way down, so Opfs::residency is
[Residency::Resident]: the store reads the container in when it opens
it and owes its writes back
(Container::drain),
and nothing may resolve a future here by polling it.
What a browser has to be given room for. Only Chromium has
FileSystemHandle.move(), so a rename copies and removes rather than
moving. Safari has no createWritable outside a worker, which is what
every write here is made of, so this storage is Chromium and Firefox
for now; Safari’s way in is the kernel in a worker, over
createSyncAccessHandle. The lock is the origin’s lock manager rather than a lock
entry, because nothing in a browser can be asked whether the tab that
wrote an entry is still open — see locks.
Re-exports§
pub use crate::directory::Missing;
Modules§
- directory
- Handles: what a directory holds, and how one is reached.
- fault
- A browser’s refusal, in the words the store speaks.
- file
- One entry’s bytes, through a writable stream.
- locks
- The origin’s lock manager, as a container’s single-writer lock.
Structs§
- Opfs
- One container’s directory in origin-private storage.
- Root
- The origin’s private directory: where a browser keeps this app’s containers, and the only place it keeps them.
Functions§
- not_
an_ 🔒entry - Nothing the container would call an entry stands where this was asked: no such name, or a name something that is not a file stands under.
- nothing_
there 🔒 - A missing entry is nothing rather than a failure — the one refusal the container reads as an answer.
- segments 🔒
- The path
atnames, as the directories to walk and the entry at the end. Empty for [Entry::ROOT], which is the container itself. - taken 🔒
- A name that is not this container’s to take: something already stands under it, or another view has claimed it and not laid it down yet.