Package com.illumon.iris.db.schema
Class CachingSchemasKvAccessorShim
java.lang.Object
com.illumon.iris.db.schema.CachingSchemasKvAccessorShim
- All Implemented Interfaces:
CachingSchemasKvAccessorInterface
public class CachingSchemasKvAccessorShim extends Object implements CachingSchemasKvAccessorInterface
Preload DbInternal and other namespaces in order to bootstrap faster.
Certain read-only schema operations on the preloaded namespaces can be serviced while CachingSchemasKvAccessorImpl
is loading, and any others will block. Once the main implementation is loaded, all operations delegate to it.
-
Method Summary
Modifier and Type Method Description void
addSchema(Schema newSchema, com.fishlib.auth.UserContext userContext, String code, String comment)
Add the given schemaTable.void
close()
Releases resources when this instance will no longer be used.boolean
containsNamespace(String namespaceName)
Determine whether the named namespace exists.boolean
containsSchemaTable(String namespaceName, String tableName)
Determine whether the named schemaTable exists in the given namespace.void
createNamespace(io.deephaven.kv.schema.NamespaceType namespaceType, String namespaceName, com.fishlib.auth.UserContext userContext, String code, String comment)
Create the given namespace.void
deleteSchema(String namespaceName, String tableName, com.fishlib.auth.UserContext userContext, String code, String comment)
Delete the named schema.Collection<io.deephaven.kv.schema.SchemaTable>
getAllSchemaTables(Predicate<? super io.deephaven.kv.schema.SchemaStateAdapter.Namespace> namespaceFilter)
Get all the schemaTables in namespaces matching the filter (namespace name, namespace type, etc).io.deephaven.kv.schema.NamespaceType
getNamespaceType(String namespaceName)
Get the NamespaceType of the given namespace.io.deephaven.kv.schema.SchemaTable
getSchemaTable(String namespaceName, String tableName)
Get a schemaTable.Future<Void>
initializationStage()
Get the single Future to be used to check initialization status.boolean
isClosed()
Determine if close() has been called.Map<io.deephaven.kv.schema.NamespaceType,Map<String,Collection<String>>>
listAllTables()
Return a map of namespaceName to schemaTable name, by NamespaceType.List<String>
listNamespaces()
Get a list of all namespaces.List<String>
listNamespaces(io.deephaven.kv.schema.NamespaceType namespaceType)
Get a list of namespaces with the given type.List<String>
listSchemaTables(String namespace)
Get a list of schemaTables in the named namespace.static CachingSchemasKvAccessorInterface
make(com.fishlib.io.logger.Logger log, com.fishlib.configuration.Configuration configuration, io.deephaven.kv.KVCreator kvCreator, io.deephaven.kv.schema.SchemaContext schemaContext)
Factory to construct the shim accessor, and start the full implementation asynchronously.void
removeNamespace(String namespaceName, com.fishlib.auth.UserContext userContext, String code, String comment)
Remove the given namespace.void
updateSchema(Schema newSchema, com.fishlib.auth.UserContext userContext, String code, String comment)
Update the given schema.
-
Method Details
-
initializationStage
Get the single Future to be used to check initialization status.- Specified by:
initializationStage
in interfaceCachingSchemasKvAccessorInterface
- Returns:
- a Future that will indicate completion and will throw on failure.
-
make
@NotNull public static CachingSchemasKvAccessorInterface make(@NotNull com.fishlib.io.logger.Logger log, @NotNull com.fishlib.configuration.Configuration configuration, @NotNull io.deephaven.kv.KVCreator kvCreator, @NotNull io.deephaven.kv.schema.SchemaContext schemaContext)Factory to construct the shim accessor, and start the full implementation asynchronously.- Parameters:
log
- the logger to useconfiguration
- the configuration to usekvCreator
- the kv client and watch creator - this determines the kv implementation (ro/rw, etcd/in-mem)schemaContext
- the kvContext - root of the schemas storage- Returns:
- the new CachingSchemasKvAccessorInterface
-
getSchemaTable
@Nullable public io.deephaven.kv.schema.SchemaTable getSchemaTable(@NotNull String namespaceName, @NotNull String tableName)Description copied from interface:CachingSchemasKvAccessorInterface
Get a schemaTable.- Specified by:
getSchemaTable
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceName
- the namespace containing the tabletableName
- the name of the table- Returns:
- the current SchemaTable, or null if either the namespace or table does not exist
-
getAllSchemaTables
@NotNull public Collection<io.deephaven.kv.schema.SchemaTable> getAllSchemaTables(@NotNull Predicate<? super io.deephaven.kv.schema.SchemaStateAdapter.Namespace> namespaceFilter)Description copied from interface:CachingSchemasKvAccessorInterface
Get all the schemaTables in namespaces matching the filter (namespace name, namespace type, etc).- Specified by:
getAllSchemaTables
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceFilter
- predicate for filtering namespaces- Returns:
- a collection of schemaTables matching the filter
-
containsNamespace
Description copied from interface:CachingSchemasKvAccessorInterface
Determine whether the named namespace exists.- Specified by:
containsNamespace
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceName
- the namespace to check- Returns:
- true if the namespace exists
-
containsSchemaTable
Description copied from interface:CachingSchemasKvAccessorInterface
Determine whether the named schemaTable exists in the given namespace.- Specified by:
containsSchemaTable
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceName
- the namespace to checktableName
- the name of the schemaTable- Returns:
- true if the schema exists
-
listNamespaces
Description copied from interface:CachingSchemasKvAccessorInterface
Get a list of all namespaces.- Specified by:
listNamespaces
in interfaceCachingSchemasKvAccessorInterface
- Returns:
- a list of all namespaces
-
listNamespaces
@NotNull public List<String> listNamespaces(@NotNull io.deephaven.kv.schema.NamespaceType namespaceType)Description copied from interface:CachingSchemasKvAccessorInterface
Get a list of namespaces with the given type.- Specified by:
listNamespaces
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceType
- the NamespaceType to filter on- Returns:
- a list of all namespaces matching the NamespaceType
-
listSchemaTables
Description copied from interface:CachingSchemasKvAccessorInterface
Get a list of schemaTables in the named namespace. If the namespace does not exist, the list will be empty.- Specified by:
listSchemaTables
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespace
- the namespace to check- Returns:
- a list of all schemaTables in the given namespace
-
listAllTables
@NotNull public Map<io.deephaven.kv.schema.NamespaceType,Map<String,Collection<String>>> listAllTables()Description copied from interface:CachingSchemasKvAccessorInterface
Return a map of namespaceName to schemaTable name, by NamespaceType.- Specified by:
listAllTables
in interfaceCachingSchemasKvAccessorInterface
- Returns:
- a map of NamespaceType to map of namespace to schemaTable names
-
getNamespaceType
@Nullable public io.deephaven.kv.schema.NamespaceType getNamespaceType(@NotNull String namespaceName)Description copied from interface:CachingSchemasKvAccessorInterface
Get the NamespaceType of the given namespace.- Specified by:
getNamespaceType
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceName
- the namespace to check- Returns:
- the namespaceType of the namespace, or null if the namespace does not exist.
-
createNamespace
public void createNamespace(@NotNull io.deephaven.kv.schema.NamespaceType namespaceType, @NotNull String namespaceName, @NotNull com.fishlib.auth.UserContext userContext, @NotNull String code, @NotNull String comment)Description copied from interface:CachingSchemasKvAccessorInterface
Create the given namespace.- Specified by:
createNamespace
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceType
- create the namespace with this namespace typenamespaceName
- the name of the namespace to createuserContext
- the user making the changecode
- pass-thru to the kv layercomment
- pass-thru to the kv layer
-
removeNamespace
public void removeNamespace(@NotNull String namespaceName, @NotNull com.fishlib.auth.UserContext userContext, @NotNull String code, @NotNull String comment)Description copied from interface:CachingSchemasKvAccessorInterface
Remove the given namespace. Throws SchemaException if the namespace does not exist.- Specified by:
removeNamespace
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceName
- the namespace to removeuserContext
- the user making the changecode
- pass-thru to the kv layercomment
- pass-thru to the kv layer
-
addSchema
public void addSchema(@NotNull Schema newSchema, @NotNull com.fishlib.auth.UserContext userContext, @NotNull String code, @NotNull String comment)Description copied from interface:CachingSchemasKvAccessorInterface
Add the given schemaTable. The namespace must exist and have the type indicated in the schema. The schema must not exist. This does not validate CopyTable delegates.- Specified by:
addSchema
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
newSchema
- the schemaTable to adduserContext
- the user making the changecode
- pass-thru to the kv layercomment
- pass-thru to the kv layer
-
updateSchema
public void updateSchema(@NotNull Schema newSchema, @NotNull com.fishlib.auth.UserContext userContext, @NotNull String code, @NotNull String comment)Description copied from interface:CachingSchemasKvAccessorInterface
Update the given schema. The namespace must exist and have the type indicated in the schema. The schemaTable must exist. This does not validate CopyTable delegates.- Specified by:
updateSchema
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
newSchema
- the schema to updateuserContext
- the user making the changecode
- pass-thru to the kv layercomment
- pass-thru to the kv layer
-
deleteSchema
public void deleteSchema(@NotNull String namespaceName, @NotNull String tableName, @NotNull com.fishlib.auth.UserContext userContext, @NotNull String code, @NotNull String comment)Description copied from interface:CachingSchemasKvAccessorInterface
Delete the named schema.- Specified by:
deleteSchema
in interfaceCachingSchemasKvAccessorInterface
- Parameters:
namespaceName
- the namespace of the schema to deletetableName
- the name of the schema to deleteuserContext
- the user making the changecode
- pass-thru to the kv layercomment
- pass-thru to the kv layer
-
close
public void close()Description copied from interface:CachingSchemasKvAccessorInterface
Releases resources when this instance will no longer be used.- Specified by:
close
in interfaceCachingSchemasKvAccessorInterface
-
isClosed
public boolean isClosed()Description copied from interface:CachingSchemasKvAccessorInterface
Determine if close() has been called.- Specified by:
isClosed
in interfaceCachingSchemasKvAccessorInterface
- Returns:
- true if close has been called.
-