Expand description
Blocking client for the mountOS native filesystem API over a Unix socket.
let c = mountos_native::Client::connect("/home/me/.mountOS/sockets/mountos_api_0123456789abcdef.sock")?;
let f = c.open("/a.txt", mountos_native::open_flag::READ_ONLY, 0)?;
let data = f.read_at(0, 4096)?;The server pushes notices (warm results, watch changes, closing) on the connection that made
the call. A reader thread per connection receives them, and Client::add_listener hands every
event to your listeners in order. Client::wait_warm and Client::watch build on the same
events. With no listener, events go to the logger in Options, or to stderr.
Re-exports§
pub use wire::open_flag;pub use wire::DirEntry;pub use wire::FileInfo;pub use wire::FileType;pub use wire::Range;pub use wire::StatfsInfo;
Modules§
- frame
- Wire frame codec. Mirrors the Go reference in go/frame/frame.go.
- wire
- Protobuf messages for package mountos.filesystem.v1, generated by build.rs from api/proto/mountos_fs.proto. Method IDs and result types come from the generated ops_gen module, open flags are constants from api/filesystem.yaml.
Structs§
- Client
- Client for one mount. Cheap to clone, clones share the pool, the listeners and the event
dispatcher. The last clone to drop closes everything.
closedoes it at once for all clones. - Dir
- An open remote directory. Bound to the connection that opened it, like
File. - Event
- One event from the server, or a local one (
Overflow,ConnectionLost). - File
- An open remote file. Calls on one file are serialized by a mutex. Different files on different pool connections run in parallel.
- Listener
Id - Handle for
Client::remove_listener. - Options
- Client settings.
- Watch
- A live watch. Iterating blocks until the next event. Only
ChangeandOverflowevents of this watch arrive here. When more than 256 events wait, the oldest are dropped and oneOverflowevent is delivered, which tells the caller to list the path again. - Write
Item - One write in
File::write_batch.
Enums§
- Change
Kind - How a watched path changed.
- Error
- Errors returned by the client.
- Event
Kind - Kind of an event.
Constants§
- DEFAULT_
MAX_ DIR_ ENTRIES - Most entries
read_dir_allholds. - DEFAULT_
MAX_ INFLIGHT - Default for
Options::max_inflight. - DEFAULT_
MAX_ WALK_ PENDING - Most directories
walkkeeps queued for later.
Functions§
- socket_
path - Computes the native API socket path of the mount at
mount_path.mount_pathis the path the mount was started with. The result is the same path the mount listens on. Nothing is created or checked on disk.
Type Aliases§
- Client
Options - Alias of
Options. - Logger
- Receives log lines. The line has no prefix and no newline.
- Result
- Stat
Result - Result of one path in
Client::stat_batch.