I have a fork of Badger that implements a
Item.Copy() mechanic, where the
Item comes from
At the moment, each
item is only valid within a
Next() call, as the object is re-used between iterations.
However, I wanted to copy the item struct, so that I can call
item.ValueCopy() at some future point, but still within the same transaction. This was driven by the fact that calling
item.ValueCopy() is faster then
db.Get(key) since the item contains the
valueptr which points to where we can get the value in the value log. Without having to traverse the various trees/levels like what happens when you call
My question is: Would something like this
item.Copy be an interesting feature to have on badger enough for me to open up a PR?
I’d prefer to not use a fork forever, and have this functionality in the main repo.
Please let me know
PS: Here are the changes in question, relatively simple/straight forward.
$ go version 1.18
Ubuntu via WS1 on Windows 10
Feature request, N/A