Class DcrStorage

java.lang.Object
org.gridgain.internal.dcr.metastorage.DcrStorage

public class DcrStorage extends Object
Replication storage based on metastorage MetaStorageManager.
  • Constructor Details

    • DcrStorage

      public DcrStorage(org.apache.ignite.internal.metastorage.MetaStorageManager manager)
      Constructor.
      Parameters:
      manager - Meta storage manager.
  • Method Details

    • registerStoreListener

      public org.gridgain.internal.lang.Disposable registerStoreListener(DcrStorageListener listener)
      Registers storage listener.
      Parameters:
      listener - Store listener to register.
    • put

      public CompletableFuture<Boolean> put(String name, ReplicationEntry entry)
      Persists replication to storage.
      Parameters:
      name - Replication name.
      entry - Replication options.
      Returns:
      Future with true result if status updated successfully.
    • findByNode

      public CompletableFuture<Map<String,ReplicationEntry>> findByNode(String nodeName)
      Find all replications by worker node.
      Parameters:
      nodeName - Worker node name.
      Returns:
      Future with list of replications which hosted on provided node.
    • get

      Returns stored replication options by provided identifier.
      Parameters:
      name - Replication name.
      Returns:
      Future with options result or null in case when replication with provided identifier doesn't exist.
    • getAll

      Returns all stored replication entries.
      Returns:
      Future with list of replication entries.
    • remove

      public CompletableFuture<Boolean> remove(String name)
      Removes replication from storage.
      Parameters:
      name - Replication name.
      Returns:
      Future with true result if status updated successfully.
    • remove

      public CompletableFuture<Boolean> remove(String name, Predicate<ReplicationEntry> checker)
      Removes replication from storage if it satisfies the supplied predicate.
      Parameters:
      name - Replication name.
      checker - Predicate to apply to the replication to determine if it should be deleted.
      Returns:
      Future with true result if status updated successfully.
    • update

      public CompletableFuture<Boolean> update(String name, Function<ReplicationEntry,ReplicationEntry> func, boolean withRetry)
      Update entry.
      Parameters:
      name - Replication name.
      func - Update function.
      withRetry - Whether to retry on CAS failure.
      Returns:
      Future with true result if status updated successfully.
    • forceUpdate

      Force-update an entry even when the new value equals the current one. This creates a new metastorage revision which triggers watch listeners.
      Parameters:
      name - Replication name.
      func - Update function.
      Returns:
      Future with true result if entry was written.
    • putWatermark

      public CompletableFuture<Void> putWatermark(String name, String tableName, byte[] watermarkBytes)
      Persists the latest CQ watermark for (name, tableName) under a separate metastorage key. Last-write-wins semantics — no CAS — because watermarks only move forward.
      Parameters:
      name - Replication name.
      tableName - Fully-qualified table name.
      watermarkBytes - Serialized watermark.
    • getWatermarks

      public CompletableFuture<Map<String,byte[]>> getWatermarks(String name)
      Reads every saved watermark for the given replication.
      Parameters:
      name - Replication name.
      Returns:
      Map of tableName -> watermarkBytes; empty when nothing is saved yet.
    • removeWatermarks

      public CompletableFuture<Void> removeWatermarks(String name)
      Removes every saved watermark for the given replication. Called when the replication itself is removed.
    • removeWatermark

      public CompletableFuture<Void> removeWatermark(String name, String tableName)
      Removes the saved watermark for a single (name, tableName) pair. Used when a table's watermark is no longer trustworthy (e.g. CQ rejected it as too old) and the table is about to be truncated and re-FST'd. Removing the watermark first guarantees that a crash mid-truncate cannot leave the system trying to resume from a stale watermark on a partially-truncated table.