Package io.permazen.kv.raft.fallback
Class OverwriteMergeStrategy
java.lang.Object
io.permazen.kv.raft.fallback.OverwriteMergeStrategy
- All Implemented Interfaces:
MergeStrategy
MergeStrategy
that completely overwrites the destination database with the content of the source database.-
Constructor Summary
-
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.protected void
overwrite
(KVTransaction src, KVTransaction dst) Overwrite one key/value database with another.toString()
-
Constructor Details
-
OverwriteMergeStrategy
public OverwriteMergeStrategy()
-
-
Method Details
-
mergeAndCommit
Description copied from interface:MergeStrategy
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).- Specified by:
mergeAndCommit
in interfaceMergeStrategy
- 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
-
overwrite
Overwrite one key/value database with another.This method deletes every key/value pair in
dst
, and then copy every key/value pair insrc
intodst
.Does not commit
src
ordst
.- Parameters:
src
- database to copy fromdst
- database to copysrc
onto
-
toString
-