Interface SchemaTemplate

All Superinterfaces:
Metadata

public interface SchemaTemplate extends Metadata
A Relational schema template metadata.
  • Method Details

    • getVersion

      int getVersion()
      Returns the version of the schema template.
      Returns:
      The version of the schema template.
    • isEnableLongRows

      boolean isEnableLongRows()
      Returns true if long rows are permitted in tables of this template, else false.
      Returns:
      true if long rows are permitted in tables of this template, else false.
    • isStoreRowVersions

      boolean isStoreRowVersions()
      Returns true if each row is stored along with an monotonically increasing version. This is required to make use of the row_version() function within queries and indexes.
      Returns:
      true if each row is stored along with a monotonically increasing row_version().
    • getTables

      @Nonnull Set<? extends Table> getTables() throws RelationalException
      Returns the Tables inside the schema template.
      Returns:
      The Tables inside the schema template.
      Throws:
      RelationalException - if it is a NoOpSchemaTemplate
    • findTableByName

      @Nonnull Optional<Table> findTableByName(@Nonnull String tableName) throws RelationalException
      Retrieves a Table by looking up its name.
      Parameters:
      tableName - The name of the Table.
      Returns:
      An Optional containing the Table if it is found, otherwise Empty.
      Throws:
      RelationalException
    • getTableIndexMapping

      @Nonnull com.google.common.collect.Multimap<String,String> getTableIndexMapping() throws RelationalException
      Throws:
      RelationalException
    • getIndexes

      @Nonnull Set<String> getIndexes() throws RelationalException
      Throws:
      RelationalException
    • getIndexEntriesAsBitset

      @Nonnull BitSet getIndexEntriesAsBitset(@Nonnull Optional<Set<String>> readableIndexNames) throws RelationalException
      Returns a BitSet whose bits are set for each of passed index names.
      Example for a given schema template st with indexes i1, i2, i3, i4 whose order are as-defined, calling st.getIndexEntriesAsBitset(Optiona.of(Set.of("i2", "i3")) returns a bitset of 0110.
      Parameters:
      readableIndexNames - The readable index names, providing an Optional.empty() returns a bitset with bits set to 1.
      Returns:
      a bit set whose bits are set for each of the passed readable index names.
      Throws:
      RelationalException - If a readable index is not found.
    • generateSchema

      @Nonnull Schema generateSchema(@Nonnull String databaseId, @Nonnull String schemaName)
      Creates a Schema instance using the specified.
      Parameters:
      databaseId - The ID of the database.
      schemaName - The name of the Schema.
      Returns:
      A new Schema instance with the specified name, database Id, version containing the same set of Tables in this SchemaTemplate.
    • accept

      default void accept(@Nonnull Visitor visitor)
      Specified by:
      accept in interface Metadata
    • unwrap

      @Nonnull <T extends SchemaTemplate> T unwrap(@Nonnull Class<T> iface) throws RelationalException
      Throws:
      RelationalException