databricks-cli/libs/sync
shreyas-goenka 40ae23bb33
Refactor change computation for sync (#785)
## Changes
This PR pays some tech debt by refactoring sync diff computation into
interfaces that are more robust.

Specifically:
1. Refactor the single diff computation function into a `SnapshotState`
class that computes the target state only based on the current local
files making it more robust and not carrying over state from previous
iterations.
2. Adds new validations for the sync state which make sure that the
invariants that downstream code expects are actually held true. This
prevents a class of issues where these invariants break and the
synchroniser behaves unexpectedly.

Note, this does not change the existing schema for the snapshot, only
the way the diff is computed, and thus is backwards compatible (ie does
not require a schema version bump).

## Tests
<!-- How is this tested? -->
2023-10-03 13:47:46 +00:00
..
testdata/sync-fileset Refactor change computation for sync (#785) 2023-10-03 13:47:46 +00:00
diff.go Refactor change computation for sync (#785) 2023-10-03 13:47:46 +00:00
diff_test.go Refactor change computation for sync (#785) 2023-10-03 13:47:46 +00:00
dirset.go Add directory tracking to sync (#425) 2023-06-12 11:44:00 +00:00
dirset_test.go Add directory tracking to sync (#425) 2023-06-12 11:44:00 +00:00
event.go Drain sync event channel before returning (#253) 2023-03-16 17:48:17 +01:00
event_test.go Add optional JSON output for sync command (#230) 2023-03-08 10:27:19 +01:00
path.go Extend deployment mode support (#577) 2023-07-30 07:19:49 +00:00
path_test.go Remove base path checks during sync (#576) 2023-07-14 11:43:20 +02:00
snapshot.go Refactor change computation for sync (#785) 2023-10-03 13:47:46 +00:00
snapshot_state.go Refactor change computation for sync (#785) 2023-10-03 13:47:46 +00:00
snapshot_state_test.go Refactor change computation for sync (#785) 2023-10-03 13:47:46 +00:00
snapshot_test.go Refactor change computation for sync (#785) 2023-10-03 13:47:46 +00:00
sync.go Added support for sync.include and sync.exclude sections (#671) 2023-08-18 08:07:25 +00:00
sync_test.go Added support for sync.include and sync.exclude sections (#671) 2023-08-18 08:07:25 +00:00
watchdog.go Add directory tracking to sync (#425) 2023-06-12 11:44:00 +00:00