-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No longer preserve vault ID on cloneVault
#253
Comments
This is mostly already being done inside of 266, the remote node and vault are stored in the db as metadata to the vault. However, the cloned vaults are not yet immutable. This should be a simple case of maybe just setting a property on each vault (if it is cloned) and then checking that if a commit is trying to be made. I'll make these changes on 266 as well unless anyone has any objections |
@scottmmorris I remember we briefly mentioned whether we could make use of a |
Currently the remote field is purely stored in the db as metadata with no in memory state for the remote. So it would mean having to reading from the db every time you want to make a commit to check if the remote field is set. I can't see a better way around this then to just have a property that is set each time a vault is created just by reading the db then and so then it wont have to be done for the remainder of the lifetime of that vault. Is that what is meant by having a remote field?
Or alternatively the remote could be stored like this to save having to read the db each time:
Also I have made it so the remote details are only mutatable by cloning and pulling, so no direct interfacing with the remote fields is done by the user. This wasn't explicitly mentioned in the spec but I think that makes sense considering the only reason for now for changing the remote of a vault would be to pull from there. |
Is there any benefit gained from having an explicit |
Yeah it just saves you having to read the db multiple times throughout the lifespan of a vault. Say you pulled twice to a vault and then tried to write a commit on the vault:
Pull , clone and commit would use that remote property |
That seems like the best solution to me then. By default, I'd expect the |
Will be fixed by #266 |
Specification
Before we had the concept of a
remote
field on a vault, we were intending to preserve the vault ID of a cloned vault, such that they retain their unique identity in the global Polykey network. However, now that we're using theremote
field for a vault, we can remove this.For example, if a node
A
has a vault with IDid1
and shares this vault withB
, when cloning, the local, cloned version onB
will have a completely different ID.Recall that a cloned vault is intended to be immutable. We've had discussions on what the presence of a
remote
field actually indicates. If aremote
field is set (i.e. not undefined or missing), then this will indicate that a vault is a cloned/synchronised vault (i.e. originally coming from some other node). Therefore, any vault with aremote
field set should be immutable.Additional context
remote
field as an indicator for immutability https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/205#note_688569888 (see the notes just below "cloned vaults are immutable")Tasks
remote
field to benodeID + vaultID
The text was updated successfully, but these errors were encountered: