Skip to content
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

Add delete metadata so delete ops have a fixed seq #40

Open
Frando opened this issue Jul 1, 2020 · 2 comments
Open

Add delete metadata so delete ops have a fixed seq #40

Frando opened this issue Jul 1, 2020 · 2 comments

Comments

@Frando
Copy link
Contributor

Frando commented Jul 1, 2020

If tracking a hypercore that is a hypertrie for changes, it's easy to track all put operations. However, deletes are not clearly identifieable from the log because they are (quoting mafintosh): "puts with a hash distance nearby key. You can’t trivially identity them with the differ".

For kappa-core style usecases things are much easier if each operation has a fixed sequence number by which it can be addressed and indexed. If deletes in Hypertrie were Nodes with the deleted key plus a deleted flag, that would be straightforward (which it is not at the moment).

@mafintosh
Copy link
Collaborator

So the hypercore in hypertrie does not contain operations but just pointers to the current trie.
That’s why deletes looks like puts cause it’s all just updated pointers.

To make it easier to identify I’m down to introduce a .deletes number that’s a seq to the entry this node deletes or 0 otherwise.

If anyone wants to volunteer a PR for that it’s appreciated otherwise we’ll get to it at some point

@mafintosh
Copy link
Collaborator

I don't think adding that would be much harder than adding https://github.com/hypercore-protocol/hypertrie/blob/master/lib/put.js#L31 to the node when it's written + some tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants