io.streamnative.pulsar.handlers.kop.schemaregistry.model.SchemaStorage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulsar-kafka-schema-registry Show documentation
Show all versions of pulsar-kafka-schema-registry Show documentation
Kafka Compatible Schema Registry
/**
* Copyright (c) 2019 - 2024 StreamNative, Inc.. All Rights Reserved.
*/
/**
* Licensed 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 io.streamnative.pulsar.handlers.kop.schemaregistry.model;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
public interface SchemaStorage {
/**
* Get current tenant.
* @return
*/
String getTenant();
/**
* Find a schema by unique id.
*
* @param id the id
* @param lookupDeleted whether lookup deleted schema
* @return the Schema or null
*/
CompletableFuture> findSchemaById(int id, boolean lookupDeleted);
/**
* Get all existing subjects.
* @param lookupFilter lookup filter
* @return
*/
CompletableFuture> getAllSubjects(LookupFilter lookupFilter);
/**
* Check if subject exists.
*
* @param subject query subject name
* @param lookupDeletedSubjects whether lookup deleted subjects
* @return
*/
CompletableFuture hasSubjects(String subject, boolean lookupDeletedSubjects);
/**
* Get all schemas for a given subject.
* @param subject the subject
* @param lookupFilter lookup filter
* @return the list of Schema
*/
CompletableFuture> getSchemasForSubject(String subject, LookupFilter lookupFilter);
/**
* Delete all the versions of a subject.
* @param subject the Subject
* @param permanentDelete whether permanent delete
* @return the versions
*/
CompletableFuture> deleteSubject(String subject, boolean permanentDelete);
/**
* Delete a schema version.
* @param subject the Subject
* @param schema the Schema
* @param permanentDelete whether permanent delete
*/
CompletableFuture deleteSchemaVersion(String subject, Schema schema, boolean permanentDelete);
/**
* Lookup a schema by subject and version.
* @param subject the Subject
* @param version the Version
* @param returnDeletedSchema whether return deleted schema
* @return the Schema
*/
CompletableFuture findSchemaBySubjectAndVersion(String subject,
VersionId version,
boolean returnDeletedSchema);
/**
* Check the schema is existing by subject and version.
*
* @param subject the Subject
* @param versionId the Version
* @param returnDeletedSchema whether return deleted schema
* @return the Schema
*/
CompletableFuture schemaVersionExists(String subject, VersionId versionId, boolean returnDeletedSchema);
/**
* Create a new schema.
* @param schema the Schema
* @param normalize normalize or not
* @return the new Schema
*/
CompletableFuture createSchemaVersion(Schema schema, boolean normalize);
/**
* Get current compatibility mode for the given subject.
* @param subject
* @return the mode
*/
CompletableFuture getCompatibilityMode(String subject);
/**
* Set current compatibility mode for the given subject.
* @param subject
* @param mode the new mode
*/
CompletableFuture setCompatibilityMode(String subject, CompatibilityChecker.Mode mode);
CompletableFuture> getReferencedBy(String subject, VersionId versionId);
CompletableFuture lookUpSchemaUnderSubject(String subject, Schema schema,
boolean normalize, boolean lookupDeletedSchema);
}