PKGFSCache manages virtual tree caching on disk. The motivations for this class can be found in a too long mount wait time. At PackageFS mount time, in fact, the daemon retrieves the names and the status of each package and then builds the whole directory hierarchy. This last operation includes asking the package manager for files and dependencies of each package. Although these requests are mostly satisfied by fast operations, they are however a large amount. Thus, we decided to save the virtual tree on disk in order to load it quickly.
In this way we theorically build the tree from scratch only once:
at the first mount operation. However, some checks
must be performed to keep consistency between the cached data and
the system status. If they fail, the daemon has to be able to mount
PackageFS anyway, caring not about the cache. The current implementation
checks for same
and
configuration
settings, and verifies that the package manager database
has not been updated since the last mount operation.
The PKGFSCache is
. At the moment
it is still a plain file, but it will become a binary one as soon
as the
class by Jason Gunthorpe is introduced in
PackageFS. The purpose of the
class is to provide
a generic way for clients to access the functions
and
. The first maps into the memory an amount
of bytes starting at a particular offset from the file (or other object)
specified by a file descriptor. The second one deletes the mappings
for a specified address range, and causes further references to addresses
within the range to generate invalid memory references.
A binary cache file will increase very much the virtual tree loading speed.
The PKGFSCache public interface consists of the following methods: