Class CreateSchema
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.cassandra.cql.CreateSchema
-
public class CreateSchema extends java.lang.Object
Create the Cassandra schema. The partition_id is application-defined and will be different depending on the type of resource (although it is always deterministic). For resources associated with a patient (e.g. observations), the partition_id will be the patient logical id. If there is no obvious partition key, the key will simply be the logical id for the resource.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String
keySpace
-
Constructor Summary
Constructors Constructor Description CreateSchema(java.lang.String keySpace)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createKeyspace(com.datastax.oss.driver.api.core.CqlSession session, java.lang.String replicationClass, int replicationFactor)
Each tenant gets its own keyspaceprotected void
createLogicalResourcesTable(com.datastax.oss.driver.api.core.CqlSession session)
protected void
createPayloadChunksTable(com.datastax.oss.driver.api.core.CqlSession session)
In Cassandra, blobs are limited to 2GB, but the document states that the practical limit is less than 1MB.protected void
createResourceVersionsTable(com.datastax.oss.driver.api.core.CqlSession session)
Create a table to identify the versions associated with each logical resource.void
run(com.datastax.oss.driver.api.core.CqlSession session)
Create the tables used to support payload persistence for this keyspace (each tenant gets its own keyspace)protected void
useKeyspace(com.datastax.oss.driver.api.core.CqlSession session)
-
-
-
Method Detail
-
run
public void run(com.datastax.oss.driver.api.core.CqlSession session)
Create the tables used to support payload persistence for this keyspace (each tenant gets its own keyspace)- Parameters:
session
-
-
createKeyspace
public void createKeyspace(com.datastax.oss.driver.api.core.CqlSession session, java.lang.String replicationClass, int replicationFactor)
Each tenant gets its own keyspace- Parameters:
session
-replicationClass
-replicationFactor
-
-
useKeyspace
protected void useKeyspace(com.datastax.oss.driver.api.core.CqlSession session)
-
createLogicalResourcesTable
protected void createLogicalResourcesTable(com.datastax.oss.driver.api.core.CqlSession session)
-
createResourceVersionsTable
protected void createResourceVersionsTable(com.datastax.oss.driver.api.core.CqlSession session)
Create a table to identify the versions associated with each logical resource. The partition id for this table is based on only {resource_type_id, logical_id} allowing the application to select the list of versions. The versions are also clustered with descending order, making it trivial to identify the latest version- Parameters:
session
-
-
createPayloadChunksTable
protected void createPayloadChunksTable(com.datastax.oss.driver.api.core.CqlSession session)
In Cassandra, blobs are limited to 2GB, but the document states that the practical limit is less than 1MB. To avoid issues when storing arbitrarily large FHIR resources, the payload is compressed and stored as a series of chunks each <= 1MB. Chunk order is maintained by the ordinal field.- Parameters:
session
-
-
-