Class ClusteredCacheBackupReceiver

java.lang.Object
org.infinispan.xsite.ClusteredCacheBackupReceiver
All Implemented Interfaces:
BackupReceiver

public class ClusteredCacheBackupReceiver extends Object implements BackupReceiver
BackupReceiver implementation for clustered caches.
Since:
7.1
Author:
Pedro Ruivo
  • Constructor Details

    • ClusteredCacheBackupReceiver

      public ClusteredCacheBackupReceiver()
  • Method Details

    • start

      public void start()
    • handleStateTransferControl

      public CompletionStage<Void> handleStateTransferControl(String originSite, boolean startReceiving)
      Description copied from interface: BackupReceiver
      It handles starting or finishing, base on startReceiving, of the state transfer from a remote site.

      The command must be broadcast to the entire cluster in which the cache exists.

      Specified by:
      handleStateTransferControl in interface BackupReceiver
      Parameters:
      originSite - The remote site which is starting or finishing sending the state transfer.
      startReceiving - true if the originSite wants to start sending state.
    • handleStateTransferState

      public CompletionStage<Void> handleStateTransferState(XSiteState[] chunk, long timeoutMs)
      Description copied from interface: BackupReceiver
      It handles the state transfer state from a remote site. It is possible to have a single node applying the state or forward the state to respective primary owners.
      Specified by:
      handleStateTransferState in interface BackupReceiver
    • handleRemoteCommand

      public final <O> CompletionStage<O> handleRemoteCommand(VisitableCommand command)
      Specified by:
      handleRemoteCommand in interface BackupReceiver
    • putKeyValue

      public CompletionStage<Void> putKeyValue(Object key, Object value, Metadata metadata, IracMetadata iracMetadata)
      Description copied from interface: BackupReceiver
      Updates the key with the value from a remote site.

      If a conflict occurs, the update can be discarded.

      Specified by:
      putKeyValue in interface BackupReceiver
      Parameters:
      key - The key to update.
      value - The new value.
      metadata - The new Metadata.
      iracMetadata - The IracMetadata for conflict resolution.
      Returns:
      A CompletionStage that is completed when the update is apply in the cluster or is discarded.
    • removeKey

      public CompletionStage<Void> removeKey(Object key, IracMetadata iracMetadata, boolean expiration)
      Description copied from interface: BackupReceiver
      Deletes the key.

      This is a request from the remote site and the removal can be discarded if a conflict happens.

      Specified by:
      removeKey in interface BackupReceiver
      Parameters:
      key - The key to delete.
      iracMetadata - The IracMetadata for conflict resolution.
      expiration - true if it is to remove an expired key.
      Returns:
      A CompletionStage that is completed when the key is deleted or it is discarded.
    • clearKeys

      public CompletionStage<Void> clearKeys()
      Description copied from interface: BackupReceiver
      Clears the cache.

      This is not safe and it doesn't perform any conflict resolution.

      Specified by:
      clearKeys in interface BackupReceiver
      Returns:
      A CompletionStage that is completed when the cache is cleared.
    • touchEntry

      public CompletionStage<Boolean> touchEntry(Object key)
      Description copied from interface: BackupReceiver
      Touches an entry and returns if it was able to or not.
      Specified by:
      touchEntry in interface BackupReceiver
      Parameters:
      key - the key of the entry to touch
      Returns:
      if the entry was touched
    • isTransactionTableEmpty

      public boolean isTransactionTableEmpty()