Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cvd cache #834

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

cvd cache #834

wants to merge 3 commits into from

Conversation

cjreynol
Copy link
Collaborator

@cjreynol cjreynol commented Dec 21, 2024

To be squashed and split into a few PRs:

  • GetDiskUsage fix and new unsigned flag parser overload
  • new ScopedTeeLogger and its application to fetch_cvd.cc
  • new cvd cache command

@cjreynol cjreynol self-assigned this Dec 21, 2024
@cjreynol cjreynol force-pushed the cvd_cache branch 6 times, most recently from a3611b0 to c40ba5b Compare December 21, 2024 01:04
`ParseInt` was failing on the output of `du` because it is in a format
like: "<total num> <filepath>".  This version splits that and takes the first portion.  We should update
this later to not rely on `du`, b/385384942 should encompass that.

Returning to the `atoi` implementation was not a good idea for the bytes
version, because it was still susceptible to overflow issues.

Changed the return value to be a `size_t` instead of a
signed number, because the sizes will not (should not?) ever be
negative.

Added a `GflagsCompatFlag` overload for reading in flags that can be
compared to the output of this helper.

The `GetDiskUsageGigabytes` will still be used in the upcomign `cvd
cache`, while the `*Bytes` version will be used when we sync these
changes back to AOSP.

Test: use the `cvd_cache` branch and run `cvd cache size`
The manual managing leaves more opportunity for a mistake or error to
cause the previous logger to never be reset.

Also, for tee logging we always wanted to set the Android LogSeverity to
`VERBOSE` because the levels are managed internal to those loggers.
This is automatically handled as well, which is why the
`ScopedLogSeverity` is a member instead of being instantiated alongside
the logger.

The new `LogToStderr` (and `ScopedTeeLogger`) will be used in the
upcoming `cvd cache`, because it will eventually be called from `cvd
fetch` invocations.

Test: TBD, I think a `cvd load` call will have successive logger setups?
New command used to manage the local fetch cache.  Will eventually be
automatically invoked during every `cvd fetch` call to keep the cache
from growing without end.

Bug: 384803921
Test: cvd help # see summary help
Test: cvd help cache
Test: cvd cache
Test: cvd cache where
Test: cvd cache size
Test: cvd cache empty
Test: cvd cache cleanup
Test: cvd cache cleanup --allowed_size_GB=<`cvd cache size` - 1>
Test: cvd cache cleanup --allowed_size_GB=-1
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.

1 participant