Class FileSystemActionReconciliator


  • public class FileSystemActionReconciliator
    extends java.lang.Object
    Implements the file synchronization algorithm in the down operation. The algorithm compares the local file on the disk with the last local database file version and the last winning file version and determines what file system action (fsa) to apply. Input variables: - winning version - winning file (= local file of winning version) - local version - local file (= local file of local version) Algorithm: if (has no local version) { compwinfwinv = compare winning file to winning version (incl. checksum!) if (compwinfwinv: winning file matches winning version) { // do nothing } else if (compwinfwinv: new) { add new fsa for winning version add multichunks to download list for winning version } else if (compwinfwinv: deleted) { add delete fsa for winning version } else if (compwinfwinv: changed link) { add changed link fsa for winning version } else if (compwinfwinv: changes attrs / modified date) { // does not(!) include "path" add changed attrs fsa for winning version } else if (compwinfwinv: changed path) { // Cannot be! } else { // size/checksum (path cannot be!) add conflict fsa for winning file add new fsa for winning version add multichunks to download list for winning version } } else { // local version exists complocflocv = compare local file to local version (incl. checksum!) if (complocflocv: local file matches local version) { // file as expected on disk complocvwinv = compare local version to winning version if (complocvwinv: local version matches winning version) { // means: local file = local version = winning version // Nothing to do } else if (complocvwinv: new) { // Cannot be! } else if (complocvwinv: deleted) { add delete fsa for winning version } else if (complocvwinv: changed link) { add changed link fsa for winning version } else if (complocvwinv: changes attrs / modified date / path) { // includes "path!" add changed attrs / renamed fsa for winning version } else { // size/checksum add changed fsa for winning version (and delete local version) add multichunks to download list for winning version } } else { // local file does NOT match local version if (local file exists) { add conflict fsa for local version } add new fsa for winning version add multichunks to download list for winning version }