Skip to main content

Crate mountos_native

Crate mountos_native 

Source
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. close does 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.
ListenerId
Handle for Client::remove_listener.
Options
Client settings.
Watch
A live watch. Iterating blocks until the next event. Only Change and Overflow events of this watch arrive here. When more than 256 events wait, the oldest are dropped and one Overflow event is delivered, which tells the caller to list the path again.
WriteItem
One write in File::write_batch.

Enums§

ChangeKind
How a watched path changed.
Error
Errors returned by the client.
EventKind
Kind of an event.

Constants§

DEFAULT_MAX_DIR_ENTRIES
Most entries read_dir_all holds.
DEFAULT_MAX_INFLIGHT
Default for Options::max_inflight.
DEFAULT_MAX_WALK_PENDING
Most directories walk keeps queued for later.

Functions§

socket_path
Computes the native API socket path of the mount at mount_path. mount_path is 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§

ClientOptions
Alias of Options.
Logger
Receives log lines. The line has no prefix and no newline.
Result
StatResult
Result of one path in Client::stat_batch.