Package com.linkedin.venice.unit.kafka
Class MockInMemoryAdminAdapter
java.lang.Object
com.linkedin.venice.unit.kafka.MockInMemoryAdminAdapter
- All Implemented Interfaces:
PubSubAdminAdapter
,Closeable
,AutoCloseable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
containsTopic
(PubSubTopic topic) Checks if a PubSub topic exists.boolean
containsTopicWithPartitionCheck
(PubSubTopicPartition pubSubTopicPartition) Checks if a PubSub topic exists and has the given partitionvoid
createTopic
(PubSubTopic topic, int numPartitions, int replication, PubSubTopicConfiguration topicPubSubTopicConfiguration) Creates a new topic in the PubSub system with the given parameters.void
deleteTopic
(PubSubTopic topicName, Duration timeout) Delete a given topic.Retrieves the retention settings for all PubSub topics.getSomeTopicConfigs
(Set<PubSubTopic> topicNames) Retrieves the configurations for a set of PubSub topics.getTopicConfig
(PubSubTopic topic) Retrieves the configuration of a PubSub topic.getTopicConfigWithRetry
(PubSubTopic pubSubTopic) Retrieves a set of all available PubSub topics from the PubSub cluster.partitionsFor
(PubSubTopic topic) void
setTopicConfig
(PubSubTopic topicName, PubSubTopicConfiguration topicPubSubTopicConfiguration) Sets the configuration for a PubSub topic.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linkedin.venice.pubsub.api.PubSubAdminAdapter
containsTopicWithExpectationAndRetry, containsTopicWithExpectationAndRetry, containsTopicWithPartitionCheckExpectationAndRetry, containsTopicWithPartitionCheckExpectationAndRetry, getTopicConfigMaxRetryInMs
-
Constructor Details
-
MockInMemoryAdminAdapter
-
-
Method Details
-
createTopic
public void createTopic(PubSubTopic topic, int numPartitions, int replication, PubSubTopicConfiguration topicPubSubTopicConfiguration) Description copied from interface:PubSubAdminAdapter
Creates a new topic in the PubSub system with the given parameters.- Specified by:
createTopic
in interfacePubSubAdminAdapter
- Parameters:
topic
- The topic to be created.numPartitions
- The number of partitions to be created for the topic.replication
- The number of replicas for each partition.topicPubSubTopicConfiguration
- Additional topic configuration such as retention, compaction policy, etc.
-
deleteTopic
Description copied from interface:PubSubAdminAdapter
Delete a given topic. The calling thread will block until the topic is deleted or the timeout is reached.- Specified by:
deleteTopic
in interfacePubSubAdminAdapter
- Parameters:
topicName
- The topic to delete.timeout
- The maximum duration to wait for the deletion to complete.
-
listAllTopics
Description copied from interface:PubSubAdminAdapter
Retrieves a set of all available PubSub topics from the PubSub cluster.- Specified by:
listAllTopics
in interfacePubSubAdminAdapter
- Returns:
- A Set of PubSubTopic objects representing all available topics.
-
setTopicConfig
public void setTopicConfig(PubSubTopic topicName, PubSubTopicConfiguration topicPubSubTopicConfiguration) throws PubSubTopicDoesNotExistException Description copied from interface:PubSubAdminAdapter
Sets the configuration for a PubSub topic.- Specified by:
setTopicConfig
in interfacePubSubAdminAdapter
- Parameters:
topicName
- The PubSubTopic for which to set the configuration.topicPubSubTopicConfiguration
- The configuration to be set for the specified PubSub topic.- Throws:
PubSubTopicDoesNotExistException
- If the specified PubSub topic does not exist.
-
getAllTopicRetentions
Description copied from interface:PubSubAdminAdapter
Retrieves the retention settings for all PubSub topics.- Specified by:
getAllTopicRetentions
in interfacePubSubAdminAdapter
- Returns:
- A map of pub-sub topics and their corresponding retention settings in milliseconds.
If a topic does not have a retention setting, it will be mapped to
PubSubConstants.PUBSUB_TOPIC_UNKNOWN_RETENTION
.
-
getTopicConfig
public PubSubTopicConfiguration getTopicConfig(PubSubTopic topic) throws PubSubTopicDoesNotExistException Description copied from interface:PubSubAdminAdapter
Retrieves the configuration of a PubSub topic.- Specified by:
getTopicConfig
in interfacePubSubAdminAdapter
- Parameters:
topic
- The PubSubTopic for which to retrieve the configuration.- Returns:
- The configuration of the specified PubSubTopic as a PubSubTopicConfiguration object.
- Throws:
PubSubTopicDoesNotExistException
- If the specified PubSubTopic topic does not exist.
-
getTopicConfigWithRetry
- Specified by:
getTopicConfigWithRetry
in interfacePubSubAdminAdapter
-
containsTopic
Description copied from interface:PubSubAdminAdapter
Checks if a PubSub topic exists.- Specified by:
containsTopic
in interfacePubSubAdminAdapter
- Parameters:
topic
- The PubSubTopic to check for existence.- Returns:
- true if the specified topic exists, false otherwise.
-
containsTopicWithPartitionCheck
Description copied from interface:PubSubAdminAdapter
Checks if a PubSub topic exists and has the given partition- Specified by:
containsTopicWithPartitionCheck
in interfacePubSubAdminAdapter
- Parameters:
pubSubTopicPartition
- The PubSubTopicPartition representing th topic and partition to check.- Returns:
- true if the specified topic partition exists, false otherwise.
-
getRetriableExceptions
- Specified by:
getRetriableExceptions
in interfacePubSubAdminAdapter
- Returns:
- Returns a list of exceptions that are retriable for this PubSubClient.
-
getSomeTopicConfigs
Description copied from interface:PubSubAdminAdapter
Retrieves the configurations for a set of PubSub topics.- Specified by:
getSomeTopicConfigs
in interfacePubSubAdminAdapter
- Parameters:
topicNames
- The set of PubSub topics to retrieve configurations for.- Returns:
- A map of PubSub topics and their corresponding configurations.
-
partitionsFor
-
getClassName
- Specified by:
getClassName
in interfacePubSubAdminAdapter
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-