Class VeniceView

  • Direct Known Subclasses:
    ChangeCaptureView, MaterializedView, VeniceViewWriter

    public abstract class VeniceView
    extends java.lang.Object
    This is the abstract implementation of the 'management' component for a venice view. This class is meant to be lightweight and is leveraged by the controller in order to understand what resources need to be maintained for the view. The first (and so far) only resource we have in the interface is for KafkaTopics. Creators of views should implement both this class and it's component class VeniceViewWriter and make sure it's full package name is returned by getWriterClassName() Ideally, all details about management and functionality for any given view is strictly contained within these two classes, and as little implementation details are leaked through the rest of the code base. TODO: Despite best intentions, there is still a little bit of work to do in this interface. We've had to leak some implementation details in the first cut about specific views here in order to define the naming convention for resources which must be cleaned up. Additionally, there should be support in this interface for lifecycle management of arbitrary resources (not just kafka topics).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Properties props  
      protected Store store  
      static java.lang.String VIEW_TOPIC_SEPARATOR  
      protected java.util.Map<java.lang.String,​java.lang.String> viewParameters  
    • Constructor Summary

      Constructors 
      Constructor Description
      VeniceView​(java.util.Properties props, Store store, java.util.Map<java.lang.String,​java.lang.String> viewParameters)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.util.Map<java.lang.String,​VeniceProperties> getTopicNamesAndConfigsForVersion​(int version)
      Implementations should override to return a map of topicName:topic Configs relevant for topic materialization (things like partition count, RF, etc.) TODO: Come up with list of config names that should be parsed by VeniceAdmin to pass along to TopicManager.
      java.lang.String getWriterClassName()
      Implementations should return the fully specified class name for the component VeniceViewWriter implementation.
      static boolean isViewTopic​(java.lang.String topicName)  
      static java.lang.String parseStoreFromViewTopic​(java.lang.String topicName)  
      static int parseVersionFromViewTopic​(java.lang.String topicName)  
      void validateConfigs()
      Validate that the configs set up for this view for this store are valid.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VIEW_TOPIC_SEPARATOR

        public static final java.lang.String VIEW_TOPIC_SEPARATOR
        See Also:
        Constant Field Values
      • props

        protected final java.util.Properties props
      • store

        protected final Store store
      • viewParameters

        protected final java.util.Map<java.lang.String,​java.lang.String> viewParameters
    • Constructor Detail

      • VeniceView

        public VeniceView​(java.util.Properties props,
                          Store store,
                          java.util.Map<java.lang.String,​java.lang.String> viewParameters)
    • Method Detail

      • getTopicNamesAndConfigsForVersion

        public java.util.Map<java.lang.String,​VeniceProperties> getTopicNamesAndConfigsForVersion​(int version)
        Implementations should override to return a map of topicName:topic Configs relevant for topic materialization (things like partition count, RF, etc.) TODO: Come up with list of config names that should be parsed by VeniceAdmin to pass along to TopicManager.
        Returns:
        a map keyed by the name of the topic to be created and the configs which should be applied for that creation
      • getWriterClassName

        public java.lang.String getWriterClassName()
        Implementations should return the fully specified class name for the component VeniceViewWriter implementation.
        Returns:
        returns the className of the writer which should be instantiated.
      • validateConfigs

        public void validateConfigs()
        Validate that the configs set up for this view for this store are valid. If not, throw an exception. Implementors should override this function to add their own validation logic, and need only call this base implementation optionally.
      • close

        public void close()
      • isViewTopic

        public static boolean isViewTopic​(java.lang.String topicName)
      • parseStoreFromViewTopic

        public static java.lang.String parseStoreFromViewTopic​(java.lang.String topicName)
      • parseVersionFromViewTopic

        public static int parseVersionFromViewTopic​(java.lang.String topicName)