cberner / fuser

Filesystem in Userspace (FUSE) for Rust
MIT License
836 stars 114 forks source link

Sans-io core: Make low-level request API more complete and self-contained #119

Closed wmanley closed 3 years ago

wmanley commented 3 years ago

With this change every operation (enum variant of ll::request::Operation) is now its own fully-fledged opaque struct. Data is accessed through accessor function. The usual sync trait API is unchanged, but is now a simple wrapper around the ll::Request. This is intended to compliment #112 by separating the bits that don't involve i/o (or blocking) from the bits that do.

The eventual intention is for ll::Request to become an API in its own right on top of which the traditional sync trait or future async APIs can be built. It contains no I/O functions and only operates on buffers provided to it (the sans-io approach). Dealing with the enum based Request API provides additional flexibility - particularly WRT threading and async. The user will eventually be able to pull a chunk of data from the FUSE device and send it to a rayon threadpool, or an async executor, etc. to process it.

Every operation corresponds to an opaque struct. We can make additions without breaking backwards compatibility. In particular in the future I'd like to make it so we can support multiple ABI versions concurrently - and this API supports that.

There is no public API break intended.

There is more work to be done to bring the vision to completion, but ideally I'd like to merge this work incrementally, rather than making a change in a big bang. I've been careful not to break any APIs, keeping the change entirely internal for now, so that it can be merged rather than getting stuck on a long lived branch :).

The next step is a low-level reply API, but I've not started work on that yet.

ianoc commented 3 years ago

This looks great to me! I think there are some other spots(but maybe the same type) of the .0 and .1 accessors that are worth removing, i left a minor other request/comment. But all super minor.

cberner commented 3 years ago

Merged. Thanks!