Overview
Archives represent on-disk files and directories. They support
basic operations such as file lookups and directory listing.
From the perspective of the jvvfs
filesystem, an archive is an opaque value that returns responses
to queries made relative to the directory at which the archive is
mounted.
The directory at which a given archive is mounted is stored along
with the archive and is accessible.
Lookup
Archives contain files and directories, each of which have
unique paths. One of the primitive operations supported by
archives is returning a reference to one these filesystem objects
when given a path.
Archives expose their contents as
opaque file references. The jvvfs
filesystem does not expose these references to the user, but they
are used here to express further properties of archives. As stated,
a referenced object must either be a file or a directory.
Looking up an object in an archive is an effectful computation that will
return an optional file reference on success.
The function returns None for
a path p iff all ancestors
of p exist and are directories, but
no object exists at p. The function
returns Some r iff all ancestors
of p exist and are directories and
an object exists at p, where
r is a reference to the object at
p. Otherwise, the function returns an
error. Some specific error cases are described below.
If the path p refers to a file in
the archive a, then attempting to
call archive_lookup on any
q where
is_ancestor_of p q must clearly
fail (because only directories can have children).
Additionally, if archive_lookup yields
a reference to anything for some q,
then it must yield a reference to a directory for all
p where
is_ancestor_of p q.