Class ShardedSchemaAdapter
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.common.PlainSchemaAdapter
-
- org.linuxforhealth.fhir.schema.build.FhirSchemaAdapter
-
- org.linuxforhealth.fhir.schema.build.ShardedSchemaAdapter
-
- All Implemented Interfaces:
ISchemaAdapter
public class ShardedSchemaAdapter extends FhirSchemaAdapter
Adapter implementation used to build the distributed variant of the IBM FHIR Server RDBMS schema. This schema adds a distribution key column to every table identified as distributed. This column is also added to every index and FK relationship as needed. We use a smallint (2 bytes) which represents a signed integer holding values in the range [-32768, 32767]. This provides sufficient spread, assuming we won't be using a database with thousands of nodes.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.StringshardColumnName-
Fields inherited from class org.linuxforhealth.fhir.database.utils.common.PlainSchemaAdapter
databaseAdapter
-
-
Constructor Summary
Constructors Constructor Description ShardedSchemaAdapter(IDatabaseAdapter databaseAdapter, java.lang.String shardColumnName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateForeignKeyConstraint(java.lang.String constraintName, java.lang.String schemaName, java.lang.String name, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.util.List<java.lang.String> columns, boolean enforced, DistributionType distributionType, boolean targetIsReference)voidcreateIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType)Create an index on the named schema.table objectvoidcreateTable(java.lang.String schemaName, java.lang.String name, java.util.List<ColumnBase> columns, PrimaryKeyDef primaryKey, IdentityDef identity, java.lang.String tablespaceName, java.util.List<With> withs, java.util.List<CheckConstraint> checkConstraints, DistributionType distributionType, java.lang.String distributionColumnName)Build the create table DDLvoidcreateUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, java.util.List<java.lang.String> includeColumns, DistributionType distributionType, java.lang.String distributionColumnName)Create a unique indexvoidcreateUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType, java.lang.String distributionColumnName)Create a unique index-
Methods inherited from class org.linuxforhealth.fhir.database.utils.common.PlainSchemaAdapter
alterSequenceRestartWith, alterTableAddColumn, alterTableColumnIdentityCache, applyDistributionRules, checkCompatibility, createOrReplaceFunction, createOrReplaceProcedure, createOrReplaceView, createSchema, createSequence, createTablespace, createTablespace, createUniqueConstraint, createView, disableForeignKey, distributeFunction, doesForeignKeyConstraintExist, doesTableExist, dropForeignKey, dropFunction, dropIndex, dropProcedure, dropSequence, dropTable, dropTablespace, dropView, enableForeignKey, grantAllSequenceUsage, grantFunctionPrivileges, grantObjectPrivileges, grantProcedurePrivileges, grantSchemaUsage, grantSequencePrivileges, grantVariablePrivileges, listSchemaObjects, runStatement, setIntegrityOff, setIntegrityUnchecked
-
-
-
-
Constructor Detail
-
ShardedSchemaAdapter
public ShardedSchemaAdapter(IDatabaseAdapter databaseAdapter, java.lang.String shardColumnName)
- Parameters:
databaseAdapter-
-
-
Method Detail
-
createTable
public void createTable(java.lang.String schemaName, java.lang.String name, java.util.List<ColumnBase> columns, PrimaryKeyDef primaryKey, IdentityDef identity, java.lang.String tablespaceName, java.util.List<With> withs, java.util.List<CheckConstraint> checkConstraints, DistributionType distributionType, java.lang.String distributionColumnName)Description copied from interface:ISchemaAdapterBuild the create table DDL- Specified by:
createTablein interfaceISchemaAdapter- Overrides:
createTablein classPlainSchemaAdapter
-
createUniqueIndex
public void createUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, java.util.List<java.lang.String> includeColumns, DistributionType distributionType, java.lang.String distributionColumnName)Description copied from interface:ISchemaAdapterCreate a unique index- Specified by:
createUniqueIndexin interfaceISchemaAdapter- Overrides:
createUniqueIndexin classPlainSchemaAdapter
-
createUniqueIndex
public void createUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType, java.lang.String distributionColumnName)Description copied from interface:ISchemaAdapterCreate a unique index- Specified by:
createUniqueIndexin interfaceISchemaAdapter- Overrides:
createUniqueIndexin classPlainSchemaAdapter
-
createIndex
public void createIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType)Description copied from interface:ISchemaAdapterCreate an index on the named schema.table object- Specified by:
createIndexin interfaceISchemaAdapter- Overrides:
createIndexin classPlainSchemaAdapter
-
createForeignKeyConstraint
public void createForeignKeyConstraint(java.lang.String constraintName, java.lang.String schemaName, java.lang.String name, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.util.List<java.lang.String> columns, boolean enforced, DistributionType distributionType, boolean targetIsReference)- Specified by:
createForeignKeyConstraintin interfaceISchemaAdapter- Overrides:
createForeignKeyConstraintin classPlainSchemaAdapterdistributionType- distribution type of the source table
-
-