pub struct MigrationDirectory { /* private fields */ }Expand description
A retained cross-platform capability for one migration directory.
Every child operation is relative to the open directory handle. The workspace constructor walks each component with no-follow semantics, so a concurrent rename or symlink replacement of the configured pathname cannot redirect later discovery or publication.
Implementations§
Source§impl MigrationDirectory
impl MigrationDirectory
Sourcepub fn open_ambient(path: &Path) -> Result<Self>
pub fn open_ambient(path: &Path) -> Result<Self>
Open an ambient path for compatibility callers of the path-based APIs.
Sourcepub fn open_beneath(root: &Path, relative: &Path, create: bool) -> Result<Self>
pub fn open_beneath(root: &Path, relative: &Path, create: bool) -> Result<Self>
Open a confined relative directory beneath an ambient root.
Each component is opened without following a final symlink. When
create is true, missing components are created relative to the
already retained parent handle and then opened under the same rule.
Sourcepub fn open_beneath_directory(
root: &Dir,
relative: &Path,
create: bool,
) -> Result<Self>
pub fn open_beneath_directory( root: &Dir, relative: &Path, create: bool, ) -> Result<Self>
Open a confined relative directory beneath a retained root capability.
Unlike Self::open_beneath, this never resolves the root through an
ambient pathname. Replacing or relinking the name by which the caller
originally opened root therefore cannot redirect this operation.
Sourcepub fn entries(&self, limit: usize) -> Result<Vec<MigrationDirectoryEntry>>
pub fn entries(&self, limit: usize) -> Result<Vec<MigrationDirectoryEntry>>
Enumerate at most limit direct entries through the retained handle.
Sourcepub fn open_regular_readonly(&self, name: &OsStr) -> Result<File>
pub fn open_regular_readonly(&self, name: &OsStr) -> Result<File>
Open one direct regular child for reading without following a symlink.
Sourcepub fn open_regular_lock(&self, name: &OsStr) -> Result<File>
pub fn open_regular_lock(&self, name: &OsStr) -> Result<File>
Open or create one direct regular read-write child without following a symlink.
Acquire the canonical migration-authoring lock without waiting.
A lock held by another publisher surfaces as io::ErrorKind::WouldBlock
on every platform.
Sourcepub fn create_new(&self, name: &OsStr) -> Result<File>
pub fn create_new(&self, name: &OsStr) -> Result<File>
Exclusively create one direct regular child without following a symlink.
Sourcepub fn entry_exists(&self, name: &OsStr) -> Result<bool>
pub fn entry_exists(&self, name: &OsStr) -> Result<bool>
Return whether any direct entry occupies name, without following it.
Sourcepub fn remove_file(&self, name: &OsStr) -> Result<()>
pub fn remove_file(&self, name: &OsStr) -> Result<()>
Remove one direct file or symlink entry.