Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
run: cargo build --workspace --verbose
- name: Run tests
run: cargo test --workspace --verbose
- name: Run aw-sync v2 tests (sync-v2 feature)
run: cargo test -p aw-sync --features sync-v2 v2 --verbose
- uses: actions/upload-artifact@v7
with:
# TODO: These binaries are debug builds
Expand Down
62 changes: 61 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions aw-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ clap = { version = "4.1", features = ["derive"], optional = true }
ctrlc = { version = "3.4.5", optional = true }
rusqlite = { version = "0.30", features = ["bundled"], optional = true }

# sync-v2 dependencies (optional)
zstd = { version = "0.13", optional = true }
sha2 = { version = "0.10", optional = true }

aw-server = { path = "../aw-server" }
aw-models = { path = "../aw-models" }
aw-datastore = { path = "../aw-datastore" }
Expand All @@ -40,9 +44,13 @@ openssl = { version = "0.10.80", features = ["vendored"] } # https://github.com
jni = { version = "0.21", default-features = false }
android_logger = "0.13"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.59", features = ["Win32_Storage_FileSystem", "Win32_Foundation"] }

[dev-dependencies]
tempfile = "3"

[features]
default = ["cli"]
cli = ["clap", "ctrlc", "dep:rusqlite"]
sync-v2 = ["dep:zstd", "dep:sha2"]
Comment thread
TimeToBuildBob marked this conversation as resolved.
10 changes: 10 additions & 0 deletions aw-sync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ Working paths (bare `aw-sync sync`, Android) write:

The default daemon still writes `~/ActivityWatchSync/{device_id}/test.db` (two levels). `aw-sync sync` and the Android app cannot see that file.

#### Experimental v2 folder format (`sync-v2` feature)

Building with `--features sync-v2` compiles a writer for the immutable-segment format (`devices/{device_id}/manifest.json` plus `{slug}.{generation}.jsonl.zst` segments). It is not wired into any command yet.

The writer stages every file as `*.tmp` next to its final name and renames it into place, so a file syncer can ship a half-written temp file. Readers ignore unknown names, but tell your syncer to skip them too. For Syncthing, add this to the sync folder's `.stignore`:

```txt
(?d)*.tmp
```

### Running from source

If you want to run it from source, in the root of the repository run:
Expand Down
3 changes: 3 additions & 0 deletions aw-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ mod status;
pub use status::run_status;
mod util;

#[cfg(feature = "sync-v2")]
pub mod v2;

#[cfg(target_os = "android")]
pub mod android;
Loading
Loading