Interface IracManager

All Known Implementing Classes:
DefaultIracManager, NoOpIracManager

public interface IracManager
It manages the keys changed in the local cluster and sends to all asynchronous backup configured.

The lockOwner is the last command (or transaction) who updated the key. It is used to detect conflicting local updates while sending to the remote backups (sites).

Since:
11.0
Author:
Pedro Ruivo
  • Method Details

    • trackUpdatedKey

      void trackUpdatedKey(int segment, Object key, Object lockOwner)
      Sets the key as changed by the lockOwner.
      Parameters:
      segment - The key's segment.
      key - The key changed.
      lockOwner - The lock owner who updated the key.
    • trackExpiredKey

      void trackExpiredKey(int segment, Object key, Object lockOwner)
      Similar to trackUpdatedKey(int, Object, Object) but it tracks expired keys instead.

      Expired key need a different conflict resolution algorithm since remove expired should never win any conflict.

      Parameters:
      segment - The key's segment.
      key - The key expired.
      lockOwner - The lock owner who updated the key.
    • trackForStateTransfer

      CompletionStage<Void> trackForStateTransfer(Collection<XSiteState> stateList)
      Tracks a set of keys to be sent to the remote site.

      There is no much difference between this method and trackUpdatedKey(int, Object, Object). It just returns a CompletionStage to notify when the keys were sent. It is required by the cross-site state transfer protocol to know when it has finish.

      Parameters:
      stateList - The list of XSiteState.
      Returns:
      A CompletionStage which is completed when all the keys in stateList have been sent to the remote site.
    • trackClear

      void trackClear(boolean sendClear)
      Sets all keys as removed.
      Parameters:
      sendClear - if true, an IracClearKeysRequest is sent to the backup sites.
    • removeState

      void removeState(IracManagerKeyInfo state)
      Removes the state associated to a single key.
      Parameters:
      state - The state to remove.
    • onTopologyUpdate

      void onTopologyUpdate(CacheTopology oldCacheTopology, CacheTopology newCacheTopology)
      Notifies a topology changed.
      Parameters:
      oldCacheTopology - The old CacheTopology.
      newCacheTopology - The new CacheTopology.
    • requestState

      void requestState(Address requestor, IntSet segments)
      Requests the state stored in this instance for the given segments.
      Parameters:
      requestor - The requestor.
      segments - The segments requested.
    • receiveState

      void receiveState(int segment, Object key, Object lockOwner, IracMetadata tombstone)
      Receives the state related to the key.
      Parameters:
      segment - The key's segment.
      key - The key modified.
      lockOwner - The last lockOwner.
      tombstone - The tombstone (can be null)
    • checkAndTrackExpiration

      CompletionStage<Boolean> checkAndTrackExpiration(Object key)
      Checks if the given key is expired on all other sites. If the key is expired on all other sites this will return true
      Parameters:
      key - The key to check if it is expired or not
      Returns:
      Whether this key is expired on all other sites
    • incrementNumberOfDiscards

      void incrementNumberOfDiscards()
      Increase the count of discards.
    • incrementNumberOfConflictLocalWins

      void incrementNumberOfConflictLocalWins()
      Increase the count of conflicts if merge policy discard update (local value wins)
    • incrementNumberOfConflictRemoteWins

      void incrementNumberOfConflictRemoteWins()
      Increase the count of conflicts if merge policy applies update (remote value wins)
    • incrementNumberOfConflictMerged

      void incrementNumberOfConflictMerged()
      Increase the count of conflicts if merge policy created a new value (merge remote value with local value)
    • containsKey

      boolean containsKey(Object key)
      Checks if the key is present.

      A key is present as long as its latest update was not confirmed by all remote sites.

      Parameters:
      key - The key to check.
      Returns:
      true if the key is present.