Package org.apache.cassandra.schema
Class KeyspaceMetadata
java.lang.Object
org.apache.cassandra.schema.KeyspaceMetadata
- All Implemented Interfaces:
SchemaElement
An immutable representation of keyspace metadata (name, params, tables, types, and functions).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enumNested classes/interfaces inherited from interface org.apache.cassandra.cql3.SchemaElement
SchemaElement.SchemaElementType -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal KeyspaceMetadata.Kindfinal Stringfinal KeyspaceParamsfinal Tablesfinal Typesfinal UserFunctionsfinal ViewsFields inherited from interface org.apache.cassandra.cql3.SchemaElement
NAME_COMPARATOR -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyspaceMetadatacreate(String name, KeyspaceParams params) static KeyspaceMetadatacreate(String name, KeyspaceParams params, Tables tables) static KeyspaceMetadatacreate(String name, KeyspaceParams params, Tables tables, Views views, Types types, UserFunctions functions) Returns the CQL name of the keyspace to which this schema element belong.Returns the CQL name of this schema element.Return the schema element typeempty()booleanfindAvailableIndexName(String baseName) findIndexedTable(String indexName) getTableNullable(String tableName) getTableOrViewNullable(String tableOrViewName) inthashCode()booleanbooleanbooleanbooleantablesUsingFunction(Function function) toCqlString(boolean withInternals, boolean ifNotExists) Returns a CQL representation of this elementtoString()voidvalidate()static <T extends RequestValidationException>
voidvalidateKeyspaceName(String keyspaceName, Function<String, T> exceptionBuilder) Validates the keyspace name for valid characters and correct length.static KeyspaceMetadatawithSwapped(KeyspaceParams params) withSwapped(Tables regular) withSwapped(Types types) withSwapped(UserFunctions functions) withSwapped(Views views) Returns a new KeyspaceMetadata with all instances of old UDT replaced with the updated version.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.cassandra.cql3.SchemaElement
elementKeyspaceQuotedIfNeeded, elementNameQuotedIfNeeded
-
Field Details
-
name
-
kind
-
params
-
tables
-
views
-
types
-
userFunctions
-
-
Method Details
-
validateKeyspaceName
public static <T extends RequestValidationException> void validateKeyspaceName(String keyspaceName, Function<String, T> exceptionBuilder) Validates the keyspace name for valid characters and correct length. Throws an exception if it's invalid.- Parameters:
keyspaceName- The name of the keyspace to validateexceptionBuilder- The exception constructor to throw if validation fails
-
create
-
create
-
create
public static KeyspaceMetadata create(String name, KeyspaceParams params, Tables tables, Views views, Types types, UserFunctions functions) -
virtual
-
withSwapped
-
withSwapped
-
withSwapped
-
withSwapped
-
withSwapped
-
empty
-
isVirtual
public boolean isVirtual() -
withUpdatedUserType
Returns a new KeyspaceMetadata with all instances of old UDT replaced with the updated version. Replaces all instances in tables, views, types, and functions. -
tablesAndViews
-
getTableOrViewNullable
-
getTableNullable
-
hasTable
-
hasView
-
hasIndex
-
tablesUsingFunction
- Parameters:
function- a user function- Returns:
- a stream of tables within this keyspace that have column masks using the specified user function
-
findAvailableIndexName
-
findIndexedTable
-
hashCode
public int hashCode() -
equals
-
toString
-
elementType
Description copied from interface:SchemaElementReturn the schema element type- Specified by:
elementTypein interfaceSchemaElement- Returns:
- the schema element type
-
elementKeyspace
Description copied from interface:SchemaElementReturns the CQL name of the keyspace to which this schema element belong.- Specified by:
elementKeyspacein interfaceSchemaElement- Returns:
- the keyspace name.
-
elementName
Description copied from interface:SchemaElementReturns the CQL name of this schema element.- Specified by:
elementNamein interfaceSchemaElement- Returns:
- the name of this schema element.
-
toCqlString
Description copied from interface:SchemaElementReturns a CQL representation of this element- Specified by:
toCqlStringin interfaceSchemaElement- Parameters:
withInternals- if the internals part of the CQL should be exposed.ifNotExists- if "IF NOT EXISTS" should be included.- Returns:
- a CQL representation of this element
-
validate
public void validate() -
createReplicationStrategy
-