pub trait HostDescriptorWithStore: HasData + Send {
Show 25 methods
// Required methods
fn read_via_stream<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
offset: Filesize,
) -> Result<(StreamReader<u8>, FutureReader<Result<(), ErrorCode>>)>;
fn write_via_stream<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
data: StreamReader<u8>,
offset: Filesize,
) -> Result<FutureReader<Result<(), ErrorCode>>>;
fn append_via_stream<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
data: StreamReader<u8>,
) -> Result<FutureReader<Result<(), ErrorCode>>>;
fn advise<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
offset: Filesize,
length: Filesize,
advice: Advice,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn sync_data<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn get_flags<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<DescriptorFlags, FilesystemError>> + Send;
fn get_type<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<DescriptorType, FilesystemError>> + Send;
fn set_size<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
size: Filesize,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn set_times<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
data_access_timestamp: NewTimestamp,
data_modification_timestamp: NewTimestamp,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn read_directory<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
) -> Result<(StreamReader<DirectoryEntry>, FutureReader<Result<(), ErrorCode>>)>;
fn sync<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn create_directory_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn stat<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<DescriptorStat, FilesystemError>> + Send;
fn stat_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
) -> impl Future<Output = Result<DescriptorStat, FilesystemError>> + Send;
fn set_times_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
data_access_timestamp: NewTimestamp,
data_modification_timestamp: NewTimestamp,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn link_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
old_path_flags: PathFlags,
old_path: String,
new_descriptor: Resource<Descriptor>,
new_path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn open_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
open_flags: OpenFlags,
flags: DescriptorFlags,
) -> impl Future<Output = Result<Resource<Descriptor>, FilesystemError>> + Send;
fn readlink_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<String, FilesystemError>> + Send;
fn remove_directory_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn rename_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
old_path: String,
new_descriptor: Resource<Descriptor>,
new_path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn symlink_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
old_path: String,
new_path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn unlink_file_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send;
fn is_same_object<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
other: Resource<Descriptor>,
) -> impl Future<Output = Result<bool>> + Send;
fn metadata_hash<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<MetadataHashValue, FilesystemError>> + Send;
fn metadata_hash_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
) -> impl Future<Output = Result<MetadataHashValue, FilesystemError>> + Send;
}p3 only.Required Methods§
Sourcefn read_via_stream<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
offset: Filesize,
) -> Result<(StreamReader<u8>, FutureReader<Result<(), ErrorCode>>)>
fn read_via_stream<T>( host: Access<'_, T, Self>, self_: Resource<Descriptor>, offset: Filesize, ) -> Result<(StreamReader<u8>, FutureReader<Result<(), ErrorCode>>)>
Return a stream for reading from a file.
Multiple read, write, and append streams may be active on the same open file and they do not interfere with each other.
This function returns a stream which provides the data received from the
file, and a future providing additional error information in case an
error is encountered.
If no error is encountered, stream.read on the stream will return
read-status::closed with no error-context and the future resolves to
the value ok. If an error is encountered, stream.read on the
stream returns read-status::closed with an error-context and the future
resolves to err with an error-code.
Note: This is similar to pread in POSIX.
Sourcefn write_via_stream<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
data: StreamReader<u8>,
offset: Filesize,
) -> Result<FutureReader<Result<(), ErrorCode>>>
fn write_via_stream<T>( host: Access<'_, T, Self>, self_: Resource<Descriptor>, data: StreamReader<u8>, offset: Filesize, ) -> Result<FutureReader<Result<(), ErrorCode>>>
Return a stream for writing to a file, if available.
May fail with an error-code describing why the file cannot be written.
It is valid to write past the end of a file; the file is extended to the extent of the write, with bytes between the previous end and the start of the write set to zero.
This function returns once either full contents of the stream are written or an error is encountered.
Note: This is similar to pwrite in POSIX.
Sourcefn append_via_stream<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
data: StreamReader<u8>,
) -> Result<FutureReader<Result<(), ErrorCode>>>
fn append_via_stream<T>( host: Access<'_, T, Self>, self_: Resource<Descriptor>, data: StreamReader<u8>, ) -> Result<FutureReader<Result<(), ErrorCode>>>
Return a stream for appending to a file, if available.
May fail with an error-code describing why the file cannot be appended.
This function returns once either full contents of the stream are written or an error is encountered.
Note: This is similar to write with O_APPEND in POSIX.
Sourcefn advise<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
offset: Filesize,
length: Filesize,
advice: Advice,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn advise<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, offset: Filesize, length: Filesize, advice: Advice, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Provide file advisory information on a descriptor.
This is similar to posix_fadvise in POSIX.
Sourcefn sync_data<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn sync_data<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Synchronize the data of a file to disk.
This function succeeds with no effect if the file descriptor is not opened for writing.
Note: This is similar to fdatasync in POSIX.
Sourcefn get_flags<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<DescriptorFlags, FilesystemError>> + Send
fn get_flags<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, ) -> impl Future<Output = Result<DescriptorFlags, FilesystemError>> + Send
Get flags associated with a descriptor.
Note: This returns similar flags to fcntl(fd, F_GETFL) in POSIX.
Note: This returns the value that was the fs_flags value returned
from fdstat_get in earlier versions of WASI.
Sourcefn get_type<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<DescriptorType, FilesystemError>> + Send
fn get_type<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, ) -> impl Future<Output = Result<DescriptorType, FilesystemError>> + Send
Get the dynamic type of a descriptor.
Note: This returns the same value as the type field of the fd-stat
returned by stat, stat-at and similar.
Note: This returns similar flags to the st_mode & S_IFMT value provided
by fstat in POSIX.
Note: This returns the value that was the fs_filetype value returned
from fdstat_get in earlier versions of WASI.
Sourcefn set_size<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
size: Filesize,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn set_size<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, size: Filesize, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Adjust the size of an open file. If this increases the file’s size, the extra bytes are filled with zeros.
Note: This was called fd_filestat_set_size in earlier versions of WASI.
Sourcefn set_times<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
data_access_timestamp: NewTimestamp,
data_modification_timestamp: NewTimestamp,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn set_times<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Adjust the timestamps of an open file or directory.
Note: This is similar to futimens in POSIX.
Note: This was called fd_filestat_set_times in earlier versions of WASI.
Sourcefn read_directory<T>(
host: Access<'_, T, Self>,
self_: Resource<Descriptor>,
) -> Result<(StreamReader<DirectoryEntry>, FutureReader<Result<(), ErrorCode>>)>
fn read_directory<T>( host: Access<'_, T, Self>, self_: Resource<Descriptor>, ) -> Result<(StreamReader<DirectoryEntry>, FutureReader<Result<(), ErrorCode>>)>
Read directory entries from a directory.
On filesystems where directories contain entries referring to themselves
and their parents, often named . and .. respectively, these entries
are omitted.
This always returns a new stream which starts at the beginning of the directory. Multiple streams may be active on the same directory, and they do not interfere with each other.
This function returns a future, which will resolve to an error code if reading full contents of the directory fails.
Sourcefn sync<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn sync<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Synchronize the data and metadata of a file to disk.
This function succeeds with no effect if the file descriptor is not opened for writing.
Note: This is similar to fsync in POSIX.
Sourcefn create_directory_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn create_directory_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path: String, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Create a directory.
Note: This is similar to mkdirat in POSIX.
Sourcefn stat<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<DescriptorStat, FilesystemError>> + Send
fn stat<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, ) -> impl Future<Output = Result<DescriptorStat, FilesystemError>> + Send
Return the attributes of an open file or directory.
Note: This is similar to fstat in POSIX, except that it does not return
device and inode information. For testing whether two descriptors refer to
the same underlying filesystem object, use is-same-object. To obtain
additional data that can be used do determine whether a file has been
modified, use metadata-hash.
Note: This was called fd_filestat_get in earlier versions of WASI.
Sourcefn stat_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
) -> impl Future<Output = Result<DescriptorStat, FilesystemError>> + Send
fn stat_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, ) -> impl Future<Output = Result<DescriptorStat, FilesystemError>> + Send
Return the attributes of a file or directory.
Note: This is similar to fstatat in POSIX, except that it does not
return device and inode information. See the stat description for a
discussion of alternatives.
Note: This was called path_filestat_get in earlier versions of WASI.
Sourcefn set_times_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
data_access_timestamp: NewTimestamp,
data_modification_timestamp: NewTimestamp,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn set_times_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Adjust the timestamps of a file or directory.
Note: This is similar to utimensat in POSIX.
Note: This was called path_filestat_set_times in earlier versions of
WASI.
Sourcefn link_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
old_path_flags: PathFlags,
old_path: String,
new_descriptor: Resource<Descriptor>,
new_path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn link_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, old_path_flags: PathFlags, old_path: String, new_descriptor: Resource<Descriptor>, new_path: String, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Create a hard link.
Fails with error-code::no-entry if the old path does not exist,
with error-code::exist if the new path already exists, and
error-code::not-permitted if the old path is not a file.
Note: This is similar to linkat in POSIX.
Sourcefn open_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
open_flags: OpenFlags,
flags: DescriptorFlags,
) -> impl Future<Output = Result<Resource<Descriptor>, FilesystemError>> + Send
fn open_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, open_flags: OpenFlags, flags: DescriptorFlags, ) -> impl Future<Output = Result<Resource<Descriptor>, FilesystemError>> + Send
Open a file or directory.
If flags contains descriptor-flags::mutate-directory, and the base
descriptor doesn’t have descriptor-flags::mutate-directory set,
open-at fails with error-code::read-only.
If flags contains write or mutate-directory, or open-flags
contains truncate or create, and the base descriptor doesn’t have
descriptor-flags::mutate-directory set, open-at fails with
error-code::read-only.
Note: This is similar to openat in POSIX.
Sourcefn readlink_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<String, FilesystemError>> + Send
fn readlink_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path: String, ) -> impl Future<Output = Result<String, FilesystemError>> + Send
Read the contents of a symbolic link.
If the contents contain an absolute or rooted path in the underlying
filesystem, this function fails with error-code::not-permitted.
Note: This is similar to readlinkat in POSIX.
Sourcefn remove_directory_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn remove_directory_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path: String, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Remove a directory.
Return error-code::not-empty if the directory is not empty.
Note: This is similar to unlinkat(fd, path, AT_REMOVEDIR) in POSIX.
Sourcefn rename_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
old_path: String,
new_descriptor: Resource<Descriptor>,
new_path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn rename_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, old_path: String, new_descriptor: Resource<Descriptor>, new_path: String, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Rename a filesystem object.
Note: This is similar to renameat in POSIX.
Sourcefn symlink_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
old_path: String,
new_path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn symlink_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, old_path: String, new_path: String, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Create a symbolic link (also known as a “symlink”).
If old-path starts with /, the function fails with
error-code::not-permitted.
Note: This is similar to symlinkat in POSIX.
Sourcefn unlink_file_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path: String,
) -> impl Future<Output = Result<(), FilesystemError>> + Send
fn unlink_file_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path: String, ) -> impl Future<Output = Result<(), FilesystemError>> + Send
Unlink a filesystem object that is not a directory.
This is similar to unlinkat(fd, path, 0) in POSIX.
Error returns are as specified by POSIX.
If the filesystem object is a directory, error-code::access or
error-code::is-directory may be returned instead of the
POSIX-specified error-code::not-permitted.
Sourcefn is_same_object<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
other: Resource<Descriptor>,
) -> impl Future<Output = Result<bool>> + Send
fn is_same_object<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, other: Resource<Descriptor>, ) -> impl Future<Output = Result<bool>> + Send
Test whether two descriptors refer to the same filesystem object.
In POSIX, this corresponds to testing whether the two descriptors have the
same device (st_dev) and inode (st_ino or d_ino) numbers.
wasi-filesystem does not expose device and inode numbers, so this function
may be used instead.
Sourcefn metadata_hash<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
) -> impl Future<Output = Result<MetadataHashValue, FilesystemError>> + Send
fn metadata_hash<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, ) -> impl Future<Output = Result<MetadataHashValue, FilesystemError>> + Send
Return a hash of the metadata associated with a filesystem object referred to by a descriptor.
This returns a hash of the last-modification timestamp and file size, and may also include the inode number, device number, birth timestamp, and other metadata fields that may change when the file is modified or replaced. It may also include a secret value chosen by the implementation and not otherwise exposed.
Implementations are encouraged to provide the following properties:
- If the file is not modified or replaced, the computed hash value should usually not change.
- If the object is modified or replaced, the computed hash value should usually change.
- The inputs to the hash should not be easily computable from the computed hash.
However, none of these is required.
Sourcefn metadata_hash_at<T: Send>(
accessor: &Accessor<T, Self>,
self_: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
) -> impl Future<Output = Result<MetadataHashValue, FilesystemError>> + Send
fn metadata_hash_at<T: Send>( accessor: &Accessor<T, Self>, self_: Resource<Descriptor>, path_flags: PathFlags, path: String, ) -> impl Future<Output = Result<MetadataHashValue, FilesystemError>> + Send
Return a hash of the metadata associated with a filesystem object referred to by a directory descriptor and a relative path.
This performs the same hash computation as metadata-hash.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.