The Non Volatile Container Class Library (NVContainer Class Library) provides a set of containers storing their data structures on non volatile (external) memory (e.g., on the hard disk).
Since the NVContainer classes store their data on external memory, they reduce the virtual memory used by a process using this library. In addition this approach allows that the database provided by an NVContainer class can be used by several processes concurrently. Hence an NVContainer class can be used for the provision of ``shared memory'' too.
The use of a memory mapped file has the following advantages and disadvantages:
mmap
system-call. This might
decrease the performance slightly.
The NVContainer class consists of an abstract parent class (NVcontainer ) providing the basic functionality necessary in all its subclasses. The NVcontainer manages the memory allocation and deallocation of the non volatile memory and provides functions for locking and unlocking of the external memory. The latter is necessary to ensure mutual exclusion between different processes that access the database provided by an NVContainer class simultaneously.
The current version of the NVContainer Class Library provides a Non Volatile List (NVList) and a Non Volatile Hash (NVHash) class. Both are subclasses of the abstract class NVlist . NVlist is a direct subclass of NVcontainer and implements basic list operations. In future versions of the NVContainer Class Library we will also provide classes storing their data using trees, arrays and other data structures. Each container class comes with an iterator that allows to access the data stored within the class. Figure 5.10 shows the hierarchy of the classes provided by the NVContainer Class Library . Classes being planned for future releases (e.g., NVtree ) are shown using gray color.
This class uses a list to store its data. Whenever an NVList class is instantiated it creates a new file to store its data or if the file already exists it uses the contents stored in this file. The NVListIter class is used to iterate over an NVList class.
This class uses a hash table to store its data. Whenever an NVHash class is instantiated a new file to hold the class's data is created. If the file already exists the contents of this file will be used for the hash table. The NVHashIter class is used to iterate over an NVHash class.
VActiveDB implements an active database stored on volatile memory. It is used for the RServer class, because this class does not need to store its databases on external memory.
NVActiveDB implements an active database stored on non volatile memory. To offer this the NVActiveDB inherits the functionality provided by the NVHash class. The class is used for the news server classes that need to maintain a local news database. These are the LServer and CServer classes.
The overview database has been introduced to allow news readers a faster access to these data. Without this extension the news reader would have to retrieve the article header for each article, which increases the required network bandwidth and the time necessary to prepare the listing of available articles.
The overview database uses the same design as the active database. It consists of an abstract parent class (OverviewDB ) defining the interface and the subclasses VOverviewDB and NVOverviewDB .
We adopted this scheme for the News Cache, because we did not want to use a relational database to store articles on the one hand. This has been explained in section 4.4.1. And on the other hand the News Cache does not store as many articles as a news server. Nevertheless, the format of the article database may change in future versions of the News Cache.