3 ms·
You can use a btrfs subvolume for the build location, and take snapshots at all rollback points. This is fast. Basically, you create an r/w snapshot at first th
by namibj 7y ago
You can use a btrfs subvolume for the build location, and take snapshots at all rollback points. This is fast. Basically, you create an r/w snapshot at first that will evolve the current batch's "common" overlay.
Proceed by making another r/w snapshot for the/each subprocess.
Just work inside that folder (which behaves ~like a CoW bind-mount) and copy the artifacts into the "common" snapshot.
btrfs sub del -c path/to/temp/build/snapshot
will clean it up and ensure it won't reappear after a crash. You can skip the -c if you don't care about it reappearing.
If you have enough space to handle up to maybe a couple minutes delay in garbage collecting, you don't need to force any special syncing or such, as it just happens in the background.
As for the phases, I don't think this is a problem. btrfs snapshots are like git branches that don't allow merging, leaving explicit copy as the only recourse.