feat: show the disks' free space #6

Merged
thibault merged 2 commits from feat/storage into 0.2 2026-10-08 18:44:42 +02:00
Owner

Roadmap phase 6, first half.

API

GET /api/storage (needs a session): for each disk of PLANKTON_DISKS, path, available, total_bytes (statvfs f_blocks × f_frsize), free_bytes, reserve_bytes (PLANKTON_MIN_FREE_GB), usable_bytes, pending_bytes (what the session's unfinished torrents on that disk will still write) and room_bytes (usable − pending), plus totals over the available disks. Read under add_lock.

The room computation is now one function, downloads::disk_rooms, shared by the disk choice of POST /api/downloads, the room check of PATCH and this route. DiskStatus gains total_bytes and reserve_bytes (so /health shows them too). A disk with more pending than usable now has a room of 0 instead of being skipped: same outcome for any real download.

Web

  • Navbar: disk <room> free (sum of the room over the disks, mono 11px), each disk in the tooltip, a warning when a disk is missing. Polled every 30 s, and refreshed after a download is added or removed and when metadata loads.
  • Magnet action bar: the mockup's DISK bar for the disk the selection would go to (the one with the most room, as the server picks), named in the tooltip. Used (everything a new download cannot use: files, reserve, pending) + selection (accent, or error when it does not fit), animated width, used · + selection · X free after / X short below. Start is disabled with "Not enough space: deselect X or free some disk." when it does not fit. The "filed into" path moved under the library select.

Checks

cargo fmt, clippy -D warnings, 129 tests (3 new for the route: two disks with a reserve, a missing disk, pending bytes after adding a torrent); svelte-check and vite build. Screenshots taken against the real backend on two scratch disks.

Docs: README API row and Storage section, ROADMAP, bruno/storage.yml.

🤖 Generated with Claude Code

Roadmap phase 6, first half. ## API `GET /api/storage` (needs a session): for each disk of `PLANKTON_DISKS`, `path`, `available`, `total_bytes` (statvfs f_blocks × f_frsize), `free_bytes`, `reserve_bytes` (`PLANKTON_MIN_FREE_GB`), `usable_bytes`, `pending_bytes` (what the session's unfinished torrents on that disk will still write) and `room_bytes` (usable − pending), plus `totals` over the available disks. Read under `add_lock`. The room computation is now one function, `downloads::disk_rooms`, shared by the disk choice of `POST /api/downloads`, the room check of `PATCH` and this route. `DiskStatus` gains `total_bytes` and `reserve_bytes` (so `/health` shows them too). A disk with more pending than usable now has a room of 0 instead of being skipped: same outcome for any real download. ## Web - Navbar: `disk <room> free` (sum of the room over the disks, mono 11px), each disk in the tooltip, a warning when a disk is missing. Polled every 30 s, and refreshed after a download is added or removed and when metadata loads. - Magnet action bar: the mockup's DISK bar for the disk the selection would go to (the one with the most room, as the server picks), named in the tooltip. Used (everything a new download cannot use: files, reserve, pending) + selection (accent, or error when it does not fit), animated width, `used · + selection · X free after / X short` below. Start is disabled with "Not enough space: deselect X or free some disk." when it does not fit. The "filed into" path moved under the library select. ## Checks cargo fmt, clippy `-D warnings`, 129 tests (3 new for the route: two disks with a reserve, a missing disk, pending bytes after adding a torrent); svelte-check and vite build. Screenshots taken against the real backend on two scratch disks. Docs: README API row and Storage section, ROADMAP, `bruno/storage.yml`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
GET /api/storage gives, for each disk, its size, free space, reserve,
what the unfinished downloads will still write there and the room left
for a new one, plus totals over the available disks. The room comes
from the same function the disk choice of POST /api/downloads uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01947SGTYxD1CJLsk2PcULRA
feat(web): show the free space and the disk bar
All checks were successful
CI / web (pull_request) Successful in 8s
CI / test (pull_request) Successful in 25s
42a19f560f
The navbar shows the room left over all disks, with each disk in its
tooltip, refreshed every 30 s and after a download is added or removed.
The Magnet screen's action bar shows the disk the selection would go to,
and blocks the start when it does not fit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01947SGTYxD1CJLsk2PcULRA
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
thibault/plankton!6
No description provided.