fix(nodes): display real storage usage instead of always zero#31
Closed
Nic-dorman wants to merge 1 commit intomainfrom
Closed
fix(nodes): display real storage usage instead of always zero#31Nic-dorman wants to merge 1 commit intomainfrom
Nic-dorman wants to merge 1 commit intomainfrom
Conversation
The per-node Storage field always showed 0 B because we pointed at
`${dataDir}/chunks.mdb` — LMDB's default subdir layout makes that a
directory, not a file. `std::fs::metadata(dir).len()` returns a trivial
value on Windows and macOS, which the old code then clamped to zero
after subtracting a 16 KB "empty LMDB" baseline.
Point at the actual payload file `chunks.mdb/data.mdb`, and route
through a new `get_disk_usage` Tauri command that reports on-disk bytes
allocated (not the logical file length). On Unix that's
`stat.st_blocks * 512` so a sparse LMDB map reports real
chunks-stored rather than the configured map size. On Windows the
command falls back to `metadata.len()` since NTFS doesn't mark LMDB
`data.mdb` as sparse in our current ant-node config.
Belt-and-suspenders until the upstream daemon exposes storage usage
(see project_todo_daemon_storage_api.md).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
Contributor
Author
|
Superseded by #34 — same storage-display fix bundled with the companion storage-dir pass-through fix. Closing as duplicate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0 Bbecause we pointed at${dataDir}/chunks.mdb— LMDB's default subdir layout makes that a directory, not a file.std::fs::metadata(dir).len()returns a trivial value on Windows and macOS, which then got clamped to zero after the old code's 16 KB "empty LMDB" subtraction.chunks.mdb/data.mdb(the actual payload file) and route through a newget_disk_usageTauri command that returns filesystem-allocated bytes, not logical size.Why a new command vs reusing
get_file_sizeLMDB's
data.mdbcan be a sparse file — the logical size equals the configuredmap_size(tens of MB to many GB), but only a fraction is actually allocated on disk.metadata.len()would over-report. The new command uses:stat.st_blocks * 512— matchesdu -B1, correct for APFS / ext4 / btrfs / ZFS.metadata.len(). NTFS doesn't mark LMDBdata.mdbas sparse in our current ant-node config, so logical == on-disk in practice. If that changes we'll needGetCompressedFileSizeWviawindows-sys— which is exactly when the upstream daemon-exposed storage API (tracked as a separate follow-up) should replace this bridge entirely.Verified empirically
On a Mac with a node that had been running:
chunks.mdb/data.mdbreports 29.5 MB, matches what the user expected stored. The old path reported directory metadata → clamped to 0.Test plan
🤖 Generated with Claude Code