hirak99 / yabsnap

Btrfs Scheduled Snapshot Manager for Arch
Apache License 2.0
65 stars 2 forks source link

Port or additional implementation of bcachefs #31

Closed ShalokShalom closed 6 months ago

ShalokShalom commented 6 months ago

I do think about the possibility, that I could adopt this repo, to make it work for bcachefs. Do you want a PR, or do you prefer me forking this project? I do not know yet, how compatible the two implementations will be, as I have yet not looked how the bcachefs tooling API even looks like. But I could imagine, doing it both ways.

What do you prefer?

hirak99 commented 6 months ago

I think it makes sense to add support into yabsnap.

My rationale is that this binary handles a bunch of management tasks, and that's probably bulk of it. The calls to btrfs are very few. This makes it desirable to support multiple snapshotting mechanisms, so that we do not replicate the management for each of them.

In the configuration, we would then need to add something to determine the snapshot type. (For backward compatibility it can default to btrfs for now.)

I was planning to add support for alternative snapshot mechanisms, including rsync. I did not know about BCacheFS, it could be an ideal place to start.

I think we can abstract out the btrfs part of it, and then have multiple implementations. Most of them are very simple calls - with the exception of rollback generation. I can take a stab at identifying and separating the btrfs calls into a module so it's easier to create other implementations (created issue #32).


Having said that, if at any point it seems easier/faster to fork do feel free. But for now If you send me pull requests, I will be happy to review and incorporate them.

ShalokShalom commented 6 months ago

I am very happy to contribute any changes, and follow the development of the abstraction closely. 😀

hirak99 commented 6 months ago

Thank you, I am happy to work with you as well!

I have abstracted out the btrfs implementation now. I am still testing it privately in AUR yabsnap-git, once I confirm there is no obvious issues I will make a release to AUR yabsnap.

It should have no visible impact, but it should now be easier to add new implementations.

Please feel free to take a look at abstract_mechanism.py.

I have never used BCacheFS, but I am hoping the important aspects (e.g. create and delete) should be implementable with it. If you have suggestions on what the commands should be, or want to create an implementation (e.g. the bcachefs_mechanism.py), I can integrate it.