pub struct AppRoot { /* private fields */ }Expand description
<Orthic Labs>/<App>, created private.
Implementations§
Source§impl AppRoot
impl AppRoot
pub fn new(suite: &Suite, app: &str) -> Result<AppRoot, AppRootError>
pub fn name(&self) -> &str
pub fn root(&self) -> &Path
Sourcepub fn path(&self, rel: impl AsRef<Path>) -> Result<PathBuf, AppRootError>
pub fn path(&self, rel: impl AsRef<Path>) -> Result<PathBuf, AppRootError>
<app root>/<rel> without creating anything. rel must be relative and made only of
normal components (no .., ., root, prefix or empty); any existing ancestor that is a
symlink must still resolve inside the app root.
Sourcepub fn data_dir(&self, rel: impl AsRef<Path>) -> Result<PathBuf, AppRootError>
pub fn data_dir(&self, rel: impl AsRef<Path>) -> Result<PathBuf, AppRootError>
A private directory at <app root>/<rel>, created if absent.
Sourcepub fn lock_writer(&self) -> Result<WriterLock, AppRootError>
pub fn lock_writer(&self) -> Result<WriterLock, AppRootError>
Take the single-writer lock for this app root. Err(WriterBusy) if another holder lives.
Sourcepub fn migrate_from(&self, src: &Path) -> Result<MigrationOutcome, AppRootError>
pub fn migrate_from(&self, src: &Path) -> Result<MigrationOutcome, AppRootError>
Copy the old root src into this app root, verify every byte, then commit an atomic
marker. Restart-safe: files land under a temporary name and are renamed only when fully
written; a rerun after any interruption re-copies missing or partial files, accepts files
already identical, and refuses (never overwrites) a differing destination file. The marker
is written last; once present for this source the call is a no-op. src is never changed
or deleted. Symlinks and special files in src are refused. Takes the writer lock.