Strangely enough, I had actually thought of this before I made the post. Snapshots are a wonderful feature in zfs which allow you to take point in time images of a filesystem that are mutable and which themselves can be snapshotted.
Unfortunately, this leads an explosion of snapshots if we want to be able to arbitrarily remove any one application from the system.
Consider the following operation:
pkg(1) + pkg(2) + pkg(3)
Now remove pkg(2) without using anything other than snapshots.
snapshot before adding anything sn(0). snapshot after adding package 1 sn(1)(sn(0)). snapshot after adding package2 sn(2)(sn(0)) + sn(2)(sn(1)). snapshot after adding package3 sn(3)(sn(0)) + sn(3)(sn(2)) + sn(3)(sn(1)).
Repeat for arbitrary pkg(n).
Unless you’re planning on creating a whole travelling salesmanOk, it’s not quite the travelling salesman problem, but it gives you a good idea as to how much work is involved of snapshots, I think my mechanism is easier.