|
| int(* | open )(const char *path, int mode) |
| | -> handle (>=0) or -1.
|
| |
| int(* | read )(int handle, void *buf, size_t n) |
| | bytes read, or -1.
|
| |
| int(* | write )(int handle, const void *buf, size_t n) |
| | bytes written, or -1.
|
| |
| void(* | close )(int handle) |
| | release a file OR directory handle.
|
| |
| proto_bool(* | seek )(int handle, uint64_t off) |
| | absolute seek; false if unsupported.
|
| |
| long(* | size )(const char *path) |
| | file size, or -1 if absent.
|
| |
| proto_bool(* | exists )(const char *path) |
| | true if the path exists.
|
| |
| proto_bool(* | remove )(const char *path) |
| | delete a file; true on success.
|
| |
| proto_bool(* | rename )(const char *from, const char *to) |
| | rename; true on success.
|
| |
| proto_bool(* | mkdir )(const char *path) |
| | create a directory; true on success.
|
| |
| proto_bool(* | rmdir )(const char *path) |
| | remove an empty directory; true on success.
|
| |
| proto_bool(* | stat )(const char *path, protocore_mnt_stat *out) |
| | fill out for path; false if absent.
|
| |
| int(* | opendir )(const char *path) |
| | -> directory handle (>=0) or -1.
|
| |
| proto_bool(* | readdir )(int handle, protocore_mnt_stat *out, char *name, size_t name_cap) |
| | Next entry: facts into out, name into name (NUL-terminated). False at end.
|
| |
| proto_bool(* | sync )(int handle) |
| | Push everything written to handle past the backend's own buffering, and report whether it got there. May be NULL when the backend cannot promise it.
|
| |
A storage backend. Each open call returns a small handle (>= 0) or -1.
Implement this to add a store; the built-in RAM disk publishes one through MntRamNs::backend (server/storage/mnt_ram).
Every call here is one node. mnt is blind - it does not know what a path means, so it cannot know what a subtree is, and nothing here takes one. A whole-tree operation is composed from these by the accessor (server/storage/filesystem.h), which is the seam that does know.
Definition at line 87 of file mnt.h.
| proto_bool(* protocore_mnt_backend::sync) (int handle) |
Push everything written to handle past the backend's own buffering, and report whether it got there. May be NULL when the backend cannot promise it.
This is the durability barrier, and it is the one call here whose absence is not the same as failure: a log that orders its writes around a barrier is only power-loss-safe if the barrier is real, so a backend that cannot make the promise says so with NULL and the caller refuses to mount rather than running as though it had one. Returning true without doing anything would make an unsafe store indistinguishable from a safe one.
Definition at line 114 of file mnt.h.