Class BTreeTupleFileManager

java.lang.Object
edu.caltech.nanodb.storage.btreefile.BTreeTupleFileManager
All Implemented Interfaces:
TupleFileManager

public class BTreeTupleFileManager extends Object implements TupleFileManager
This class provides high-level operations on B+ tree tuple files.
  • Field Details

    • logger

      private static org.apache.logging.log4j.Logger logger
      A logging object for reporting anything interesting that happens.
    • storageManager

      private StorageManager storageManager
      A reference to the storage manager.
  • Constructor Details

    • BTreeTupleFileManager

      public BTreeTupleFileManager(StorageManager storageManager)
  • Method Details

    • getDBFileType

      public DBFileType getDBFileType()
      Description copied from interface: TupleFileManager
      Returns the DBFileType value used to indicate this storage format in data files.
      Specified by:
      getDBFileType in interface TupleFileManager
      Returns:
      the DBFileType value used to indicate this storage format in data files.
    • getShortName

      public String getShortName()
      Description copied from interface: TupleFileManager
      Returns the "short name" used to refer to this storage-file type. This is the name used in e.g. CREATE TABLE commands to specify that a table-file should use a particular storage-file type.
      Specified by:
      getShortName in interface TupleFileManager
      Returns:
      the "short name" used to refer to this storage-file type.
    • createTupleFile

      public TupleFile createTupleFile(DBFile dbFile, Schema schema)
      Description copied from interface: TupleFileManager
      Initialize the specified DBFile to be a new empty table with the specified schema.
      Specified by:
      createTupleFile in interface TupleFileManager
      Parameters:
      dbFile - the file to use for the new tuple-file
      schema - the schema of the table data to store in the file
      Returns:
      a TupleFile object that allows tuple operations to be performed against the DBFile.
    • openTupleFile

      public TupleFile openTupleFile(DBFile dbFile)
      Description copied from interface: TupleFileManager
      Open the specified DBFile as a TupleFile of a specific type, containing tuples of data conforming to a specific schema.
      Specified by:
      openTupleFile in interface TupleFileManager
      Parameters:
      dbFile - the tuple-file to open
      Returns:
      a TupleFile object that allows tuple operations to be performed against the DBFile.
    • saveMetadata

      public void saveMetadata(TupleFile tupleFile)
      Description copied from interface: TupleFileManager
      Writes the metadata (schema and stats information) for the tuple-file back into the tuple-file. The schema and statistics are represented as separate objects (Schema and TableStats objects, specifically), so of course they need to be serialized into a binary representation for storage when they change.
      Specified by:
      saveMetadata in interface TupleFileManager
      Parameters:
      tupleFile - the tuple-file whose metadata should be persisted
    • deleteTupleFile

      public void deleteTupleFile(TupleFile tupleFile)
      Description copied from interface: TupleFileManager
      Delete the specified tuple-file.
      Specified by:
      deleteTupleFile in interface TupleFileManager
      Parameters:
      tupleFile - the tuple-file to delete