Class CompositeDataNodeConfigSource

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class CompositeDataNodeConfigSource
    extends java.lang.Object
    An implementation of DataNodeConfigSource that combines two sources. The "primary" acts as the source of truth for users of this class, but results obtained are compared against the "secondary" source. This class can be useful for safe migrations between different backing stores.
    • Constructor Summary

      Constructors 
      Constructor Description
      CompositeDataNodeConfigSource​(com.github.ambry.clustermap.DataNodeConfigSource primarySource, com.github.ambry.clustermap.DataNodeConfigSource secondarySource, com.github.ambry.utils.Time time, com.github.ambry.clustermap.DataNodeConfigSourceMetrics metrics)  
    • Constructor Detail

      • CompositeDataNodeConfigSource

        public CompositeDataNodeConfigSource​(com.github.ambry.clustermap.DataNodeConfigSource primarySource,
                                             com.github.ambry.clustermap.DataNodeConfigSource secondarySource,
                                             com.github.ambry.utils.Time time,
                                             com.github.ambry.clustermap.DataNodeConfigSourceMetrics metrics)
        Parameters:
        primarySource - the source of truth for users of this class.
        secondarySource - all operations are also attempted against this source, but if the results of the operation differ from the primary, inconsistencies are just recorded with logs and metrics.
        time - a Time instance used for consistency verification.
        metrics - a DataNodeConfigSourceMetrics instance to use.
    • Method Detail

      • addDataNodeConfigChangeListener

        public void addDataNodeConfigChangeListener​(DataNodeConfigChangeListener listener)
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • set

        public boolean set​(com.github.ambry.clustermap.DataNodeConfig config)
      • get

        public com.github.ambry.clustermap.DataNodeConfig get​(java.lang.String instanceName)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable