package strategy
- Alphabetic
- Public
- All
Type Members
Value Members
-
object
BarneyStinsonStrategy
extends Strategy
This strategy applies a simple rule: New is always better Whenever a conflict occurs when trying to save a document in the database, the newest document (the one the client wants to store) is taken and overrides the previous revision.
-
object
StructuralMergeStrategy
extends Strategy
This strategy applies a simple structural merge algorithm between variation from a base document to the last one in the database and from the base to the current revision of the document to merge
This strategy applies a simple structural merge algorithm between variation from a base document to the last one in the database and from the base to the current revision of the document to merge
In our case, the base document is taken as common ancestor and we create patches that models these changes:
- let's name document
base
,db
andcurrent
respectively the base document, the last document from the database and the document one wants to save - let
BD
be the name of the patch frombase
todb
andBC
be the patch frombase
tocurrent
. - compute
DC
the patch that makes the same modifications asBC
but in the context of documentdb
- apply this patch to
db
The rules to apply when merging paths are the following:
`BD` `BC` `DC` Not Changed Not Changed Not Changed Not Changed Changed Changed Not Changed Deleted Deleted Changed Not Changed Changed Changed Changed Changed (`BC`) Changed Deleted Deleted Deleted Not Changed Deleted Deleted Changed Deleted Deleted Deleted Deleted Added Not Changed Added Added Added Added (`BC`) Not Changed Added Added As a special case, if the document was deleted inbetween, the current document is saved "as is" in the database (without revision)
- let's name document
-
object
TedMosbyStrategy
extends Strategy
This strategy is the anti-BarneyStinsonStrategy by definition as it applies a simple rule: Old is always better.
This strategy is the anti-BarneyStinsonStrategy by definition as it applies a simple rule: Old is always better. Whenever a conflict occurs when trying to save a document in the database, the oldest document (the one from the database) is kept.