P4-5: Pinning, eviction policy and free-space management #48
Labels
No labels
data-integrity
engine
platform
procurement
remote
scaffold
ui
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Cordy/cairn-desktop#48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Depends on P4-4. Platform-independent — testable on the Pi runner.
Goal
Decide what stays local and what gets evicted, so the folder honours a disk budget without ever
losing data or evicting something the user is about to need.
Files
internal/vfs/evict.go,internal/vfs/evict_test.gointernal/config/config.go(disk budget setting)The rules
Eviction is never data loss — and this is the property that makes the whole feature safe.
Dehydrating discards a local copy of content that exists on the server. So:
sync_stateis anything other thansynced, it stays. Evicting a pending upload destroys the only copy of the user's work.
PinAlways.size — immediately before dehydrating. If the check fails for any reason, keep the file. The
cost of being wrong is asymmetric: keeping a file wastes disk, evicting one wrongly loses work.
Eviction order for
PinAutofiles, once the budget is exceeded: least-recently-used, oldestfirst. Track access time on hydration and on read.
Configuration
maxLocalBytes— soft disk budget for hydrated content. Default: unset (evict only onexplicit request).
evictAfterDays— optionally dehydrate untouched files after N days. Default: off.Defaults are conservative on purpose. Silently deleting local copies from under a user is
alarming even when technically safe. Make the aggressive behaviour opt-in.
"Free up space"
A user-triggered action: dehydrate everything eligible, now. Report how much was reclaimed. This
is the operation people actually reach for, and it should feel instant and safe.
Steps
PinAlwaysis neverevicted; an open file is never evicted; an ETag mismatch aborts eviction for that file;
LRU picks the right victims; the budget is respected.
extreme budget pressure, assert the file still exists with its content intact.
git commit -s -m "feat(vfs): pin-aware eviction and disk budget"Acceptance criteria
FakePlaceholderFS.