public class SchemaTransformations
extends java.lang.Object
Constructor and Description |
---|
SchemaTransformations() |
Modifier and Type | Method and Description |
---|---|
static SchemaTransformation |
addKeyspace(KeyspaceMetadata keyspace,
boolean ignoreIfExists)
Creates a schema transformation that adds the provided keyspace.
|
static SchemaTransformation |
addTable(TableMetadata table,
boolean ignoreIfExists)
Creates a schema transformation that adds the provided table.
|
static SchemaTransformation |
addTypes(Types toAdd,
boolean ignoreIfExists) |
static SchemaTransformation |
addView(ViewMetadata view,
boolean ignoreIfExists)
Creates a schema transformation that adds the provided view.
|
static SchemaTransformation |
updateSystemKeyspace(KeyspaceMetadata keyspace,
long generation)
We have a set of non-local, distributed system keyspaces, e.g.
|
public static SchemaTransformation addKeyspace(KeyspaceMetadata keyspace, boolean ignoreIfExists)
keyspace
- the keyspace to add.ignoreIfExists
- if true
, the transformation is a no-op if a keyspace of the same name than
keyspace
already exists in the schema the transformation is applied on. Otherwise,
the transformation throws an AlreadyExistsException
in that case.public static SchemaTransformation addTable(TableMetadata table, boolean ignoreIfExists)
table
- the table to add.ignoreIfExists
- if true
, the transformation is a no-op if a table of the same name than
table
already exists in the schema the transformation is applied on. Otherwise,
the transformation throws an AlreadyExistsException
in that case.public static SchemaTransformation addTypes(Types toAdd, boolean ignoreIfExists)
public static SchemaTransformation addView(ViewMetadata view, boolean ignoreIfExists)
view
- the view to add.ignoreIfExists
- if true
, the transformation is a no-op if a view of the same name than
view
already exists in the schema the transformation is applied on. Otherwise,
the transformation throws an AlreadyExistsException
in that case.public static SchemaTransformation updateSystemKeyspace(KeyspaceMetadata keyspace, long generation)
SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES
), that need to be created on cluster initialisation,
and later evolved on major upgrades (sometimes minor too). This method compares the current known definitions
of the tables (if the keyspace exists) to the expected, most modern ones expected by the running version of C*.
If any changes have been detected, a schema transformation returned by this method should make cluster's view of
that keyspace aligned with the expected modern definition.keyspace
- the metadata of the keyspace as it should be after application.generation
- timestamp to use for the table changes in the schema mutationCopyright © 2009-2022 The Apache Software Foundation