Skip to content

batches: Add caching for file mounts

Administrator requested to merge rc/mount-caching into main

Created by: Piszmog

Part of #37216 (closed).

A MountsMetadata is added to the object that is hashed to create the cache key. The metadata is made up of the path, size, and modification date of the files that are being mounted.

A followup PR will be opened with src-cli to point to latest sourcegraph/sourcegraph when this is merged.

A note on the unit tests, I completely redid the existing unit tests for the cache to cover more cases and be more easily extensible. I wanted to cover all the implementations of Keyer for this change.

Test plan

Go Tests and manual testing (see examples).

Examples

No File Mount

The use case before file mounts. Ensures that caching still works as expected.

Screen Shot 2022-06-16 at 15 23 49

File Mount

A single file is mounted. In this use case, check to see if the second run uses the cache. Then if the file being mounted changes, does src-cli run with again without using the cache.

Screen Shot 2022-06-16 at 15 25 44

The file is "updated", and src-cli does not reuse the cache. Screen Shot 2022-06-16 at 15 26 26

Directory Mount

A director is mounted. In this use case, check to see if the second run uses the cache. Then if a file in the directory being mounted changes, does src-cli run with again without using the cache.

Screen Shot 2022-06-16 at 15 27 35

A file in the directory is "updated", and src-cli does not reuse the cache. Screen Shot 2022-06-16 at 15 47 49

Merge request reports

Loading