Package org.apache.gravitino.messaging
Interface TopicCatalog
The
TopicCatalog
interface defines the public API for managing topic objects in a schema.
If the catalog implementation supports topic objects, it should implement this interface.-
Method Summary
Modifier and TypeMethodDescriptionalterTopic
(NameIdentifier ident, TopicChange... changes) Apply thechanges
to a topic in the catalog.createTopic
(NameIdentifier ident, String comment, DataLayout dataLayout, Map<String, String> properties) Create a topic in the catalog based on the provided details.boolean
dropTopic
(NameIdentifier ident) Drop a topic from the catalog.listTopics
(Namespace namespace) List the topics in a schema namespace from the catalog.loadTopic
(NameIdentifier ident) Load topic metadata byNameIdentifier
from the catalog.default boolean
topicExists
(NameIdentifier ident) Check if a topic exists using anNameIdentifier
from the catalog.
-
Method Details
-
listTopics
List the topics in a schema namespace from the catalog.- Parameters:
namespace
- A schema namespace.- Returns:
- An array of topic identifiers in the namespace.
- Throws:
NoSuchSchemaException
- If the schema does not exist.
-
loadTopic
Load topic metadata byNameIdentifier
from the catalog.- Parameters:
ident
- A topic identifier.- Returns:
- The topic metadata.
- Throws:
NoSuchTopicException
- If the topic does not exist.
-
topicExists
Check if a topic exists using anNameIdentifier
from the catalog.- Parameters:
ident
- A topic identifier.- Returns:
- true If the topic exists, false otherwise.
-
createTopic
Topic createTopic(NameIdentifier ident, String comment, DataLayout dataLayout, Map<String, String> properties) throws NoSuchSchemaException, TopicAlreadyExistsExceptionCreate a topic in the catalog based on the provided details.This method returns the topic as defined by the user without applying all defaults. If you need the topic with default values applied, use the
loadTopic(NameIdentifier)
method after creation.- Parameters:
ident
- A topic identifier.comment
- The comment of the topic object. Null is set if no comment is specified.dataLayout
- The message schema of the topic object. Always null because it's not supported yet.properties
- The properties of the topic object. Empty map is set if no properties are specified.- Returns:
- The topic as defined by the caller, without all default values.
- Throws:
NoSuchSchemaException
- If the schema does not exist.TopicAlreadyExistsException
- If the topic already exists.
-
alterTopic
Topic alterTopic(NameIdentifier ident, TopicChange... changes) throws NoSuchTopicException, IllegalArgumentException Apply thechanges
to a topic in the catalog.- Parameters:
ident
- A topic identifier.changes
- The changes to apply to the topic.- Returns:
- The altered topic metadata.
- Throws:
NoSuchTopicException
- If the topic does not exist.IllegalArgumentException
- If the changes is rejected by the implementation.
-
dropTopic
Drop a topic from the catalog.- Parameters:
ident
- A topic identifier.- Returns:
- true If the topic is dropped, false if the topic does not exist.
-