gallery/harnesses/gtauri/Cargo.toml
Greg Pomerantz 58b203e4fa gtauri: event-driven watching + defense against stale VFS dir listings
Live watching is now event-driven, no tree polling:
- Android: MainActivity registers a MediaStore ContentObserver
  (Images, notifyForDescendants) and wakes the Rust watcher thread via
  a JNI call (Java_wow_gmp_gallery_MainActivity_nativeFsChange) — a
  single channel send, no main-thread work. Covers camera saves,
  media-scanner indexing, other apps' indexed writes.
- Desktop: inotify/FSEvents via notify on the scan roots.
- On wake: coalesce + debounce, diff dir mtimes, rescan only the
  changed subtrees. The 1 s recv timeout doubles as a cheap backstop
  (raw out-of-band copies the scanner hasn't indexed yet); a 5-minute
  full pass is the safety net. minSdk 30 (3-arg ContentObserver API).

Stale-listing truncation bug found and fixed (reproduced on the
emulator's 9p /sdcard; the phone's FUSE does the same): a readdir over
a large directory can return a SILENT early EOF — a stale cached
listing with NO error. The phone's 9961-file Camera dir truncated at
~8400 once and db::apply deleted ~1700 good rows. Three layers now:
1. scan::read_dir_full — retry whole-dir reads on mid-stream errors;
2. per-directory cross-check in walk_dir: if the enumeration is far
   below the DB's count for that dir, re-read up to 3x keeping the
   best listing; whole-walk re-check in rescan keeps the larger of two
   walks;
3. db::apply mass-delete guard: never delete >20% of the DB in one
   apply unless a previous walk already saw the low count (two-strike;
   a meta.walked row tracks it). Genuine gradual deletions still flow
   through (verified: a 4000-file mass move streams the grid down
   progressively), and a second consecutive low walk still deletes.

Emulator reliability suite (all pass): 3x launch count stability,
add +1 / remove -1 in ~2 s, 20-file burst, DB recovery from damage,
stale-listing refusal (0 rows lost), two-strike delete, live restore,
idle 0.0% dropped frames, deep fling loads thumbnails. A/B vs ttimg
(no-backend CSS-scroll control): adb-swipe drop deltas are at the
input-injection artifact level, idle identical (0.0%).
2026-11-01 20:24:01 -05:00

33 lines
953 B
TOML

[package]
name = "gtauri"
version = "0.1.0"
description = "gallery on Tauri"
authors = ["gmp"]
edition = "2021"
[lib]
name = "gtauri_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = [] }
tauri-runtime-wry = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
log = { version = "0.4", features = ["std"] }
http = "1"
# gallery engine (shared with the egui build):
rusqlite = { version = "0.41", features = ["bundled"] }
turbojpeg = { version = "1.5.1", features = ["cmake"] }
kamadak-exif = "0.6"
sha1 = "0.11"
image = { version = "0.25", default-features = false, features = ["png", "webp", "gif"] }
# Desktop file watching (inotify on Linux, FSEvents on macOS).
# Android uses the MediaStore ContentObserver instead — see MainActivity.kt.
[target.'cfg(not(target_os = "android"))'.dependencies]
notify = "8"