public class ScatteredVersionManagerImpl<K> extends Object implements ScatteredVersionManager<K>
ScatteredVersionManager.SegmentState
Modifier and Type | Field and Description |
---|---|
protected static Log |
log |
protected static boolean |
trace |
Constructor and Description |
---|
ScatteredVersionManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
clearInvalidations()
Forget all non-processed invalidations scheduled through
ScatteredVersionManager.scheduleKeyInvalidation(Object, EntryVersion, boolean) |
CompletableFuture<Void> |
getBlockingFuture(int segment) |
ScatteredVersionManager.SegmentState |
getSegmentState(int segment) |
EntryVersion |
incrementVersion(int segment)
Generates a new version for an entry in given segment.
|
void |
initTopologyId() |
boolean |
isVersionActual(int segment,
EntryVersion version) |
void |
notifyKeyTransferFinished(int segment,
boolean expectValues,
boolean cancelled)
All key + version data from given segment have been received, or the key transfer failed.
|
void |
notifyValueTransferFinished()
All entries have been received and we can put segments owned according to consistent hash
to
ScatteredVersionManager.SegmentState.OWNED state. |
void |
registerSegment(int segment)
Move the segment to
ScatteredVersionManager.SegmentState.BLOCKED state. |
protected void |
regularInvalidationFinished(Object[] keys,
int[] topologyIds,
long[] versions,
boolean[] isRemoved,
boolean force) |
protected void |
removeInvalidationsFinished() |
void |
scheduleKeyInvalidation(K key,
EntryVersion version,
boolean removal)
Notifies the manager that an operation on given key with version previously retrieved from
ScatteredVersionManager.incrementVersion(int) has finished. |
void |
setOwnedSegments(IntSet segments)
Move the segment from
ScatteredVersionManager.SegmentState.NOT_OWNED to ScatteredVersionManager.SegmentState.OWNED without transferring data. |
void |
setTopologyId(int topologyId)
Set current topology id.
|
void |
setValuesTransferTopology(int topologyId) |
void |
start() |
protected boolean |
startFlush() |
void |
startKeyTransfer(IntSet segments)
Move the segments from
ScatteredVersionManager.SegmentState.BLOCKED to ScatteredVersionManager.SegmentState.KEY_TRANSFER state. |
void |
stop() |
void |
unregisterSegment(int segment)
Move the segment to
ScatteredVersionManager.SegmentState.NOT_OWNED state. |
void |
updatePreloadedEntryVersion(EntryVersion version)
This is called only during preload.
|
CompletableFuture<Void> |
valuesFuture(int topologyId) |
protected static final Log log
protected static final boolean trace
public void start()
public void initTopologyId()
public void stop()
public EntryVersion incrementVersion(int segment)
ScatteredVersionManager
incrementVersion
in interface ScatteredVersionManager<K>
public void scheduleKeyInvalidation(K key, EntryVersion version, boolean removal)
ScatteredVersionManager
ScatteredVersionManager.incrementVersion(int)
has finished. This operation has to be executed on originator of the operation
once the entry was stored on both nodes.
Eventually order versions of entries will be removed on other nodes. When the entry was completely removed
by the operation, the nodes have stored a tombstone of that entry. The older versions will be dropped regularly
and after this is confirmed the tombstones will be invalidated, too.scheduleKeyInvalidation
in interface ScatteredVersionManager<K>
protected boolean startFlush()
public void registerSegment(int segment)
ScatteredVersionManager
ScatteredVersionManager.SegmentState.BLOCKED
state.registerSegment
in interface ScatteredVersionManager<K>
public void unregisterSegment(int segment)
ScatteredVersionManager
ScatteredVersionManager.SegmentState.NOT_OWNED
state.unregisterSegment
in interface ScatteredVersionManager<K>
public boolean isVersionActual(int segment, EntryVersion version)
isVersionActual
in interface ScatteredVersionManager<K>
public void notifyKeyTransferFinished(int segment, boolean expectValues, boolean cancelled)
ScatteredVersionManager
notifyKeyTransferFinished
in interface ScatteredVersionManager<K>
expectValues
- True when the transfer failed and the segment will be moved
to the ScatteredVersionManager.SegmentState.OWNED
state without waiting for values.cancelled
- True is the transfer was cancelled due to a new topology - in that case
the segment will end up in ScatteredVersionManager.SegmentState.NOT_OWNED
. This takes
precedence over expectValues
.public ScatteredVersionManager.SegmentState getSegmentState(int segment)
getSegmentState
in interface ScatteredVersionManager<K>
status
of the segment.public void setValuesTransferTopology(int topologyId)
setValuesTransferTopology
in interface ScatteredVersionManager<K>
public void notifyValueTransferFinished()
ScatteredVersionManager
ScatteredVersionManager.SegmentState.OWNED
state.notifyValueTransferFinished
in interface ScatteredVersionManager<K>
public CompletableFuture<Void> getBlockingFuture(int segment)
getBlockingFuture
in interface ScatteredVersionManager<K>
ScatteredVersionManager.SegmentState.BLOCKED
state.public void setTopologyId(int topologyId)
ScatteredVersionManager
setTopologyId
in interface ScatteredVersionManager<K>
public void updatePreloadedEntryVersion(EntryVersion version)
ScatteredVersionManager
updatePreloadedEntryVersion
in interface ScatteredVersionManager<K>
public CompletableFuture<Void> valuesFuture(int topologyId)
valuesFuture
in interface ScatteredVersionManager<K>
CompletableFuture
that completes when value transfer has finished for the given topology id.public void setOwnedSegments(IntSet segments)
ScatteredVersionManager
ScatteredVersionManager.SegmentState.NOT_OWNED
to ScatteredVersionManager.SegmentState.OWNED
without transferring data.setOwnedSegments
in interface ScatteredVersionManager<K>
public void startKeyTransfer(IntSet segments)
ScatteredVersionManager
ScatteredVersionManager.SegmentState.BLOCKED
to ScatteredVersionManager.SegmentState.KEY_TRANSFER
state.startKeyTransfer
in interface ScatteredVersionManager<K>
protected void regularInvalidationFinished(Object[] keys, int[] topologyIds, long[] versions, boolean[] isRemoved, boolean force)
protected void removeInvalidationsFinished()
public void clearInvalidations()
ScatteredVersionManager
ScatteredVersionManager.scheduleKeyInvalidation(Object, EntryVersion, boolean)
clearInvalidations
in interface ScatteredVersionManager<K>
Copyright © 2021 JBoss by Red Hat. All rights reserved.