-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark nodes removed; only remove orphaned nodes (#195)
* Mark nodes removed instead of deleting them Problem: - When POET loads a page, references to resources on the page are stored in the page node (see _resourceLinks) - When a resource was removed from the bundle, perhaps via a filesystem event, the references in the page remained, even though the resources no longer existed in the bundle. - When a resource with the same absPath was created, it was added to the bundle again. This new resource instance, however, was distinct from the one that existed within the page even though they pointed to the same content on the filesystem. - Until the page was updated, which causes the links to be reconstructed, resource links stored in the page did not correlate with the ones stored in the bundle. Consequently, the `exists` property of the resource node was not being updated Solution: - Keep all nodes in the bundle - When a file referenced by a node is deleted from the filesystem, update the node's contents to `undefined` so that the node's `exists` property will be set to false Possible problems & justifications: - This technically introduces a memory leak where nodes continue to accumulate in the bundle forever; however, there are many ways this memory leak could be addressed if it becomes a real problem. - Out of all the approaches I explored, this one made the best use of Quarx, required the least number of changes, and exhibited the best performance. * Remove deleted nodes that are orphaned This fixes the aforementioned memory leak for everything except bundles When a file is deleted and its associated node is orphaned, as defined in model manager, then that node will be removed If the node is not orphaned, it will stay in memory even though the file no longer exists * Fix some comments; add some polish * Send diagnostics before removing nodes * Use readAndUpdate instead of readAndLoad A file creation event could map to an existing node that is loaded * Nodes only need to be loaded to be orphaned Fixes a problem with cascading deletions
- Loading branch information
1 parent
f5de166
commit 82f16e2
Showing
9 changed files
with
125 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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