next up previous contents
Next: Conclusioni Up: Classes details Previous: Public methods implementation   Indice


PKGFSCache

Figura 5.11: The PKGFSCache class
      \includegraphics{headersUML/pkgfscacheUML.eps}

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 $ \texttt{Section}$ and $ \texttt{Priority}$ configuration settings, and verifies that the package manager database has not been updated since the last mount operation.

The PKGFSCache is $ \texttt{/var/cache/pkgfs/cache.bin}$. At the moment it is still a plain file, but it will become a binary one as soon as the $ \texttt{MMap()}$ class by Jason Gunthorpe is introduced in PackageFS. The purpose of the $ \texttt{MMap()}$ class is to provide a generic way for clients to access the functions $ \texttt{mmap()}$ and $ \texttt{munmap()}$. 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:


next up previous contents
Next: Conclusioni Up: Classes details Previous: Public methods implementation   Indice
2004-11-19