njaard / sonnerie

A simple timeseries database
Other
264 stars 19 forks source link

Allow compaction from lib #38

Open rubend056 opened 4 months ago

rubend056 commented 4 months ago

Is there any way the compaction interface can be reformatted so its exported from lib.

This is extremely useful as it allows compaction to be done at regular intervals from a downstream crate executable, instead of having to manually run the sonnerie command line tool.

I will try to give it a go on a pull request, but I remember looking at it before and it not being trivial.

njaard commented 4 months ago

Hi @rubend056 , in fact the only code you really need is to read and write the database again, https://github.com/njaard/sonnerie/blob/master/src/main.rs#L490 and then the _purge_compacted_files

It's not part of the API because I just didn't know what it would look like.

rubend056 commented 3 months ago

Sorry for the delayed response, I'll make a commit to my fork and a pull request today :) let me know of any issues you can spot.