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§
Sourcefn is_subvolume_root(&self, path: &Path) -> bool
fn is_subvolume_root(&self, path: &Path) -> bool
Whether path is the root of a subvolume.
Sourcefn removal_allowed(&self, path: &Path) -> bool
fn removal_allowed(&self, path: &Path) -> bool
Whether an unprivileged destroy is allowed on the mount holding path.
Sourcefn check_clean(
&self,
request: &RemoveRequest<'_>,
admin: &Path,
common_dir: &Path,
) -> Result<(), String>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl RemoveOperations for LinuxOperations
Every operation is the primitive of the same name.