pub struct GuardedFile { /* private fields */ }Expand description
Blocking I/O facade used by the synchronous CLI updater. Async callers must run these methods on their existing blocking worker. One opened regular, unlinked file and its pinned parent. Drop closes handles; it never deletes a pathname another process could have replaced.
Implementations§
Source§impl GuardedFile
impl GuardedFile
pub fn open(directory: &Path, name: &str) -> Result<Option<Self>>
pub fn open_bounded( directory: &Path, name: &str, maximum: usize, ) -> Result<Option<Self>>
Sourcepub fn open_command_siblings(
directory: &Path,
names: &[&str],
) -> Result<BTreeMap<String, Self>>
pub fn open_command_siblings( directory: &Path, names: &[&str], ) -> Result<BTreeMap<String, Self>>
Open a closed set of command siblings, rejecting any hard link outside the opened group.
pub fn stage(directory: &Path, bytes: &[u8], executable: bool) -> Result<Self>
Sourcepub fn same_inode(&self, other: &Self) -> Result<bool>
pub fn same_inode(&self, other: &Self) -> Result<bool>
Return whether two guarded handles refer to the same underlying file object.
pub fn verify_owned(&mut self) -> Result<()>
pub fn remove_checked(&mut self, unlinked: &mut bool) -> Result<()>
Sourcepub fn remove_sibling_checked(
&mut self,
expected_remaining_links: u64,
prior_sibling_unlinked: bool,
unlinked: &mut bool,
) -> Result<()>
pub fn remove_sibling_checked( &mut self, expected_remaining_links: u64, prior_sibling_unlinked: bool, unlinked: &mut bool, ) -> Result<()>
Remove a guarded sibling command while enforcing exact pre- and post-unlink link counts.
pub fn recovery_name() -> String
pub fn name(&self) -> &str
pub fn sha256(&self) -> &str
pub fn verify(&mut self) -> Result<()>
Sourcepub fn read_bounded(&mut self, maximum: usize) -> Result<Vec<u8>>
pub fn read_bounded(&mut self, maximum: usize) -> Result<Vec<u8>>
Reads and validates the same handle used for its digest, without reopening.
Sourcepub fn move_to_vacant(&mut self, name: &str) -> Result<()>
pub fn move_to_vacant(&mut self, name: &str) -> Result<()>
Moves to a vacant sibling. On a post-move refusal name() still names
the recovery entry; callers must retain/report it and recover without
replacing any concurrent destination.
Trait Implementations§
Auto Trait Implementations§
impl Forget for GuardedFile
impl Freeze for GuardedFile
impl Move for GuardedFile
impl RefUnwindSafe for GuardedFile
impl Send for GuardedFile
impl Sync for GuardedFile
impl Unpin for GuardedFile
impl UnsafeUnpin for GuardedFile
impl UnwindSafe for GuardedFile
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.