[caching] save/load source hierarchy and extracted log statements #20
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.
Scanning the source hierarchy and extracting log statements is pretty costly, so we need to cache what we found between runs. This change writes a separate file for every source root. The file contains a header that is a JSON-line with interesting metadata that a user might find helpful. The body of the file is a bincode serialization of the SourceTree object. The CLI will try to load from the cache on startup, check for any changes in the source tree, and then update the cache, if necessary.
I was originally looking at using SQLite for the cache, but it's hard to write blobs of unknown size to a table. This approach seems to work since the header can easily be read separately from the main content to determine if the file is valid or not. I also tried using the postcard
serializer, but had trouble getting it to work. The bincode one seems to just work.
Files:
Deserializeon various structs.pattern_strto cache the string version of the pattern.