Skip to content

feat(drive): add bisync mode + tuned mount cache - #137

Merged
VictorGSchneider merged 1 commit into
mainfrom
claude/charming-turing-gQRxE
Jun 7, 2026
Merged

feat(drive): add bisync mode + tuned mount cache#137
VictorGSchneider merged 1 commit into
mainfrom
claude/charming-turing-gQRxE

Conversation

@VictorGSchneider

@VictorGSchneider VictorGSchneider commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Thunar and Obsidian were slow on cloud-mounted folders because every read goes over the network through the rclone FUSE mount. For folders you touch a lot (Obsidian vaults, notes, code), the right pattern is to keep them physically on the NVMe and bisync to the cloud on a timer. This PR adds that second mode side-by-side with the existing mount, and also tightens the mount cache for everything else.

Mount tuning (stoa-drive mount)

  • --dir-cache-time 5m → 24h (overridable: RCLONE_DIR_CACHE_TIME)
  • new --attr-timeout 1h (overridable: RCLONE_ATTR_TIMEOUT) — cached stat()s
  • --poll-interval 30s → 1m (overridable: RCLONE_POLL_INTERVAL)
  • new --vfs-fast-fingerprint
  • mounts now auto-exclude any path that's registered as a sync pair on the same remote, so the FUSE view and the local synced copy don't collide

Folder Sync (stoa-drive → Folder Sync, or CLI)

  • new submenu: Sync now / Add pair / Remove pair / Enable / Disable / Status
  • pairs stored in ~/.config/stoa/drive-sync.list (TSV: remote:path<TAB>local-path)
  • per-pair workdir + first-sync marker under ~/.cache/stoa/drive-sync/<id>/
  • --resync runs automatically the first time a pair is synced, then normal bidirectional sync after
  • conflict policy: STOA_SYNC_CONFLICT in stoa.conf (default newer)
  • auto-sync installs a user-level systemd timer (stoa-drive-sync.timer) at the interval set by STOA_SYNC_INTERVAL (default 5min)

New CLI commands

stoa-drive sync <remote:path> <local-path>
stoa-drive sync-all
stoa-drive sync-enable
stoa-drive sync-disable
stoa-drive sync-status

stoa.conf

New (commented) options:

#RCLONE_DIR_CACHE_TIME=24h
#RCLONE_ATTR_TIMEOUT=1h
#RCLONE_POLL_INTERVAL=1m
#STOA_SYNC_INTERVAL=5min
#STOA_SYNC_CONFLICT=newer

Test plan

  • bash -n scripts/stoa-drive.sh passes (verified locally)
  • stoa-drive mount <remote> still works; verify Thunar feels snappier after first open (cached dir listings)
  • stoa-drive → Folder Sync → Add pair → enter gdrive:Obsidian + ~/Obsidian → run first sync (should --resync once)
  • Edit a file locally → wait for timer (or stoa-drive sync-all) → file appears in Google Drive web UI
  • Edit a file in Google Drive web UI → wait for timer → change appears locally
  • With gdrive:Obsidian registered as a sync pair, mount gdrive and confirm ~/Drive/gdrive/Obsidian is excluded
  • stoa-drive sync-enablesystemctl --user list-timers shows stoa-drive-sync.timer
  • stoa-drive sync-disable → timer is gone

https://claude.ai/code/session_01GXhB3rozaZUTpYmpaum8GW


Generated by Claude Code

Cloud-mounted folders are slow because every Thunar/Obsidian access
hits the network through the rclone FUSE mount. For high-traffic
folders (Obsidian vaults, notes, code), the right pattern is a
periodic bisync to the cloud against a local copy on NVMe.

stoa-drive now ships both modes side by side:

- mount: bumped --dir-cache-time to 24h, --attr-timeout 1h,
  --poll-interval 1m, and added --vfs-fast-fingerprint. Mounts also
  auto-exclude any path registered as a sync pair so the mount view
  and the synced copy do not collide.
- sync: new "Folder Sync" submenu and CLI (sync / sync-all /
  sync-enable / sync-disable / sync-status). Pairs live in
  ~/.config/stoa/drive-sync.list (TSV: remote:path<TAB>local-path).
  Per-pair workdir + first-sync marker under
  ~/.cache/stoa/drive-sync/<id>/. Auto-sync installs a user-level
  systemd timer (interval and conflict policy in stoa.conf).
@VictorGSchneider VictorGSchneider self-assigned this Jun 7, 2026
@VictorGSchneider
VictorGSchneider merged commit 148ae5d into main Jun 7, 2026
1 check passed
@VictorGSchneider
VictorGSchneider deleted the claude/charming-turing-gQRxE branch June 7, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants