-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Created by @CMCDragonkai
I want to explore the idea of making Polykey NEVER have a merge conflict.
How do we do this? Well we must limit the control surface of pushes/pulls and changes so that this can never occur.
One idea is this. As soon as a vault has been pushed to a keynode. If that keynode changes that vault. It doesn't mutate that vault. Instead what happens is that the vault is forked, and represents a new vault.
This idea is actually similar to persistent data structures. That is if every vault is a chain of states/changes. Then that makes it a linked list. Any subsequent change doesn't mean the old version of the data structure is gone.
In Haskell and in js-resource-counter we have persistent data structures. Sharing a linked list between 2 functions that change the list doesn't affect each other.
This also means you can never rewrite history. You can only go ahead. Vaults are there append-only hash chains (linked lists).
This also means visible vaults are like garbage collected "handles". Or views of the data structures. You can view at any point.
Then pushing a vault from source keynode to target keynode is about appending new changes to a particular vault view.
All the vaults can then form a tree. But any specific vault forms a linear chain back to the beginning.
This should prevent any possibility of merge conflicts.
Other ideas include CRDTs.
This may impact how we identify vaults. Instead of randomly generated vaultids. They are some deterministically generated identifier of a particular position in the tree of commits.
Resolved in https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/205