pub struct Opfs {
pub(crate) root: FileSystemDirectoryHandle,
pub(crate) dir: FileSystemDirectoryHandle,
pub(crate) name: Name,
pub(crate) held: RefCell<Option<Held>>,
}Expand description
One container’s directory in origin-private storage.
Fields§
§root: FileSystemDirectoryHandleThe origin’s root, which a rename and a discard reach the container through rather than reaching into it.
dir: FileSystemDirectoryHandle§name: Name§held: RefCell<Option<Held>>Implementations§
Source§impl Opfs
impl Opfs
Sourcepub(crate) async fn within(
&self,
at: &Entry,
missing: Missing,
) -> Result<(FileSystemDirectoryHandle, String)>
pub(crate) async fn within( &self, at: &Entry, missing: Missing, ) -> Result<(FileSystemDirectoryHandle, String)>
The directory at is held in — made along the way where a write is
what asked — and the name it is held under.
pub(crate) async fn entry( &self, at: &Entry, missing: Missing, ) -> Result<FileSystemFileHandle>
pub(crate) async fn walk( &self, path: &[&str], missing: Missing, ) -> Result<FileSystemDirectoryHandle>
pub(crate) fn lock_name(name: &Name) -> String
Trait Implementations§
Source§impl Storage for Opfs
impl Storage for Opfs
Source§async fn exists<'a>(&'a self, at: &'a Entry) -> Result<bool>
async fn exists<'a>(&'a self, at: &'a Entry) -> Result<bool>
A name a directory stands under answers false rather than the
browser’s refusal, which is what a map answers too: this is asked
about entries, and the container’s own directories are laid out
rather than looked for.
Source§async fn rename<'a>(&'a mut self, to: &'a Name) -> Result<()>
async fn rename<'a>(&'a mut self, to: &'a Name) -> Result<()>
The bytes travel, since only Chromium has move(), and the lock
goes with them: it is named after the container, so a rename must
take the new name’s lock as well as the new name.
Both are taken before anything moves. A view claiming a name whose directory it has not laid down yet holds that lock and nothing else, so a rename that copied first and asked afterwards would find the lock gone and carry on writing a container it no longer holds.
Source§async fn claim(&self, _now: WallTime) -> Result<Claim>
async fn claim(&self, _now: WallTime) -> Result<Claim>
now names nobody here: the origin’s lock manager records no
holder, only that the lock is held, which is why a refusal is
[Holding::Elsewhere].
Source§fn names(&self, at: &Entry) -> String
fn names(&self, at: &Entry) -> String
at — a platform path where there is one. Not
a promise that anything is there.fn residency(&self) -> Residency
Source§async fn read<'a>(&'a self, at: &'a Entry) -> Result<Option<Vec<u8>>>
async fn read<'a>(&'a self, at: &'a Entry) -> Result<Option<Vec<u8>>>
at, or None where nothing is — which is not the
same as a read that did not work.Source§async fn write<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
async fn write<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
Source§async fn append<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
async fn append<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
bytes to the end of at, durably before returning.async fn truncate<'a>(&'a self, at: &'a Entry, len: u64) -> Result<()>
Source§async fn list<'a>(&'a self, dir: &'a Entry) -> Result<Vec<String>>
async fn list<'a>(&'a self, dir: &'a Entry) -> Result<Vec<String>>
dir holds, by name, in no particular order.async fn remove<'a>(&'a self, at: &'a Entry) -> Result<()>
Source§async fn create_dir<'a>(&'a self, dir: &'a Entry) -> Result<()>
async fn create_dir<'a>(&'a self, dir: &'a Entry) -> Result<()>
dir a place entries can be written.Auto Trait Implementations§
impl !Freeze for Opfs
impl !RefUnwindSafe for Opfs
impl !Send for Opfs
impl !Sync for Opfs
impl Unpin for Opfs
impl UnsafeUnpin for Opfs
impl !UnwindSafe for Opfs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more