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 Details

    • initializationStage

      public Future<Void> initializationStage()
      Get the single Future to be used to check initialization status.
      Specified by:
      initializationStage in interface CachingSchemasKvAccessorInterface
      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 use
      configuration - the configuration to use
      clientCreator - 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 interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceName - the namespace containing the table
      tableName - 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 interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceFilter - predicate for filtering namespaces
      Returns:
      a collection of schemaTables matching the filter
    • containsNamespace

      public boolean containsNamespace(@NotNull String namespaceName)
      Description copied from interface: CachingSchemasKvAccessorInterface
      Determine whether the named namespace exists.
      Specified by:
      containsNamespace in interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceName - the namespace to check
      Returns:
      true if the namespace exists
    • containsSchemaTable

      public boolean containsSchemaTable(@NotNull String namespaceName, @NotNull String tableName)
      Description copied from interface: CachingSchemasKvAccessorInterface
      Determine whether the named schemaTable exists in the given namespace.
      Specified by:
      containsSchemaTable in interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceName - the namespace to check
      tableName - the name of the schemaTable
      Returns:
      true if the schema exists
    • listNamespaces

      @NotNull public List<String> listNamespaces()
      Description copied from interface: CachingSchemasKvAccessorInterface
      Get a list of all namespaces.
      Specified by:
      listNamespaces in interface CachingSchemasKvAccessorInterface
      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 interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceType - the NamespaceType to filter on
      Returns:
      a list of all namespaces matching the NamespaceType
    • listSchemaTables

      @NotNull public List<String> listSchemaTables(@NotNull String namespace)
      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 interface CachingSchemasKvAccessorInterface
      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 interface CachingSchemasKvAccessorInterface
      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 interface CachingSchemasKvAccessorInterface
      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 io.deephaven.enterprise.auth.UserContext userContext, @NotNull String code, @NotNull String comment)
      Description copied from interface: CachingSchemasKvAccessorInterface
      Create the given namespace.
      Specified by:
      createNamespace in interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceType - create the namespace with this namespace type
      namespaceName - the name of the namespace to create
      userContext - the user making the change
      code - pass-thru to the kv layer
      comment - pass-thru to the kv layer
    • removeNamespace

      public void removeNamespace(@NotNull String namespaceName, @NotNull io.deephaven.enterprise.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 interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceName - the namespace to remove
      userContext - the user making the change
      code - pass-thru to the kv layer
      comment - pass-thru to the kv layer
    • addSchema

      public void addSchema(@NotNull Schema newSchema, @NotNull io.deephaven.enterprise.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 interface CachingSchemasKvAccessorInterface
      Parameters:
      newSchema - the schemaTable to add
      userContext - the user making the change
      code - pass-thru to the kv layer
      comment - pass-thru to the kv layer
    • updateSchema

      public void updateSchema(@NotNull Schema newSchema, @NotNull io.deephaven.enterprise.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 interface CachingSchemasKvAccessorInterface
      Parameters:
      newSchema - the schema to update
      userContext - the user making the change
      code - pass-thru to the kv layer
      comment - pass-thru to the kv layer
    • deleteSchema

      public void deleteSchema(@NotNull String namespaceName, @NotNull String tableName, @NotNull io.deephaven.enterprise.auth.UserContext userContext, @NotNull String code, @NotNull String comment)
      Description copied from interface: CachingSchemasKvAccessorInterface
      Delete the named schema.
      Specified by:
      deleteSchema in interface CachingSchemasKvAccessorInterface
      Parameters:
      namespaceName - the namespace of the schema to delete
      tableName - the name of the schema to delete
      userContext - the user making the change
      code - pass-thru to the kv layer
      comment - 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 interface CachingSchemasKvAccessorInterface
    • isClosed

      public boolean isClosed()
      Description copied from interface: CachingSchemasKvAccessorInterface
      Determine if close() has been called.
      Specified by:
      isClosed in interface CachingSchemasKvAccessorInterface
      Returns:
      true if close has been called.