pub trait Platform {
// Required methods
fn filesystem_facts(
&self,
path: &Path,
) -> Result<(FilesystemKind, u64), PrimitiveError>;
fn is_subvolume_root(&self, path: &Path) -> Result<bool, PrimitiveError>;
fn create_subvolume(&self, path: &Path) -> Result<(), PrimitiveError>;
fn destroy_subvolume(&self, path: &Path) -> Result<(), PrimitiveError>;
fn removal_allowed(&self, path: &Path) -> bool;
fn is_mount_point(&self, path: &Path) -> bool;
fn clone_file(
&self,
source: &File,
destination: &File,
path: &Path,
) -> Result<(), PrimitiveError>;
fn exchange(
&self,
first: &Path,
second: &Path,
) -> Result<(), PrimitiveError>;
// Provided method
fn hard_link(&self, existing: &Path, new: &Path) -> Result<()> { ... }
}Expand description
What:
The operations of the migration that depend on the kind of filesystem.
&self borrows the platform read-only so one platform serves a whole run; dyn Platform is how a caller holds
“any implementation” (TS interface).
Why:
See the module description.
In TS you’d write (pseudocode):
interface Platform { ... }Required Methods§
Sourcefn filesystem_facts(
&self,
path: &Path,
) -> Result<(FilesystemKind, u64), PrimitiveError>
fn filesystem_facts( &self, path: &Path, ) -> Result<(FilesystemKind, u64), PrimitiveError>
The filesystem kind holding path and the bytes free there.
Sourcefn is_subvolume_root(&self, path: &Path) -> Result<bool, PrimitiveError>
fn is_subvolume_root(&self, path: &Path) -> Result<bool, PrimitiveError>
Whether path is the root of a subvolume.
Sourcefn create_subvolume(&self, path: &Path) -> Result<(), PrimitiveError>
fn create_subvolume(&self, path: &Path) -> Result<(), PrimitiveError>
Create an empty subvolume at path.
Sourcefn destroy_subvolume(&self, path: &Path) -> Result<(), PrimitiveError>
fn destroy_subvolume(&self, path: &Path) -> Result<(), PrimitiveError>
Destroy the subvolume at path with the kernel call (the caller falls back to emptying and rmdir).
Sourcefn removal_allowed(&self, path: &Path) -> bool
fn removal_allowed(&self, path: &Path) -> bool
Whether an unprivileged subvolume destroy is allowed on the mount holding path.
Sourcefn is_mount_point(&self, path: &Path) -> bool
fn is_mount_point(&self, path: &Path) -> bool
Whether path is itself a mount point (a mount point cannot be exchanged).
Sourcefn clone_file(
&self,
source: &File,
destination: &File,
path: &Path,
) -> Result<(), PrimitiveError>
fn clone_file( &self, source: &File, destination: &File, path: &Path, ) -> Result<(), PrimitiveError>
Clone a whole file’s data blocks.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Platform for LinuxPlatform
The primitives, called as they are.