Now that we separated the legacy response from non-legacy responses,
we can consume the data produced by the backend as-is; the backend
takes care of omitting "verbose" data (leaving the `Items` slices
empty), and with an early return for the legacy responses, we won't
end up with returning _both_ responses on API < v1.52, but (TBD) still
return both responses for API v1.52.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use early return for legacy response. When using API < v1.52, we'd
never return the new fields, so we can return early, and produce the
legacy-fields only.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Set values directly on the DiskUsage objects instead of using some
intermediate vars, some of which were named slightly confusing due
to them being used both for "totalSize" and "reclaimableSize".
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Move calculation of the data to the builder backend, to align with
the other type of objects. This also allows us to skip the verbose
data if it's not used.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Make the "per-object" types aliases for the API type, and remove
the BuildCacheDiskUsage type, as it's not currently used.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Rewrite the logic to have a better separation between producing legacy
fields, and verbose. We need to preserve / include all items in the
response _either_ if a API >= v1.52 client requested "verbose" _or_
if we're about to produce legacy fields.
Also switch to using the `httputils.BoolValue` utility; while we lose
the error for invalid values (which we probably should have as a utility
in `httputils`), it aligns with values accepted for other boolean values.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Un-export or remove utilities that have no (external) users;
- AuxFormatter (not used)
- FormatError (only used internally)
- FormatStatus (only used internally)
- NewJSONProgressOutput (used by CLI)
- NewProgressOutput (used by compose, cli for classic builder)
- NewStderrWriter (not used)
- NewStdoutWriter (not used)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Make sure Cobra is configured with the streams we use, and use
Cobra's utilities to print the validation messsage.
While updating, also add a short comment outlining why we're using
STDERR, not STDOUT for this message.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The README was useful when it was pointing to docker.go and when
docker.go contained the arg parsing and env setting code, but the
structure was simplified by @dmcgowan in 33139da522
It seems pointless to update it to say:
> main.go contains Docker daemon's main function.
and this part is out of date
> This file provides first line CLI argument parsing and environment variable setting.
It seems redundant with the new simpler structure, so delete it.
Signed-off-by: David Scott <dave@recoil.org>