When building a hyperdb-index, a common desire is to, when processing a node, to remove all previous heads from the index for that key, and replace them with the new value.
With hyperlog, node.links gave those hashes. How could this be done with hyperdb? I hacked it together in a roundabout way:
modify the new node's node.clock back one entry for its local feed
convert node.clock into a buffer of heads compatible with hyperdb#version
do a hyperdb#checkout of that version (one entry before this new node was inserted)
do a lookup on node.key: these are the old heads
This works, but it's a pretty heavy process, especially in the tight loop of an indexer.
@mafintosh can this be done more efficiency with the already existing incremental index?
When building a hyperdb-index, a common desire is to, when processing a node, to remove all previous heads from the index for that key, and replace them with the new value.
With hyperlog,
node.links
gave those hashes. How could this be done with hyperdb? I hacked it together in a roundabout way:node.clock
back one entry for its local feednode.clock
into a buffer of heads compatible withhyperdb#version
hyperdb#checkout
of that version (one entry before this new node was inserted)node.key
: these are the old headsThis works, but it's a pretty heavy process, especially in the tight loop of an indexer.
@mafintosh can this be done more efficiency with the already existing incremental index?