-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace keep-while cond reverse index with a prefix tree
When deleting tree nodes in the `khepri_tree` we lookup in the reverse index to find any conditions that are associated to paths which are prefixes of the deleted path. Prior to this commit we folded over the keep-while conditions reverse index - a map - and used `lists:prefix/2` to find prefixing paths. In a store with many nodes and tracking many keep-while conditions this can become very expensive while deleting many nodes at once. The parent commit introduced a prefix tree type which allows quick lookup, given a path, of any tree nodes associated with a path which is a prefix of the given path. We set a version 2 for khepri_machine which upgrades the reverse index use to this new type. Because the reverse index is private to the khepri_tree type I have avoided introducing versioning for the `khepri_tree` module. Instead the reverse index can either be a map - as in prior versions - or a prefix tree. We act on the reverse index using the appropriate functions for the type, which we detect at runtime.
- Loading branch information
1 parent
49237f5
commit 19e5afe
Showing
2 changed files
with
131 additions
and
10 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