Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(0.3): asyncify read-directory
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
rvolosatovs committed Jan 15, 2025
1 parent b8a2536 commit 8e315f4
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions wit-0.3.0-draft/types.wit
Original file line number Diff line number Diff line change
@@ -411,8 +411,11 @@ interface types {
/// 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.
@since(version = 0.3.0)
read-directory: func() -> result<directory-entry-stream, error-code>;
read-directory: func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;

/// Synchronize the data and metadata of a file to disk.
///
@@ -619,12 +622,4 @@ interface types {
path: string,
) -> result<metadata-hash-value, error-code>;
}

/// A stream of directory entries.
@since(version = 0.3.0)
resource directory-entry-stream {
/// Read a single directory entry from a `directory-entry-stream`.
@since(version = 0.3.0)
read-directory-entry: func() -> result<option<directory-entry>, error-code>;
}
}

0 comments on commit 8e315f4

Please sign in to comment.