Package com.github.ambry.clustermap
Class CompositeDataNodeConfigSource
- java.lang.Object
-
- com.github.ambry.clustermap.CompositeDataNodeConfigSource
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class CompositeDataNodeConfigSource extends java.lang.Object
An implementation ofDataNodeConfigSource
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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDataNodeConfigChangeListener(DataNodeConfigChangeListener listener)
void
close()
com.github.ambry.clustermap.DataNodeConfig
get(java.lang.String instanceName)
boolean
set(com.github.ambry.clustermap.DataNodeConfig config)
-
-
-
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
- aTime
instance used for consistency verification.metrics
- aDataNodeConfigSourceMetrics
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 interfacejava.lang.AutoCloseable
-
-