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 methods
fn hard_link(&self, existing: &Path, new: &Path) -> Result<()> { ... }
fn conversion_environment(&self) -> ConversionEnvironment { ... }
}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§
Sourcefn hard_link(&self, existing: &Path, new: &Path) -> Result<()>
fn hard_link(&self, existing: &Path, new: &Path) -> Result<()>
Make new another name of the file existing; fails with EXDEV where the two sit in different subvolumes.
Sourcefn conversion_environment(&self) -> ConversionEnvironment
fn conversion_environment(&self) -> ConversionEnvironment
Which configuration files and system attributes file Git reads here. The default names no Git and no variables, so the system files are unknown and a content decision that needs them refuses; a stand-in overrides it with what a control needs, and the real platform answers for the Git it forwards to.
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.