27 lines
No EOL
1 KiB
Markdown
27 lines
No EOL
1 KiB
Markdown
extras
|
|
|
|
- pocketbase : for small projects
|
|
- Conflict-Free Replicated Data Type: A conflict-free replicated data type (CRDT) is a special distributed data structure that lets multiple computers store, update, and sync copies of data independently without needing a central coordinator or locking mechanism
|
|
- last write wins
|
|
|
|
```txt
|
|
there is a table name tab and it contains a column name col.
|
|
|
|
now this database is in both devices and is same too. values in column 'col' of table 'tab' in both database are A.B,C which is last modified at 5pm
|
|
|
|
in device1 changes being made and now its value is X,B . this database is last updated at 6pm
|
|
in device2 changes being made and now its value is Y,C. this database is last updated at 7pm
|
|
|
|
now how to sync the changes?
|
|
in first one, A is replaced with X, C is deleted
|
|
in 2nd one, A is replaced with Y, B is deleted
|
|
|
|
so total changes are
|
|
A -> X
|
|
C -> gone
|
|
A -> Y
|
|
B -> gone
|
|
|
|
here A being updated to either X and Y is decided by time so latest one ie 7pm one win and A->Y, B and C are deleted
|
|
so finally it will be Y
|
|
``` |