Delete for real, and free shared assets on delete at any scale #6

Open
opened 2026-09-25 12:51:01 +02:00 by kyuubi · 0 comments
Owner

Two problems with deleting:

  • .trash was never asked for. Deleting moved files into a hidden .trash/ that nothing empties; 4.3 GB piled up in one day. Since 0.4.1, deleted shared items were even rebuilt into full packages there.
  • Freeing shared assets doesn't scale. Each clean-up pass re-reads every .rlsitem under the storage folder, which gets slow with thousands of items.

Plan

  • Deleting an item, folder or link deletes it for good, like the cloud inventory. No .trash any more.
  • In-memory asset index: which item needs which assets, with users counted per asset. It is built once at startup. After that, only items whose size or write time changed are re-read. Items added, changed or deleted outside the game are picked up too.
  • On delete (item or folder) and on saving over a shared world: refresh the index, then delete the store files of every asset that lost its last user.
  • At startup, a full sweep deletes store files that nothing needs, including leftovers of interrupted writes.
  • An unreadable item stops a pass before anything is deleted. Assets freed in the meantime are handled by the next good pass.
  • Tests, including thousands of items; README; version 0.4.2; deploy (85c213d)
  • In game: delete a shared item and a folder with shared items; .assets/ shrinks right away, nothing goes to .trash/
  • Existing .trash/ (4.3 GB of today's deletes): waiting for the user's decision

Evidence

  • 57 tests: 56 pass; the opt-in real-data round trip skips by default.
  • Index scale test: 5,002 items. The first refresh takes 124 ms and a refresh after one delete takes 13 ms (NVMe, warm cache).
  • 0.4.2 hot-loaded into the running game with no errors. The startup pass deleted nothing, which is correct: the store holds only the 27 files the live SM_Barrel.rlsitem needs.

Reopened: the Closes #6 in 85c213d came before the in-game check.

Two problems with deleting: - **`.trash` was never asked for.** Deleting moved files into a hidden `.trash/` that nothing empties; 4.3 GB piled up in one day. Since 0.4.1, deleted shared items were even rebuilt into full packages there. - **Freeing shared assets doesn't scale.** Each clean-up pass re-reads every `.rlsitem` under the storage folder, which gets slow with thousands of items. ## Plan - [x] Deleting an item, folder or link deletes it for good, like the cloud inventory. No `.trash` any more. - [x] In-memory asset index: which item needs which assets, with users counted per asset. It is built once at startup. After that, only items whose size or write time changed are re-read. Items added, changed or deleted outside the game are picked up too. - [x] On delete (item or folder) and on saving over a shared world: refresh the index, then delete the store files of every asset that lost its last user. - [x] At startup, a full sweep deletes store files that nothing needs, including leftovers of interrupted writes. - [x] An unreadable item stops a pass before anything is deleted. Assets freed in the meantime are handled by the next good pass. - [x] Tests, including thousands of items; README; version 0.4.2; deploy (85c213d) - [ ] In game: delete a shared item and a folder with shared items; `.assets/` shrinks right away, nothing goes to `.trash/` - [ ] Existing `.trash/` (4.3 GB of today's deletes): waiting for the user's decision ## Evidence - 57 tests: 56 pass; the opt-in real-data round trip skips by default. - Index scale test: 5,002 items. The first refresh takes 124 ms and a refresh after one delete takes 13 ms (NVMe, warm cache). - 0.4.2 hot-loaded into the running game with no errors. The startup pass deleted nothing, which is correct: the store holds only the 27 files the live `SM_Barrel.rlsitem` needs. Reopened: the `Closes #6` in 85c213d came before the in-game check.
Sign in to join this conversation.
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
kyuubi/ResoLocalStorage#6
No description provided.