Interface ScatteredVersionManager<K>


  • public interface ScatteredVersionManager<K>
    Manages versions of entries and states of segments.
    Author:
    Radim Vansa <rvansa@redhat.com>
    • Method Detail

      • 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 -
      • 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.
      • getBlockingFuture

        java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.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 -