Package org.opensearch.cluster
Class DiffableUtils.MapDiff<K,T,M>
java.lang.Object
org.opensearch.cluster.DiffableUtils.MapDiff<K,T,M>
- Type Parameters:
K
- the type of map keysT
- the type of map valuesM
- the map implementation type
- All Implemented Interfaces:
Diff<M>
,org.opensearch.core.common.io.stream.Writeable
- Enclosing class:
DiffableUtils
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.
- Opensearch.internal:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DiffableUtils.KeySerializer
<K> protected final DiffableUtils.ValueSerializer
<K, T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MapDiff
(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K, T> valueSerializer) protected
MapDiff
(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K, T> valueSerializer, List<K> deletes, Map<K, Diff<T>> diffs, Map<K, T> upserts) protected
MapDiff
(org.opensearch.core.common.io.stream.StreamInput in, DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K, T> valueSerializer) -
Method Summary
Modifier and TypeMethodDescriptionThe keys that, when this diff is applied to a map, should be removed from the map.getDiffs()
Map entries that, when this diff is applied to a map, should be incrementally updated.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
(org.opensearch.core.common.io.stream.StreamOutput out)
-
Field Details
-
deletes
-
diffs
-
upserts
-
keySerializer
-
valueSerializer
-
-
Constructor Details
-
MapDiff
protected MapDiff(DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K, T> valueSerializer) -
MapDiff
-
MapDiff
protected MapDiff(org.opensearch.core.common.io.stream.StreamInput in, DiffableUtils.KeySerializer<K> keySerializer, DiffableUtils.ValueSerializer<K, T> valueSerializer) throws IOException- Throws:
IOException
-
-
Method Details
-
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
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
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
- Specified by:
writeTo
in interfaceorg.opensearch.core.common.io.stream.Writeable
- Throws:
IOException
-