Interface TableManager

  • All Known Implementing Classes:
    IndexedTableManager

    public interface TableManager
    This interface specifies the operations performed specifically on table files.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void analyzeTable​(TableInfo tableInfo)
      This function analyzes the specified table, and updates the table's statistics to be the most up-to-date values.
      void closeTable​(TableInfo tableInfo)
      This method closes a table file that is currently open, flushing any dirty pages to the table's storage in the process.
      TableInfo createTable​(java.lang.String tableName, Schema schema, CommandProperties properties)
      Creates a new table file with the table-name and schema specified in the passed-in TableInfo object.
      void dropTable​(java.lang.String tableName)
      Drops the specified table from the database.
      java.util.Set<java.lang.String> getTables()
      Returns a set of the names of the tables available.
      TableInfo openTable​(java.lang.String tableName)
      This method opens the data file corresponding to the specified table name and reads in the table's schema.
      void saveTableInfo​(TableInfo tableInfo)
      This method saves the schema and other details of a table into the backing table file, using the schema and other details specified in the passed-in TableInfo object.
      boolean tableExists​(java.lang.String tableName)
      Returns true if the specified table exists, or false otherwise.
    • Method Detail

      • getTables

        java.util.Set<java.lang.String> getTables()
        Returns a set of the names of the tables available.
        Returns:
        a list of table names
      • tableExists

        boolean tableExists​(java.lang.String tableName)
        Returns true if the specified table exists, or false otherwise.
        Parameters:
        tableName - the name of the table to check for existence
        Returns:
        true if the specified table exists, or false if it doesn't exist
      • createTable

        TableInfo createTable​(java.lang.String tableName,
                              Schema schema,
                              CommandProperties properties)
        Creates a new table file with the table-name and schema specified in the passed-in TableInfo object. Additional details such as the data file and the table manager are stored into the passed-in TableInfo object upon successful creation of the new table.
      • openTable

        TableInfo openTable​(java.lang.String tableName)
        This method opens the data file corresponding to the specified table name and reads in the table's schema. If the table is already open then the cached data is simply returned. If no such table exists, null is returned.
        Parameters:
        tableName - the name of the table to open. This is generally whatever was specified in a SQL statement that references the table.
        Returns:
        an object that holds the details of the open table, or null if the table does not exist.
      • saveTableInfo

        void saveTableInfo​(TableInfo tableInfo)
        This method saves the schema and other details of a table into the backing table file, using the schema and other details specified in the passed-in TableInfo object. It is used to initialize new tables, and also to update tables when their schema changes.
        Parameters:
        tableInfo - This object is an in/out parameter. It is used to specify the name and schema of the new table being created. When the table is successfully created, the object is updated with the actual file that the table's schema and data are stored in.
      • analyzeTable

        void analyzeTable​(TableInfo tableInfo)
        This function analyzes the specified table, and updates the table's statistics to be the most up-to-date values.
        Parameters:
        tableInfo - the opened table to analyze.
      • closeTable

        void closeTable​(TableInfo tableInfo)
        This method closes a table file that is currently open, flushing any dirty pages to the table's storage in the process.
        Parameters:
        tableInfo - the table to close
      • dropTable

        void dropTable​(java.lang.String tableName)
        Drops the specified table from the database.
        Parameters:
        tableName - the name of the table to drop