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>
  • Method Details

    • incrementVersion

      EntryVersion incrementVersion(int segment)
      Generates a new version for an entry in given segment.
      Parameters:
      segment -
    • isVersionActual

      boolean isVersionActual(int segment, EntryVersion version)
      Parameters:
      segment -
      version -
      Returns:
      True if the version was generated by this node after most recently becoming owner of the given segment.
    • scheduleKeyInvalidation

      void scheduleKeyInvalidation(K key, EntryVersion version, boolean removal)
      Notifies the manager that an operation on given key with version previously retrieved from 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.
      Parameters:
      key -
      version -
      removal -
    • clearInvalidations

      void clearInvalidations()
      Forget all non-processed invalidations scheduled through scheduleKeyInvalidation(Object, EntryVersion, boolean)
    • registerSegment

      void registerSegment(int segment)
      Parameters:
      segment -
    • unregisterSegment

      void unregisterSegment(int segment)
      Parameters:
      segment -
    • setOwnedSegments

      void setOwnedSegments(IntSet segments)
      Parameters:
      segments -
    • startKeyTransfer

      void startKeyTransfer(IntSet segments)
    • 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 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.
    • notifyValueTransferFinished

      void notifyValueTransferFinished()
      All entries have been received and we can put segments owned according to consistent hash to ScatteredVersionManager.SegmentState.OWNED state.
    • getSegmentState

      ScatteredVersionManager.SegmentState getSegmentState(int segment)
      Parameters:
      segment -
      Returns:
      Current status of the segment.
    • getBlockingFuture

      CompletableFuture<Void> getBlockingFuture(int segment)
      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

      CompletableFuture<Void> valuesFuture(int topologyId)
      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

      void updatePreloadedEntryVersion(EntryVersion version)
      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()