orbit-db-store
orbit-db-store copied to clipboard
Create basic implementation for _addOperationBatch
I was trying to use the "batchPut" function in orbit-db-docstore but noticed that this method wasn't implemented yet.
Rebuilding the index seemed like it was probably the most expensive part, so I saved it for the last operation. I wasn't sure if there were any other intended optimizations. I wasn't sure what to do the with "batchOperation" variable that is passed in. I'm also not sure if "_localHeads" should be set every iteration or just the last one.
Hey @ptoner, if you're still interested in getting this in I'd love to help. It would be great to have tests, might you be able to write them?
Yea I'm still into it. It's been so long that I forgot that I actually included code, ha. What kinds of tests would we need? I still don't know the answers to my original questions.
I see - @haadcode looks like Git blames you :laughing: https://github.com/orbitdb/orbit-db-store/commit/77490af21fbacc4e598691e26c10579e14d54671
What did you have in mind for these arguments or this function in general? See @ptoner 's ruminations in the OP
It was a long time ago and afaik we don't use _addBatchOperation()
anywhere. More generally, as this was never implemented, feel free to implement it the best possible way, including the signature of the function.
That is to say, I don't know (can't remember) what the batchOperation
variable is :)
On high level it makes sense that we would set _localHeads
as the very last thing, only once.
Does that answer your questions?
Yes that does help. I'll try to put together some tests for this soon. Thanks!