Package org.infinispan.scattered
Interface ScatteredVersionManager<K>
- All Known Implementing Classes:
ScatteredVersionManagerImpl
public interface ScatteredVersionManager<K>
Manages versions of entries and states of segments.
- Author:
- Radim Vansa <rvansa@redhat.com>
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Forget all non-processed invalidations scheduled throughscheduleKeyInvalidation(Object, EntryVersion, boolean)
getBlockingFuture
(int segment) int
getSegmentState
(int segment) incrementVersion
(int segment) Generates a new version for an entry in given segment.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
All entries have been received and we can put segments owned according to consistent hash toScatteredVersionManager.SegmentState.OWNED
state.void
registerSegment
(int segment) Move the segment toScatteredVersionManager.SegmentState.BLOCKED
state.void
scheduleKeyInvalidation
(K key, EntryVersion version, boolean removal) Notifies the manager that an operation on given key with version previously retrieved fromincrementVersion(int)
has finished.void
setOwnedSegments
(IntSet segments) Move the segment fromScatteredVersionManager.SegmentState.NOT_OWNED
toScatteredVersionManager.SegmentState.OWNED
without transferring data.void
setTopologyId
(int topologyId) Set current topology id.void
setValuesTransferTopology
(int topologyId) void
startKeyTransfer
(IntSet segments) Move the segments fromScatteredVersionManager.SegmentState.BLOCKED
toScatteredVersionManager.SegmentState.KEY_TRANSFER
state.void
unregisterSegment
(int segment) Move the segment toScatteredVersionManager.SegmentState.NOT_OWNED
state.void
updatePreloadedEntryVersion
(EntryVersion version) This is called only during preload.valuesFuture
(int topologyId)
-
Method Details
-
incrementVersion
Generates a new version for an entry in given segment.- Parameters:
segment
-
-
isVersionActual
- Parameters:
segment
-version
-- Returns:
- True if the version was generated by this node after most recently becoming owner of the given segment.
-
scheduleKeyInvalidation
Notifies the manager that an operation on given key with version previously retrieved fromincrementVersion(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.- Parameters:
key
-version
-removal
-
-
clearInvalidations
void clearInvalidations()Forget all non-processed invalidations scheduled throughscheduleKeyInvalidation(Object, EntryVersion, boolean)
-
registerSegment
void registerSegment(int segment) Move the segment toScatteredVersionManager.SegmentState.BLOCKED
state.- Parameters:
segment
-
-
unregisterSegment
void unregisterSegment(int segment) Move the segment toScatteredVersionManager.SegmentState.NOT_OWNED
state.- Parameters:
segment
-
-
setOwnedSegments
Move the segment fromScatteredVersionManager.SegmentState.NOT_OWNED
toScatteredVersionManager.SegmentState.OWNED
without transferring data.- Parameters:
segments
-
-
startKeyTransfer
Move the segments fromScatteredVersionManager.SegmentState.BLOCKED
toScatteredVersionManager.SegmentState.KEY_TRANSFER
state. -
notifyKeyTransferFinished
void notifyKeyTransferFinished(int segment, boolean expectValues, boolean cancelled) All key + version data from given segment have been received, or the key transfer failed.- Parameters:
segment
-expectValues
- True when the transfer failed and the segment will be moved to theScatteredVersionManager.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 inScatteredVersionManager.SegmentState.NOT_OWNED
. This takes precedence overexpectValues
.
-
notifyValueTransferFinished
void notifyValueTransferFinished()All entries have been received and we can put segments owned according to consistent hash toScatteredVersionManager.SegmentState.OWNED
state. -
getSegmentState
- Parameters:
segment
-- Returns:
- Current
status
of the segment.
-
getBlockingFuture
- Parameters:
segment
-- Returns:
- A completable future that can be used to schedule an operation once that the segment has moved from
ScatteredVersionManager.SegmentState.BLOCKED
state.
-
setValuesTransferTopology
void setValuesTransferTopology(int topologyId) -
valuesFuture
- Returns:
- A
CompletableFuture
that completes when value transfer has finished for the given topology id.
-
setTopologyId
void setTopologyId(int topologyId) Set current topology id.- Parameters:
topologyId
-
-
updatePreloadedEntryVersion
This is called only during preload. Makes sure that the cache will start with topology higher than the one stored in a cache store.- Parameters:
version
-
-
getPreloadedTopologyId
int getPreloadedTopologyId()
-