Skip to content

Conversation

@cjreynol
Copy link
Collaborator

This keeps all of the directory creation for cvd fetch together, and
exposes the dependency of the Downloaders class.

Also, relax the condition for CanCache to allow errors in
CanHardLink to simply disable caching, instead of terminating
execution. This allows cases where the cache directory has not been
created like in downloaders_test.cpp.

@cjreynol cjreynol self-assigned this Jan 16, 2026
The `getuid()` call was leftover from when the substitution pattern had
two holes for `/tmp/cvd/` and `<uid>` before `/cache`.

reference: google@f4f0f10
This keeps all of the directory creation for `cvd fetch` together, and
exposes the dependency of the `Downloaders` class.

Also, relax the condition for `CanCache` to allow errors in
`CanHardLink` to simply disable caching, instead of terminating
execution.  This allows cases where the cache directory has not been
created, like in `downloaders_test.cpp`.

However, I left the cache disabling flag in those unit tests.  They are
`cas_downloader` specific and have no need to validate initialization
logic for caching.
@cjreynol cjreynol force-pushed the caching_directory_creation_refactor branch from 0d00ce3 to 730bf76 Compare January 22, 2026 02:54
@cjreynol cjreynol added kokoro:force-run Trigger a presubmit build unconditionally. kokoro:run Run e2e tests. labels Jan 22, 2026
@cjreynol cjreynol marked this pull request as ready for review January 22, 2026 02:54
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed kokoro:run Run e2e tests. kokoro:force-run Trigger a presubmit build unconditionally. labels Jan 22, 2026
@cjreynol cjreynol requested a review from jemoreira January 22, 2026 02:55
}
return result;
if (!result.ok()) {
VLOG(1) << "Error during hard link check: " << result.error();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be LOG(ERROR)? VLOG(1) is the equivalent of LOG(VERBOSE).


} // namespace

Result<bool> CanCache(const std::string& target_directory,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CanCache no longer returns an error under any circumstances. Change the signature to return bool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants