[cas] Refactor Digest() (#363)

* [cas] Refactor Digest()

UploadResult.Digest(PathSpec) semantics turned out to be complicated.
Remove it, rename PathSpec back to UploadInput and add
UploadInput.Digest(relPath string). The latter is easy to use, e.g.
the digest for UploadInput.Path is just UploadInput.Digest(".").

Since UploadInputs are sent to the client over the channel, the caller
might want to produce them in different goroutines, where each goroutine
might want to read the computed digest back. Since those goroutines
don't necessarily know when Upload() call returns, add
UploadInput.DigestComputed() function that returns a channel which is
closed when the digest for the UploadInput is computed.
This means Upload() call can be long-lived and multiple goroutines can
upload files independently.

Add more tests.
2 files changed
tree: f47c59027beb8430502b115ccb662a76247ebcaf
  1. .bazelci/
  2. .githooks/
  3. .github/
  4. external/
  5. go/
  6. .gitignore
  7. .golangci.yml
  8. AUTHORS
  9. BUILD.bazel
  10. check-gofmt.sh
  11. CONTRIBUTING.md
  12. CONTRIBUTORS
  13. go.mod
  14. go.sum
  15. LICENSE
  16. README.md
  17. remote-apis-sdks-deps.bzl
  18. setup-githooks.sh
  19. WORKSPACE
README.md

Remote Execution API SDKs

CI status: Build Status

PkgGoDev

This repository contains SDKs for the Remote Execution API.

See each language subdirectory's README.md for more specific instructions on using the SDK for that language.