Package org.elasticsearch.cluster
Class DiffableUtils.MapDiff<K,T,M>
- java.lang.Object
-
- org.elasticsearch.cluster.DiffableUtils.MapDiff<K,T,M>
-
- Type Parameters:
K- the type of map keysT- the type of map valuesM- the map implementation type
- Direct Known Subclasses:
DiffableUtils.ImmutableOpenMapDiff
- Enclosing class:
- DiffableUtils
public abstract static class DiffableUtils.MapDiff<K,T,M> extends Object implements Diff<M>
Represents differences between two maps of objects and is used as base class for different map implementations. Implements serialization. How differences are applied is left to subclasses.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description protected List<K>deletesprotected Map<K,Diff<T>>diffsprotected DiffableUtils.KeySerializer<K>keySerializerprotected Map<K,T>upsertsprotected DiffableUtils.ValueSerializer<K,T>valueSerializer
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapDiff(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer)protectedMapDiff(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer, List<K> deletes, Map<K,Diff<T>> diffs, Map<K,T> upserts)protectedMapDiff(StreamInput in, DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<K>getDeletes()The keys that, when this diff is applied to a map, should be removed from the map.Map<K,Diff<T>>getDiffs()Map entries that, when this diff is applied to a map, should be incrementally updated.Map<K,T>getUpserts()Map entries that, when this diff is applied to a map, should be added to the map or fully replace the previous value.voidwriteTo(StreamOutput out)Write this into the StreamOutput.
-
-
-
Constructor Detail
-
MapDiff
protected MapDiff(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer)
-
MapDiff
protected MapDiff(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer, List<K> deletes, Map<K,Diff<T>> diffs, Map<K,T> upserts)
-
MapDiff
protected MapDiff(StreamInput in, DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getDeletes
public List<K> getDeletes()
The keys that, when this diff is applied to a map, should be removed from the map.- Returns:
- the list of keys that are deleted
-
getDiffs
public Map<K,Diff<T>> getDiffs()
Map entries that, when this diff is applied to a map, should be incrementally updated. The incremental update is represented using theDiffinterface.- Returns:
- the map entries that are incrementally updated
-
getUpserts
public Map<K,T> getUpserts()
Map entries that, when this diff is applied to a map, should be added to the map or fully replace the previous value.- Returns:
- the map entries that are additions or full updates
-
writeTo
public void writeTo(StreamOutput out) throws IOException
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
-