|Title:||Archive sync facility|
|Last Modified:||2016-09-25 18:48:29|
|Version Found In:|
I propose to keep mirrors of my personal archive in various places, in multiple Ugarit vaults.
Therefore, these mirrors of my archive will diverge!
So it would be useful to have a tool where I can do:
ugarit archive-sync src-ugarit.conf dest-ugarit.conf
It'll look for all objects in src but not in dest, or in both but with different metadata, and copy them (or just the metadata) from src to dest.
ugarit archive-sync --merge src-ugarit.conf dest-ugarit.conf
...which will copy objects in src but not in dest to dest, and vice versa, and objects in both but with different metadata will bring up an editor with the metadata for merging, and apply it to both.
alaric added on 2015-06-16 13:00:09:
Here's a plan for how to implement this.
To start with, we need a function that takes two vaults and "synchronises" a given hash from source to destination, by ensuring that it is fully present in the destination. This is easily done; if the hash exists in the destination, we are done. Otherwise, read the object from the source, dispatch on its type to extract all referenced hashes from it, and recursively synchronise them from source to dest; then copy the object from source to dest.
This can be exposed via the API and CLI as a "tag mirror" function, that does the following, given two vaults and a tag name on each:
This is useful for, say, mirroring a given snapshot tag to an offsite vault, or distributing central updates to an archive tag out to a number of local vaults.
But given that functionality, we can now write an "archive inter-vault merge" function, as an API and a CLI command. Given source/destination vaults and tag names, we can:
The CLI can provide the following options for the conflict resolution callback:
This will give us a way to synchronise changes to an archive into another archive, which can later be extended to offer a bi-directional synchronisation.
It also gives us, as a side-effect, a way to mirror a tag of either kind from one vault to another; a lower-level operation, but one that can be used on archives and snapshots, and which ensures hash consistency.
alaric added on 2016-09-25 18:48:29:
Also, we should support having a filter on the source archive (using the existing search interface) - only matching archive entries get synced across!