Add in-memory type index for query_by_type_prefix#735
Open
iamnbutler wants to merge 1 commit intomainfrom
Open
Add in-memory type index for query_by_type_prefix#735iamnbutler wants to merge 1 commit intomainfrom
iamnbutler wants to merge 1 commit intomainfrom
Conversation
query_by_type_prefix previously scanned every event file for every task on each call — O(n*m) where n=tasks and m=events per task. This adds a lazily-initialized in-memory secondary index (HashMap<event_type, Vec<Event>>) that is built once from disk on first query and kept in sync on every append(). Compaction and orphan cleanup invalidate the index so it gets rebuilt on next query. Closes #507 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
HashMap<event_type, Vec<Event>>) toEventStorethat eliminates the O(n*m) full-scan inquery_by_type_prefix()append()call — subsequent queries only iterate over matching type keysCloses #507
Test plan
cargo test --package events)cargo check)🤖 Generated with Claude Code