Interface StargateBridgeClient

All Known Implementing Classes:
StargateBridgeClientImpl

public interface StargateBridgeClient
A future-based/synchronous facade to access the Stargate bridge.

This is intended as a transitional solution to migrate code that was not previously based on Quarkus. Most new code should prefer the Mutiny-based APIs: StargateBridge and SchemaManager.

  • Method Details

    • executeQueryAsync

      CompletionStage<io.stargate.bridge.proto.QueryOuterClass.Response> executeQueryAsync(io.stargate.bridge.proto.QueryOuterClass.Query query)
      Executes a CQL query.

      Authorization is automatically handled by the persistence backend.

    • executeQueryAsync

      CompletionStage<io.stargate.bridge.proto.QueryOuterClass.Response> executeQueryAsync(String keyspaceName, String tableName, Function<Optional<io.stargate.bridge.proto.Schema.CqlTable>,io.stargate.bridge.proto.QueryOuterClass.Query> queryProducer)
      Builds a CQL query based on the definition of a table, and executes it.
      Parameters:
      queryProducer - the function that builds the query. It will receive Optional.empty() if the table does not exist. Note that it may be invoked more than once (the implementation uses an optimistic approach to avoid systematically pre-fetching the table definition, so it may have to retry).
    • executeQuery

      default io.stargate.bridge.proto.QueryOuterClass.Response executeQuery(io.stargate.bridge.proto.QueryOuterClass.Query query)
      See Also:
    • executeQuery

      default io.stargate.bridge.proto.QueryOuterClass.Response executeQuery(String keyspaceName, String tableName, Function<Optional<io.stargate.bridge.proto.Schema.CqlTable>,io.stargate.bridge.proto.QueryOuterClass.Query> queryProducer)
      See Also:
    • executeBatchAsync

      CompletionStage<io.stargate.bridge.proto.QueryOuterClass.Response> executeBatchAsync(io.stargate.bridge.proto.QueryOuterClass.Batch batch)
      Executes a CQL batch.

      Authorization is automatically handled by the persistence backend.

    • executeBatch

      default io.stargate.bridge.proto.QueryOuterClass.Response executeBatch(io.stargate.bridge.proto.QueryOuterClass.Batch batch)
      See Also:
    • getKeyspaceAsync

      CompletionStage<Optional<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe>> getKeyspaceAsync(String keyspaceName, boolean checkIfAuthorized)
      Gets the metadata describing the given keyspace.
      Parameters:
      checkIfAuthorized - whether to check if the current user is allowed to describe this keyspace (this requires an additional background call to the bridge). This is an optimization: if you only use the schema metadata to build a DML query that will be executed immediately after, you can skip authorization since executeQueryAsync(Query) does it automatically. However, if there is no other query and you build a client response directly from the metadata, then authorization should be done by this method.
      Throws:
      UnauthorizedKeyspaceException - (wrapped in the returned future) if checkIfAuthorized is set, and the client is not allowed to access this keyspace. However, this check is shallow: if the caller surfaces keyspace elements (tables, UDTs...) to the end user, it must authorize them individually with authorizeSchemaReads(List).
    • getKeyspace

      default Optional<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> getKeyspace(String keyspaceName, boolean checkIfAuthorized) throws UnauthorizedKeyspaceException
      Throws:
      UnauthorizedKeyspaceException
      See Also:
    • getAllKeyspacesAsync

      CompletionStage<List<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe>> getAllKeyspacesAsync()
      Gets the metadata describing all the keyspaces that are visible to this client.

      This method automatically filters out unauthorized keyspaces. However, this check is shallow: if the caller surfaces keyspace elements (tables, UDTs...) to the end user, it must authorize them individually with authorizeSchemaReads(List).

    • getAllKeyspaces

      default List<io.stargate.bridge.proto.Schema.CqlKeyspaceDescribe> getAllKeyspaces()
      See Also:
    • decorateKeyspaceName

      String decorateKeyspaceName(String keyspaceName)
      Converts a keyspace name used by this client to the "global" one actually used by the persistence backend. In other words, this provides a way to compute Schema.CqlKeyspace.getGlobalName() from Schema.CqlKeyspace.getName().
    • getTableAsync

      CompletionStage<Optional<io.stargate.bridge.proto.Schema.CqlTable>> getTableAsync(String keyspaceName, String tableName, boolean checkIfAuthorized)
      Gets the metadata describing the given table.
      Parameters:
      checkIfAuthorized - see explanations in getKeyspaceAsync(String, boolean).
      Throws:
      UnauthorizedTableException - (wrapped in the returned future) if checkIfAuthorized is set, and the client is not allowed to access this table.
    • getTable

      default Optional<io.stargate.bridge.proto.Schema.CqlTable> getTable(String keyspaceName, String tableName, boolean checkIfAuthorized) throws UnauthorizedTableException
      Throws:
      UnauthorizedTableException
      See Also:
    • getTablesAsync

      CompletionStage<List<io.stargate.bridge.proto.Schema.CqlTable>> getTablesAsync(String keyspaceName)
      Gets the metadata describing all the tables that are visible to this client in the given keyspace.

      This method automatically filters out unauthorized tables.

    • getTables

      default List<io.stargate.bridge.proto.Schema.CqlTable> getTables(String keyspaceName)
      See Also:
    • authorizeSchemaReadsAsync

      CompletionStage<List<Boolean>> authorizeSchemaReadsAsync(List<io.stargate.bridge.proto.Schema.SchemaRead> schemaReads)
      Checks whether this client is authorized to describe a set of schema elements.
      See Also:
    • authorizeSchemaReads

      default List<Boolean> authorizeSchemaReads(List<io.stargate.bridge.proto.Schema.SchemaRead> schemaReads)
      See Also:
    • authorizeSchemaReadAsync

      default CompletionStage<Boolean> authorizeSchemaReadAsync(io.stargate.bridge.proto.Schema.SchemaRead schemaRead)
      Convenience method to call authorizeSchemaReadsAsync(List) with a single element.
      See Also:
    • authorizeSchemaRead

      default boolean authorizeSchemaRead(io.stargate.bridge.proto.Schema.SchemaRead schemaRead)
      Convenience method to call authorizeSchemaReads(List) with a single element.
      See Also:
    • getSupportedFeaturesAsync

      CompletionStage<io.stargate.bridge.proto.Schema.SupportedFeaturesResponse> getSupportedFeaturesAsync()
      Checks which features are supported by the persistence backend.
    • getSupportedFeatures

      default io.stargate.bridge.proto.Schema.SupportedFeaturesResponse getSupportedFeatures()
      See Also: