Conversation
Implemented missing functionality for `SqliteItem` and `SqliteStorage`, specifically: - `RemoveFile` and `RemoveFileByName` for atomic item deletion and ancestor stat updates in the database. - `EncodeJSON` for exporting analysis data in ncdu-compatible format. - `RemoveItemAndUpdateStats` and `GetChildByName` helpers in `SqliteStorage` for efficient database operations using recursive CTEs and transactions. - Memory-state propagation in `RemoveFile` to keep loaded ancestors synchronized. - Updated `pkg/analyze/sqlite_test.go` with tests for the new functionality. Co-authored-by: dundee <27106+dundee@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #536 +/- ##
==========================================
+ Coverage 84.36% 85.90% +1.53%
==========================================
Files 52 52
Lines 5566 5774 +208
==========================================
+ Hits 4696 4960 +264
+ Misses 722 640 -82
- Partials 148 174 +26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a3e11c5 to
8412e3d
Compare
Summary
Implements the previously stubbed-out
RemoveFile,RemoveFileByName, andEncodeJSONmethods for the SQLite storage backend, along with performanceimprovements to the deletion path and query indexing.
Changes
Deletion (
RemoveFile,RemoveFileByName)same transaction, using a single in-memory walk — no redundant recursive CTE
for ancestor updates
DB/memory inconsistency on rollback
GetParentLocked()avoids deadlock by traversing cached parents withoutacquiring
storage.m.RLockwhilestorage.m.Lockis heldGetChildByNameenablesRemoveFileByNameto look up children by nameJSON encoding (
EncodeJSON)encodeDirJSONrecursively encodes directories and their childrenencodeFileJSONencodes files including hard-link and non-regular flagsDir/FileEncodeJSONmethodsQuery optimizations
(parent_id, name)forGetChildByNamelookupsDeleteItempublic method (its logic is covered by theinternal
deleteItemTree)