Buvt, How it works
![buvtGraph.png]()
Example graph
Syncing a "Location" (tree) to its db (database).
Part of how the software works is that the hashcodes of the files have to be calculated. The hashcodes then have two purposes:
- They are used as keys when syncing between trees.
- They can be used to verify the integrity of the files at a later time.
Since calculating hashcodes takes time, syncing is done "differentially", that is only files that have changed get their hashcode recalculated.
Every "Location" (tree) has the db in its top folder. It contains each files filename, hashcode, modification time and size.
The db contains data about its "own" files as well as any subtrees from upstream Locations.
Ex: in the figure, in tree
c, the files in the purple area are the Locations "own" files while the blue and pink parts are from upstream Locations.
When syncing to (updating) the db, only the Locations "own" files are considered, the files (db-entries) that have their origin in upstream Locations are left untouched.
Those files which had their hashcode recalculated, have their SM (size and modification time) "uniquified" with respect to the hashcode. That is the timestamp may be changed for certain files.
So then the SM can be used as a unique key to a certain hashcode (within the "own" files).
It is the fact that SM can be used as a key to a certain hashcode that allows the updating of the db to be done differentially.
Note! SM uniquely identifies a hashcode, but not to an individual file, so for example file-copies (same hashcode) can have the same modification time, without having the time changed.
Syncing from source- to target-tree
When the source and target dbs are up to date, one can sync from source to target by matching hashcodes.
Target subfolders
One can sync the source to a separate folder on the target (as in ex: c, d and e) which is necessary if you have multiple sources coming to a target.
One can also sync the source tree to the top of the target (as in ex: f). In this case the Location has no "own" files.
It is the "flTargetDataDir" setting (see image) of the relation that sets the subfolder. If left empty the target data dir will be to top folder.