Package edu.caltech.nanodb.storage

This package contains the classes for the Storage Manager, which is responsible for how data is stored in and retrieved from database files.

Startup Sequence

The start-up sequence for the storage layer is as follows:

  • The Storage Manager is initialized first.

    1. The StorageManager.initialize(edu.caltech.nanodb.server.NanoDBServer) method is invoked first.
    2. The directory for NanoDB's data files is determined.
    3. The StorageManager constructor is invoked.
    4. The FileManager is initialized, with the appropriate data directory.
    5. The BufferManager is initialized, wrapping the FileManager.
    6. File-managers for table-files and index-files are initialized at this point. Generally they don't need to do anything at initialization time; it's just a convenient time to initialize them.

Implementing New Tuple-File Formats

Adding new tuple-file formats to NanoDB should be reasonably straightforward, but there are several interfaces that must all be implemented for the tuple file to be operational inside NanoDB.

  • The core implementation of the tuple-file format must be provided as an implementation of the TupleFile interface, or one of its sub-interfaces. Depending on what the tuple-file format can provide, it may be appropriate to implement SequentialTupleFile for a format that maintains a logical ordering over all tuples, or HashedTupleFile for a format that supports constant-time tuple lookups using a subset of the tuple's columns. If none of these guarantees can be provided, then the TupleFile interface is the correct one to implement.
  • Certain operations on tuple files can't be provided on the TupleFile implementation itself, so they are provided by the TupleFileManager interface.