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. - Clone
Options - Settings for
clone_entryandclone_dir. Start fromCloneOptions::default()and chain thewith_methods. - 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). The client builds it. Callers only read the fields. - 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. - OpCounts
- Totals an operation reports when it ends.
- OpFailure
- One entry that failed inside an operation.
- OpResult
- How an operation ended.
- Operation
- A running or ended
clone_dirorremove_dir. It lives on the connection that started it. - Options
- Client settings. Start from
Options::default()and chain thewith_methods. New fields can be added in a minor version, so a struct literal does not compile outside this crate. - 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. Build it withWriteItem::new.
Enums§
- Change
Kind - How a watched path changed. New kinds can be added, so a
matchneeds a wildcard arm. - Clone
Outcome - What
clone_entrydid with the destination. New outcomes can be added. - Error
- Errors returned by the client. New variants can be added, so a
matchneeds a wildcard arm. - Event
Kind - Kind of an event. New kinds can be added, so a
matchneeds a wildcard arm. - Preserve
- Extra properties
clone_entryandclone_dircopy from the source. New kinds can be added.
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. - MAX_
OP_ FAILURES - Most failures an
Operationkeeps. The server sends at most this many per operation.OpCounts::failedcan be larger.
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.