sled icon indicating copy to clipboard operation
sled copied to clipboard

Removing a large range of entries from a `Tree` at once.

Open mitchmindtree opened this issue 7 years ago • 0 comments

I'm using a sled Tree under the hood as a simple DB in a personal project. I'd like to be able to remove the oldest entries as the disk usage limit is exceeded.

Currently I'm attempting to do this by monitoring the file size of the generated db file. If the size exceeds the threshold, I remove the oldest entries by using iter().take(chunk) and call tree.del(key) for each. Intuitively it seems a little inefficient to remove a single entry at a time, though I could be wrong! Would it be more efficient to provide an API that allowed for removing a whole range at once (perhaps along the lines of .drain(start..end)) for accomplishing this?

Thanks again for sled btw, it's been really nice to use so far :+1:

mitchmindtree avatar Sep 18 '18 10:09 mitchmindtree