In this chapter, a portable design of persistent storage interface for C++ is presented. The requirements for a implementation of the design are a small set of standard system calls and main memory with linear logical address space. The design can be used as a foundation of an ODBMS.
Some commercial implementations of ODBMS's trap segmentation faults to map objects from persistent storages. [Khoshafian 93] To be sure, this approach to persistent objects does not alter the standard interface to object instantiations and references, but a pointer to a persistent object is a normal C++ pointer and can not be used as a persistent identity of the object. In addition, it is not easy to achieve portability by such addressing mechanism.
There are other implementations that do not trap segmentation faults to map objects and provide unique mechanisms for object identity other than normal pointers. These implementations require explicit conversion from a persistent identity of an object to a pointer to its representation in main memory.
The design in this chapter is aiming at the latter types. The dependency on the architecture of the platform operating system is at the minimum level. The design introduces a persistent pointer object convertible to a normal C++ pointer for manipulation of the pointed object. The persistent pointer also serves as the identity of the pointed object. There should be few restrictions on the construction of an ODBMS based on the persistent storage.
The design goals are summarized as follows:
The design goals can be depicted by an analogy of a bookshelf and a desk. Persistent objects in secondary storage are information in closed files on the bookshelf. Persistent objects mapped in main memory are information in files on the desk. Persistent objects the persistent pointers of which are converted to normal pointers are information in opened pages of the files on the desk.
The space on the desk is so limited that only a small part of the files on the bookshelf can be opened simultaneously. Nevertheless, the whole information on the bookshelf should be searched and modified smoothly. The problem is which files to bring out from the bookshelf and which files to bring back to the bookshelf during operations.