Package io.permazen.kv.raft.fallback
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.
Merge strategy used by a
FallbackKVDatabase
when migrating from one underlying database to another.-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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 beforedst
.If an exception is thrown,
rollback()
will be invoked on both transactions (arollback()
on an already-commit()
'ed transaction does nothing).- Parameters:
src
- read-only view into the database being migrated away fromdst
- read-write transaction open on the database being migrated tolastActiveTime
- time thatdst
was last active, or null if never- Throws:
RuntimeException
- if the merge or eithercommit()
fails
-