ipfs / go-datastore

key-value datastore interfaces
MIT License
230 stars 65 forks source link

autobatch: thread-safe, debounce, max delay and implement Batching #180

Open MichaelMure opened 3 years ago

MichaelMure commented 3 years ago

Revamp the venerable autobatch in different ways:

aschmahmann commented 3 years ago

@whyrusleeping you might be interested in this.

MichaelMure commented 2 years ago

I can't comment on Query(), so will comment here. Is the intention of flushing in Query() before issuing the query, to make sure that there are no pending ops before sending the query? If so, then I think that's racy (it unlocks after flushing and re-locks before querying).

This is correct, but at the same time Query can be very long lived (I used some hours-long Query before) so I don't think blocking writes during a Query is reasonable.

guseggert commented 2 years ago

I can't comment on Query(), so will comment here. Is the intention of flushing in Query() before issuing the query, to make sure that there are no pending ops before sending the query? If so, then I think that's racy (it unlocks after flushing and re-locks before querying).

This is correct, but at the same time Query can be very long lived (I used some hours-long Query before) so I don't think blocking writes during a Query is reasonable.

Ah that makes sense, thanks :)

BigLep commented 2 years ago

@MichaelMure : I've converted this to a draft. If/once you've incorporated feedback, feel free to publish and we'll happily take a look.

BigLep commented 2 years ago

@MichaelMure : are you going to take this, or should we close this for now?

MichaelMure commented 2 years ago

@BigLep I'm sure there is value in there but I ended up not using any of this in my project as things took a different turn. I suppose we can close.