On a quest for agency in Bellairs
1@0xa59e1c95e37fb55d;
2
3interface Directory {
4 # Represents a directory in the filesystem
5
6 list @0 () -> (entries :List(Entry));
7 # Lists all entries in the directory
8
9 struct Entry {
10 name @0 :Text; # Name of the entry
11 file @1 :File; # Reference to the file object
12 }
13
14 create @1 (name :Text) -> (file :File);
15 # Creates a new file with the given name
16
17 open @2 (name :Text) -> (file :File);
18 # Opens an existing file with the given name
19
20 delete @3 (name :Text);
21 # Deletes a file with the given name
22}
23
24interface File {
25 # Represents a file in the filesystem
26
27 size @0 () -> (size :UInt64);
28 # Returns the size of the file in bytes
29
30 read @1 (off :UInt64 = 0, len :UInt64 = 0xffffffffffffffff) -> (data :Data);
31 # Reads data from the file, optionally starting at offset and reading up to len bytes
32 # Default is to read the entire file
33}
34