org.apache.pulsar.client.admin.Schemas Maven / Gradle / Ivy
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pulsar.client.admin;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse;
import org.apache.pulsar.common.protocol.schema.PostSchemaPayload;
import org.apache.pulsar.common.schema.SchemaInfo;
import org.apache.pulsar.common.schema.SchemaInfoWithVersion;
/**
* Admin interface on interacting with schemas.
*/
public interface Schemas {
/**
* Retrieve the latest schema of a topic.
*
* @param topic topic name, in fully qualified format
* @return latest schema
* @throws PulsarAdminException
*/
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 getSchemaInfoAsync(String topic);
/**
* Retrieve the latest schema with verison of a topic.
*
* @param topic topic name, in fully qualified format
* @return latest schema with version
* @throws PulsarAdminException
*/
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 getSchemaInfoWithVersionAsync(String topic);
/**
* Retrieve the schema of a topic at a given version.
*
* @param topic topic name, in fully qualified format
* @param version schema version
* @return the schema info at a given version
* @throws PulsarAdminException
*/
SchemaInfo getSchemaInfo(String topic, long version) throws PulsarAdminException;
/**
* Retrieve the schema of a topic at a given version asynchronously.
*
* @param topic topic name, in fully qualified format
* @param version schema version
* @return the schema info at a given version
*/
CompletableFuture getSchemaInfoAsync(String topic, long version);
/**
* Delete the schema associated with a given topic.
*
* @param topic topic name, in fully qualified format
* @throws PulsarAdminException
*/
void deleteSchema(String topic) throws PulsarAdminException;
/**
* Delete the schema associated with a given topic asynchronously.
*
* @param topic topic name, in fully qualified format
*/
CompletableFuture deleteSchemaAsync(String topic);
/**
* Delete the schema associated with a given topic.
*
* @param topic topic name, in fully qualified format
* @param force whether to delete schema completely.
* If true, delete all resources (including metastore and ledger),
* otherwise only do a mark deletion and not remove any resources indeed
* @throws PulsarAdminException
*/
void deleteSchema(String topic, boolean force) throws PulsarAdminException;
/**
* Delete the schema associated with a given topic asynchronously.
*
* @param topic topic name, in fully qualified format
*/
CompletableFuture deleteSchemaAsync(String topic, boolean force);
/**
* Create a schema for a given topic with the provided schema info.
*
* @param topic topic name, in fully qualified fomrat
* @param schemaInfo schema info
* @throws PulsarAdminException
*/
void createSchema(String topic, SchemaInfo schemaInfo) throws PulsarAdminException;
/**
* Create a schema for a given topic with the provided schema info asynchronously.
*
* @param topic topic name, in fully qualified fomrat
* @param schemaInfo schema info
*/
CompletableFuture createSchemaAsync(String topic, SchemaInfo schemaInfo);
/**
* Create a schema for a given topic.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
* @throws PulsarAdminException
*/
void createSchema(String topic, PostSchemaPayload schemaPayload) throws PulsarAdminException;
/**
* Create a schema for a given topic asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
*/
CompletableFuture createSchemaAsync(String topic, PostSchemaPayload schemaPayload);
/**
* Judge schema compatibility topic.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
* @throws PulsarAdminException
*/
IsCompatibilityResponse testCompatibility(String topic, PostSchemaPayload schemaPayload)
throws PulsarAdminException;
/**
* Judge schema compatibility topic asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
*/
CompletableFuture testCompatibilityAsync(String topic, PostSchemaPayload schemaPayload);
/**
* Find schema version topic.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
* @throws PulsarAdminException
*/
Long getVersionBySchema(String topic, PostSchemaPayload schemaPayload) throws PulsarAdminException;
/**
* Find schema version topic asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaPayload schema payload
*/
CompletableFuture getVersionBySchemaAsync(String topic, PostSchemaPayload schemaPayload);
/**
* Judge schema compatibility topic.
*
* @param topic topic name, in fully qualified format
* @param schemaInfo schema info
* @throws PulsarAdminException
*/
IsCompatibilityResponse testCompatibility(String topic, SchemaInfo schemaInfo) throws PulsarAdminException;
/**
* Judge schema compatibility topic asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaInfo schema info
*/
CompletableFuture testCompatibilityAsync(String topic, SchemaInfo schemaInfo);
/**
* Find schema version topic.
*
* @param topic topic name, in fully qualified format
* @param schemaInfo schema info
* @throws PulsarAdminException
*/
Long getVersionBySchema(String topic, SchemaInfo schemaInfo) throws PulsarAdminException;
/**
* Find schema version topic asynchronously.
*
* @param topic topic name, in fully qualified format
* @param schemaInfo schema info
*/
CompletableFuture getVersionBySchemaAsync(String topic, SchemaInfo schemaInfo);
/**
* Get all version schemas topic.
*
* @param topic topic name, in fully qualified format
* @throws PulsarAdminException
*/
List getAllSchemas(String topic) throws PulsarAdminException;
/**
* Get all version schemas topic asynchronously.
*
* @param topic topic name, in fully qualified format
*/
CompletableFuture> getAllSchemasAsync(String topic);
}