Skip to content

Commit

Permalink
[PulsarAdmin] Schemas to async (apache#6585)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjshen authored Mar 23, 2020
1 parent 1444d6f commit ab06a2c
Show file tree
Hide file tree
Showing 2 changed files with 378 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
*/
package org.apache.pulsar.client.admin;

import org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse;
import org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse;
import org.apache.pulsar.common.protocol.schema.PostSchemaPayload;
import org.apache.pulsar.common.protocol.schema.PostSchemaResponse;
import org.apache.pulsar.common.protocol.schema.SchemaVersion;
import org.apache.pulsar.common.schema.SchemaInfo;
import org.apache.pulsar.common.schema.SchemaInfoWithVersion;

import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
* Admin interface on interacting with schemas.
Expand All @@ -42,6 +40,14 @@ public interface Schemas {
*/
SchemaInfo getSchemaInfo(String topic) throws PulsarAdminException;

/**
* Retrieve the latest schema of a topic asynchronously.
*
* @param topic topic name, in fully qualified format
* @return latest schema
*/
CompletableFuture<SchemaInfo> getSchemaInfoAsync(String topic);

/**
* Retrieve the latest schema with verison of a topic.
*
Expand All @@ -51,6 +57,14 @@ public interface Schemas {
*/
SchemaInfoWithVersion getSchemaInfoWithVersion(String topic) throws PulsarAdminException;

/**
* Retrieve the latest schema with verison of a topic asynchronously.
*
* @param topic topic name, in fully qualified format
* @return latest schema with version
*/
CompletableFuture<SchemaInfoWithVersion> getSchemaInfoWithVersionAsync(String topic);

/**
* Retrieve the schema of a topic at a given <tt>version</tt>.
*
Expand All @@ -61,6 +75,15 @@ public interface Schemas {
*/
SchemaInfo getSchemaInfo(String topic, long version) throws PulsarAdminException;

/**
* Retrieve the schema of a topic at a given <tt>version</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
* @param version schema version
* @return the schema info at a given <tt>version</tt>
*/
CompletableFuture<SchemaInfo> getSchemaInfoAsync(String topic, long version);

/**
* Delete the schema associated with a given <tt>topic</tt>.
*
Expand All @@ -69,6 +92,13 @@ public interface Schemas {
*/
void deleteSchema(String topic) throws PulsarAdminException;

/**
* Delete the schema associated with a given <tt>topic</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
*/
CompletableFuture<Void> deleteSchemaAsync(String topic);

/**
* Create a schema for a given <tt>topic</tt> with the provided schema info.
*
Expand All @@ -78,6 +108,14 @@ public interface Schemas {
*/
void createSchema(String topic, SchemaInfo schemaInfo) throws PulsarAdminException;

/**
* Create a schema for a given <tt>topic</tt> with the provided schema info asynchronously.
*
* @param topic topic name, in fully qualified fomrat
* @param schemaInfo schema info
*/
CompletableFuture<Void> createSchemaAsync(String topic, SchemaInfo schemaInfo);

/**
* Create a schema for a given <tt>topic</tt>.
*
Expand All @@ -87,6 +125,14 @@ public interface Schemas {
*/
void createSchema(String topic, PostSchemaPayload schemaPayload) throws PulsarAdminException;

/**
* Create a schema for a given <tt>topic</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
*/
CompletableFuture<Void> createSchemaAsync(String topic, PostSchemaPayload schemaPayload);

/**
* Judge schema compatibility <tt>topic</tt>.
*
Expand All @@ -96,6 +142,14 @@ public interface Schemas {
*/
IsCompatibilityResponse testCompatibility(String topic, PostSchemaPayload schemaPayload) throws PulsarAdminException;

/**
* Judge schema compatibility <tt>topic</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
*/
CompletableFuture<IsCompatibilityResponse> testCompatibilityAsync(String topic, PostSchemaPayload schemaPayload);

/**
* Find schema version <tt>topic</tt>.
*
Expand All @@ -105,6 +159,14 @@ public interface Schemas {
*/
Long getVersionBySchema(String topic, PostSchemaPayload schemaPayload) throws PulsarAdminException;

/**
* Find schema version <tt>topic</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
*/
CompletableFuture<Long> getVersionBySchemaAsync(String topic, PostSchemaPayload schemaPayload);

/**
* Judge schema compatibility <tt>topic</tt>.
*
Expand All @@ -114,6 +176,14 @@ public interface Schemas {
*/
IsCompatibilityResponse testCompatibility(String topic, SchemaInfo schemaInfo) throws PulsarAdminException;

/**
* Judge schema compatibility <tt>topic</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaInfo schema info
*/
CompletableFuture<IsCompatibilityResponse> testCompatibilityAsync(String topic, SchemaInfo schemaInfo);

/**
* Find schema version <tt>topic</tt>.
*
Expand All @@ -123,6 +193,14 @@ public interface Schemas {
*/
Long getVersionBySchema(String topic, SchemaInfo schemaInfo) throws PulsarAdminException;

/**
* Find schema version <tt>topic</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaInfo schema info
*/
CompletableFuture<Long> getVersionBySchemaAsync(String topic, SchemaInfo schemaInfo);

/**
* Get all version schemas <tt>topic</tt>.
*
Expand All @@ -131,4 +209,10 @@ public interface Schemas {
*/
List<SchemaInfo> getAllSchemas(String topic) throws PulsarAdminException;

/**
* Get all version schemas <tt>topic</tt> asynchronously.
*
* @param topic topic name, in fully qualified format
*/
CompletableFuture<List<SchemaInfo>> getAllSchemasAsync(String topic);
}
Loading

0 comments on commit ab06a2c

Please sign in to comment.