Interface MergeStrategy

All Known Implementing Classes:
NullMergeStrategy, OverwriteMergeStrategy
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MergeStrategy
Merge strategy used by a FallbackKVDatabase when migrating from one underlying database to another.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    mergeAndCommit(KVTransaction src, KVTransaction dst, Date lastActiveTime)
    Merge data from the source database being migrated away from into the destination database being migrated to.
  • Method Details

    • mergeAndCommit

      void mergeAndCommit(KVTransaction src, KVTransaction dst, Date lastActiveTime)
      Merge data from the source database being migrated away from into the destination database being migrated to.

      This method should commit() both transactions before returning; src should be committed before dst.

      If an exception is thrown, rollback() will be invoked on both transactions (a rollback() on an already-commit()'ed transaction does nothing).

      Parameters:
      src - read-only view into the database being migrated away from
      dst - read-write transaction open on the database being migrated to
      lastActiveTime - time that dst was last active, or null if never
      Throws:
      RuntimeException - if the merge or either commit() fails