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 TypeMethodDescriptionvoidaddSchema(Schema newSchema, UserContext userContext, String code, String comment) Add the given schemaTable.voidclose()Releases resources when this instance will no longer be used.booleancontainsNamespace(String namespaceName) Determine whether the named namespace exists.booleancontainsSchemaTable(String namespaceName, String tableName) Determine whether the named schemaTable exists in the given namespace.voidcreateNamespace(io.deephaven.kv.schema.NamespaceType namespaceType, String namespaceName, UserContext userContext, String code, String comment) Create the given namespace.voiddeleteSchema(String namespaceName, String tableName, 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.NamespaceTypegetNamespaceType(String namespaceName) Get the NamespaceType of the given namespace.io.deephaven.kv.schema.SchemaTablegetSchemaTable(String namespaceName, String tableName) Get a schemaTable.Get the single Future to be used to check initialization status.booleanisClosed()Determine if close() has been called.Map<io.deephaven.kv.schema.NamespaceType,Map<String, Collection<String>>> Return a map of namespaceName to schemaTable name, by NamespaceType.Get a list of all namespaces.listNamespaces(io.deephaven.kv.schema.NamespaceType namespaceType) Get a list of namespaces with the given type.listSchemaTables(String namespace) Get a list of schemaTables in the named namespace.make(com.fishlib.io.logger.Logger log, com.fishlib.configuration.Configuration configuration, io.deephaven.kv.ClientCreator clientCreator, io.deephaven.kv.schema.SchemaContext schemaContext) Factory to construct the shim accessor, and start the full implementation asynchronously.voidremoveNamespace(String namespaceName, UserContext userContext, String code, String comment) Remove the given namespace.voidupdateSchema(Schema newSchema, 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:
initializationStagein 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.ClientCreator clientCreator, @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 useclientCreator- 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:CachingSchemasKvAccessorInterfaceGet a schemaTable.- Specified by:
getSchemaTablein 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:CachingSchemasKvAccessorInterfaceGet all the schemaTables in namespaces matching the filter (namespace name, namespace type, etc).- Specified by:
getAllSchemaTablesin interfaceCachingSchemasKvAccessorInterface- Parameters:
namespaceFilter- predicate for filtering namespaces- Returns:
- a collection of schemaTables matching the filter
-
containsNamespace
Description copied from interface:CachingSchemasKvAccessorInterfaceDetermine whether the named namespace exists.- Specified by:
containsNamespacein interfaceCachingSchemasKvAccessorInterface- Parameters:
namespaceName- the namespace to check- Returns:
- true if the namespace exists
-
containsSchemaTable
Description copied from interface:CachingSchemasKvAccessorInterfaceDetermine whether the named schemaTable exists in the given namespace.- Specified by:
containsSchemaTablein interfaceCachingSchemasKvAccessorInterface- Parameters:
namespaceName- the namespace to checktableName- the name of the schemaTable- Returns:
- true if the schema exists
-
listNamespaces
Description copied from interface:CachingSchemasKvAccessorInterfaceGet a list of all namespaces.- Specified by:
listNamespacesin interfaceCachingSchemasKvAccessorInterface- Returns:
- a list of all namespaces
-
listNamespaces
@NotNull public List<String> listNamespaces(@NotNull io.deephaven.kv.schema.NamespaceType namespaceType) Description copied from interface:CachingSchemasKvAccessorInterfaceGet a list of namespaces with the given type.- Specified by:
listNamespacesin interfaceCachingSchemasKvAccessorInterface- Parameters:
namespaceType- the NamespaceType to filter on- Returns:
- a list of all namespaces matching the NamespaceType
-
listSchemaTables
Description copied from interface:CachingSchemasKvAccessorInterfaceGet a list of schemaTables in the named namespace. If the namespace does not exist, the list will be empty.- Specified by:
listSchemaTablesin 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, listAllTables()Collection<String>>> Description copied from interface:CachingSchemasKvAccessorInterfaceReturn a map of namespaceName to schemaTable name, by NamespaceType.- Specified by:
listAllTablesin 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:CachingSchemasKvAccessorInterfaceGet the NamespaceType of the given namespace.- Specified by:
getNamespaceTypein 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 UserContext userContext, @NotNull String code, @NotNull String comment) Description copied from interface:CachingSchemasKvAccessorInterfaceCreate the given namespace.- Specified by:
createNamespacein 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 UserContext userContext, @NotNull String code, @NotNull String comment) Description copied from interface:CachingSchemasKvAccessorInterfaceRemove the given namespace. Throws SchemaException if the namespace does not exist.- Specified by:
removeNamespacein 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 UserContext userContext, @NotNull String code, @NotNull String comment) Description copied from interface:CachingSchemasKvAccessorInterfaceAdd 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:
addSchemain 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 UserContext userContext, @NotNull String code, @NotNull String comment) Description copied from interface:CachingSchemasKvAccessorInterfaceUpdate 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:
updateSchemain 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 UserContext userContext, @NotNull String code, @NotNull String comment) Description copied from interface:CachingSchemasKvAccessorInterfaceDelete the named schema.- Specified by:
deleteSchemain 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:CachingSchemasKvAccessorInterfaceReleases resources when this instance will no longer be used.- Specified by:
closein interfaceCachingSchemasKvAccessorInterface
-
isClosed
public boolean isClosed()Description copied from interface:CachingSchemasKvAccessorInterfaceDetermine if close() has been called.- Specified by:
isClosedin interfaceCachingSchemasKvAccessorInterface- Returns:
- true if close has been called.
-