dckc / awesome-ocap

Awesome Object Capabilities and Capability Security
The Unlicense
335 stars 24 forks source link

Emily file API - pattern? #27

Open dckc opened 2 years ago

dckc commented 2 years ago

https://github.com/Agoric/agoric-sdk/pull/4987#discussion_r841111422

A separate lookupAdmin method? hm. This structure reminds me of the Emily file API (which I have ported to python umpteen times, none of which is handy just now).

Ah... actually, it had subEdFiles and subRdFiles just like we have lookup and lookupAdmin here. Fair enough.

type readable = {
isDir : unit -> bool;
exists : unit -> bool;
subRdFiles : unit -> readable list;
subRdFile : string -> readable;
inChannel : unit -> in_channel;
getBytes : unit -> string;
fullPath : unit -> string;
}
type editable = {
ro : readable;
subEdFiles : unit -> editable list;
subEdFile : string -> editable;
outChannel : unit -> out_channel;
setBytes : string -> unit;
mkDir : unit -> unit;
createNewFile : unit -> unit;
delete : unit -> unit;
}