> >> I was trying to streamline the whole process and I felt the need to > have the snapshot as a separate entity just like a reg_entry or a > reg_portgroup is, that is, "registry::snapshot" with a bunch of functions > like create, get, list_all etc. I think this might help in writing the > whole thing from a higher Tcl level. > >> But then again, a snapshot is not something coming directly from the > database, so I'm not sure how to keep it. Can I get your view on this? > > > > Well, you already know that my view is that it would be far simpler to > store the snapshots as a text-based format, rather than write and modify a > large amount of non-trivial C. > > > > But if you are set on doing this in the sqlite database, the relational > way of doing it would be to add: > > > > 1. A table of snapshots, consisting minimally of names and ids > > 2. A table associating snapshot ids with port ids on a many-to-many basis > > The snapshot tables would not be updated. I see no reason for a many to > many. Each port/variant in a snapshot would have a snapshot id. When a > snapshot is deleted delete it’s id everywhere. >
It is simply a one-to-many foreign key, that is, linking one snapshot to many port ids and further, one port to many variants. Speaking of deleting a snapshot, do we want to limit the number of snapshots a user can have? or something like keeping an expiry date for a snapshot. - Umesh