All tests run on an 8-year-old MacBook Air.
Sync tools need to remember what they've already transferred. Files change. Transfers get interrupted. The app restarts.
The naive approach — scan everything on every run — gets slow fast. The right approach: track state in SQLite.
The schema
One table. One row per file.
CREATE TABLE IF NOT EXISTS sync_state ( path TEXT PRIMARY KEY , size INTEGER NOT NULL , modified_at INTEGER NOT NULL , -- Unix timestamp hash TEXT , -- SHA-256, computed lazily synced_at INTEGER , -- when we last synced this file status TEXT NOT NULL DEFAULT 'pending' CHECK ( status IN ( 'pending' , 'synced' , 'failed' , 'skipped' )) );
CREATE INDEX idx_status ON sync_state ( status ); CREATE INDEX idx_modified ON sync_state ( modified_at );
Enter fullscreen mode
Exit fullscreen mode
Connecting from Rust
Using rusqlite :
[dependencies] rusqlite = { version = "0.31" , features = [ "bundled" ] }
Enter fullscreen mode
Exit fullscreen mode
bundled compiles SQLite into your binary — no…