Skip to content

Questions about WasiDir #5025

@npmccallum

Description

@npmccallum

There are a number of aspects to WasiDir that are unclear to me. For completeness, I'll paste the full definition here and put questions in comments.

#[wiggle::async_trait]
pub trait WasiDir: Send + Sync {
    /// Does path contain segments? Should we follow symlinks? Should we create intermediate dirs?
    async fn create_dir(&self, path: &str) -> Result<(), Error>;

    /// Does path contain segments? Should we follow symlinks?
    async fn symlink(&self, old_path: &str, new_path: &str) -> Result<(), Error>;

    /// Does path contain segments? Should we follow symlinks?
    async fn remove_dir(&self, path: &str) -> Result<(), Error>;
    
    /// Does path contain segments? Should we follow symlinks?
    async fn unlink_file(&self, path: &str) -> Result<(), Error>;
    
    /// Does path contain segments? Should we follow symlinks?
    async fn read_link(&self, path: &str) -> Result<PathBuf, Error>;

    /// Does path/dest_path contain segments? Should we follow symlinks?
    async fn rename(
        &self,
        path: &str,
        dest_dir: &dyn WasiDir,
        dest_path: &str,
    ) -> Result<(), Error>;

    /// Does path/target_path contain segments? Should we follow symlinks?
    async fn hard_link(
        &self,
        path: &str,
        target_dir: &dyn WasiDir,
        target_path: &str,
    ) -> Result<(), Error>;

    /// There does not appear to be any way to set the times on the directory itself. Is this by design?
    async fn set_times(
        &self,
        path: &str,
        atime: Option<SystemTimeSpec>,
        mtime: Option<SystemTimeSpec>,
        follow_symlinks: bool,
    ) -> Result<(), Error>;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions