Buvt, How it works
![buvtGraph.png]()
"Own files" are the files that originate in the tree itself (and not from upstream locations).
Ex: In tree C, the purple area represents the "own" files.
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 (see image). 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. (again see the image.)
When syncing to (updating) the db, only the locations "own" files are considered, the db-entries (files) 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.