Conversation
|
|
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.
Why?
Implement ITG cache to store reverse dependencies of targets. Storing the ITG graph allows us to search for the commit closest to the base commit and incrementally recompute the target graph of the commit if it's ITG applicable.
The cache is stored in a separate folder by date so when we load the list of cached ITG graphs, it will only load all the entries for the day.
What?
core/storage — Added List(ctx, dir) to the Storage interface
storage.go — Added List(ctx context.Context, dir string) ([]string, error) to the Storage interface
memstorage.go — Filters keys by strings.HasPrefix(key, dir)
disk/disk.go — Walks rootDir/dir, returns paths relative to rootDir; non-existent directory returns empty without error
storagemock/storagemock.go — Added List mock method and recorder
changedtargetsandedgesreader_test.go — Updated errStorage and nilResponseStorage stubs to satisfy the new interface
Storage-backed cache for OptimizedGraph entries, keyed by (remote, commit_timestamp, sha) and stored under
itg/{remote}/{date}/{timestamp}_{sha}.
Put — gob-encodes the graph and writes to storage; skips if the key already exists
Get — downloads and gob-decodes the graph
FloorKey — lists all keys under the remote's prefix, parses timestamps, and binary-searches for the latest entry with commit_timestamp ≤ targetTimeSecond
Test Plan
unit tests
Issue