pub const FILES: ModuleSchema;Expand description
files: reading and writing a rooted directory, whole and a line at a
time.
This is the first host whose operations disagree about Effect, and the
disagreement is real: read, exists, and list leave the filesystem
exactly as they found it, while write and delete destroy whatever was
there before and no host can put it back. Nothing in the language consults
effect — cove impact is its eventual consumer — but the runtime does:
it counts the calls that changed the world, and cove run --stats reports
the count, so a run says how much of what it did cannot be undone.
read, exists, and list are cancellable for the same reason
clock.sleep is: abandoning one leaves nothing outside the run different.
write and delete are not, because a call already in flight may already
have reached the disk.
open and create issue the two resource kinds, so a program can move a
file that it does not want to hold. Neither is task-safe, and they are the
first shipped resources that are not: a reader is a position in a file and
a writer is a position in another, so two tasks taking turns at one of
them each receive some of the lines and neither receives the file. ADR
0018 says why that is a mistake to refuse rather than a race to serialize,
and why a reader answers lines rather than bytes.