Class SchemaManager

java.lang.Object
io.stargate.sgv2.api.common.schema.SchemaManager

@ApplicationScoped public class SchemaManager extends Object
  • Constructor Details

    • SchemaManager

      public SchemaManager()
  • Method Details

    • getKeyspace

      public io.smallrye.mutiny.Uni<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> getKeyspace(String keyspace)
      Get the keyspace from the bridge. Note that this method is not doing any authorization.
      Parameters:
      keyspace - Keyspace name
      Returns:
      Uni containing Schema.CqlKeyspaceDescribe or null item in case keyspace does not exist.
    • getKeyspaces

      public io.smallrye.mutiny.Multi<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> getKeyspaces()
      Get all keyspace from the bridge. Note that this method is not doing any authorization.
      Returns:
      Multi containing Schema.CqlKeyspaceDescribe
    • getTable

      public io.smallrye.mutiny.Uni<io.stargate.bridge.proto.Schema.CqlTable> getTable(String keyspace, String table, Function<String,io.smallrye.mutiny.Uni<? extends io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe>> missingKeyspace)
      Get the table from the bridge. Note that this method is not doing any authorization.
      Parameters:
      keyspace - Keyspace name
      table - Table name
      missingKeyspace - Function of the keyspace in case it's not existing. Usually there to provide a failure.
      Returns:
      Uni containing Schema.CqlTable or null item in case the table does not exist.
    • getTables

      public io.smallrye.mutiny.Multi<io.stargate.bridge.proto.Schema.CqlTable> getTables(String keyspace, Function<String,io.smallrye.mutiny.Uni<? extends io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe>> missingKeyspace)
      Get all tables of a keyspace from the bridge.
      Parameters:
      keyspace - Keyspace name
      missingKeyspace - Function of the keyspace in case it's not existing. Usually there to provide a failure.
      Returns:
      Multi of Schema.CqlTable
    • getKeyspaceAuthorized

      public io.smallrye.mutiny.Uni<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> getKeyspaceAuthorized(String keyspace)
      Get the keyspace from the bridge. Prior to getting the keyspace it will execute the schema authorization request.

      Emits a failure in case:

      1. Not authorized, with UnauthorizedKeyspaceException
      Parameters:
      keyspace - Keyspace name
      Returns:
      Uni containing Schema.CqlKeyspaceDescribe or null item in case keyspace does not exist.
    • getKeyspacesAuthorized

      public io.smallrye.mutiny.Multi<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> getKeyspacesAuthorized()
      Get all keyspace from the bridge. Prior to getting each keyspace it will execute the schema authorization request (single request for all available keyspace).
      Returns:
      Multi containing Schema.CqlKeyspaceDescribe
    • getTableAuthorized

      public io.smallrye.mutiny.Uni<io.stargate.bridge.proto.Schema.CqlTable> getTableAuthorized(String keyspace, String table, Function<String,io.smallrye.mutiny.Uni<? extends io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe>> missingKeyspace)
      Get the table from the bridge. Prior to getting the keyspace it will execute the schema authorization request.

      Emits a failure in case:

      1. Not authorized, with UnauthorizedTableException
      Parameters:
      keyspace - Keyspace name
      table - Table name
      missingKeyspace - Function of the keyspace in case it's not existing. Usually there to provide a failure.
      Returns:
      Uni containing Schema.CqlTable or null item in case the table does not exist.
    • getTablesAuthorized

      public io.smallrye.mutiny.Multi<io.stargate.bridge.proto.Schema.CqlTable> getTablesAuthorized(String keyspace, Function<String,io.smallrye.mutiny.Uni<? extends io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe>> missingKeyspace)
      Get all authorized tables from the bridge.

      Emits a failure in case:

      1. Not authorized, with UnauthorizedTableException
      Parameters:
      keyspace - Keyspace name
      missingKeyspace - Function of the keyspace in case it's not existing. Usually there to provide a failure.
      Returns:
      Multi of Schema.CqlTable
    • authorizeKeyspaceInternal

      public io.smallrye.mutiny.Uni<Boolean> authorizeKeyspaceInternal(StargateBridge bridge, String keyspaceName)
    • authorizeTableInternal

      public io.smallrye.mutiny.Uni<Boolean> authorizeTableInternal(StargateBridge bridge, String keyspaceName, String tableName)
    • authorizeInternal

      public io.smallrye.mutiny.Uni<Boolean> authorizeInternal(StargateBridge bridge, io.stargate.bridge.proto.Schema.SchemaRead schemaRead)
    • fetchKeyspace

      protected io.smallrye.mutiny.Uni<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> fetchKeyspace(String keyspaceName, Optional<String> tenantId, StargateBridge bridge)
    • cacheKeyspace

      protected io.smallrye.mutiny.Uni<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> cacheKeyspace(String keyspaceName, Optional<String> tenantId, io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe keyspace)
    • invalidateKeyspace

      protected io.smallrye.mutiny.Uni<Void> invalidateKeyspace(String keyspaceName, Optional<String> tenantId)