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 java.lang.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 java.util.List<K>
deletes
protected java.util.Map<K,Diff<T>>
diffs
protected DiffableUtils.KeySerializer<K>
keySerializer
protected java.util.Map<K,T>
upserts
protected DiffableUtils.ValueSerializer<K,T>
valueSerializer
-
Constructor Summary
Constructors Modifier Constructor Description protected
MapDiff(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer)
protected
MapDiff(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer, java.util.List<K> deletes, java.util.Map<K,Diff<T>> diffs, java.util.Map<K,T> upserts)
protected
MapDiff(StreamInput in, DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer)
-
Method Summary
Modifier and Type Method Description java.util.List<K>
getDeletes()
The keys that, when this diff is applied to a map, should be removed from the map.java.util.Map<K,Diff<T>>
getDiffs()
Map entries that, when this diff is applied to a map, should be incrementally updated.java.util.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.void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
-
-
Field Detail
-
deletes
protected final java.util.List<K> deletes
-
keySerializer
protected final DiffableUtils.KeySerializer<K> keySerializer
-
valueSerializer
protected final DiffableUtils.ValueSerializer<K,T> valueSerializer
-
-
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, java.util.List<K> deletes, java.util.Map<K,Diff<T>> diffs, java.util.Map<K,T> upserts)
-
MapDiff
protected MapDiff(StreamInput in, DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K,T> valueSerializer) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getDeletes
public java.util.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 java.util.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 theDiff
interface.- Returns:
- the map entries that are incrementally updated
-
getUpserts
public java.util.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 java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
-