Skip to main content

RemoveOperations

Trait RemoveOperations 

Source
pub trait RemoveOperations {
    // Required methods
    fn is_subvolume_root(&self, path: &Path) -> bool;
    fn removal_allowed(&self, path: &Path) -> bool;
    fn check_clean(
        &self,
        request: &RemoveRequest<'_>,
        admin: &Path,
        common_dir: &Path,
    ) -> Result<(), String>;
    fn destroy(&self, held: &Held) -> Result<(), String>;
}
Expand description

What: The operations of one removal that touch the kernel or start Git, behind one trait. &self borrows the implementation read-only; dyn RemoveOperations is how a caller holds “any implementation” (a TS interface). Why: The ordering of the checks is the same on any filesystem; a stand-in lets the controls run it on a plain directory tree, and swap objects between two steps to prove the identity checks.

In TS you’d write (pseudocode):

interface RemoveOperations { isSubvolumeRoot(path): boolean; removalAllowed(path): boolean; checkClean(...): void; destroy(held): void }

Required Methods§

Source

fn is_subvolume_root(&self, path: &Path) -> bool

Whether path is the root of a subvolume.

Source

fn removal_allowed(&self, path: &Path) -> bool

Whether an unprivileged destroy is allowed on the mount holding path.

Source

fn check_clean( &self, request: &RemoveRequest<'_>, admin: &Path, common_dir: &Path, ) -> Result<(), String>

The proof that the worktree is clean, or the reason it is not proven.

Source

fn destroy(&self, held: &Held) -> Result<(), String>

Destroy the subvolume that held holds, and nothing else.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl RemoveOperations for LinuxOperations

Every operation is the primitive of the same name.