Skip to content

Commit

Permalink
Support digest functions in remote_asset API (#286)
Browse files Browse the repository at this point in the history
* Support digest functions in remote_asset API

* Add digest_function to response and directory rpc

* change digest_function in responses to bool

* Revert "change digest_function in responses to bool"

This reverts commit a749638.

---------

Co-authored-by: Tyler Williams <[email protected]>
  • Loading branch information
sluongng and tylerwilliams authored Apr 9, 2024
1 parent 7f51b36 commit 1f36c31
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions build/bazel/remote/asset/v1/remote_asset.proto
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ message FetchBlobRequest {
//
// Specified qualifier names *MUST* be unique.
repeated Qualifier qualifiers = 5;

// The digest function the server must use to compute the digest.
//
// If unset, the server SHOULD default to SHA256.
build.bazel.remote.execution.v2.DigestFunction.Value digest_function = 6;
}

// A response message for
Expand Down Expand Up @@ -234,6 +239,15 @@ message FetchBlobResponse {
// The result of the fetch, if the status had code `OK`.
// The digest of the file's contents, available for download through the CAS.
build.bazel.remote.execution.v2.Digest blob_digest = 5;

// This field SHOULD be set to the digest function that was used by the server
// to compute [FetchBlobResponse.blob_digest].
// Clients could use this to determine whether the server honors
// [FetchBlobRequest.digest_function] that was set in the request.
//
// If unset, clients SHOULD default to use SHA256 regardless of the requested
// [FetchBlobRequest.digest_function].
build.bazel.remote.execution.v2.DigestFunction.Value digest_function = 6;
}

// A request message for
Expand Down Expand Up @@ -282,6 +296,11 @@ message FetchDirectoryRequest {
//
// Specified qualifier names *MUST* be unique.
repeated Qualifier qualifiers = 5;

// The digest function the server must use to compute the digest.
//
// If unset, the server SHOULD default to SHA256.
build.bazel.remote.execution.v2.DigestFunction.Value digest_function = 6;
}

// A response message for
Expand Down Expand Up @@ -316,6 +335,15 @@ message FetchDirectoryResponse {
// the root digest of a directory tree, suitable for fetching via
// [ContentAddressableStorage.GetTree].
build.bazel.remote.execution.v2.Digest root_directory_digest = 5;

// This field SHOULD be set to the digest function that was used by the server
// to compute [FetchBlobResponse.root_directory_digest].
// Clients could use this to determine whether the server honors
// [FetchDirectoryRequest.digest_function] that was set in the request.
//
// If unset, clients SHOULD default to use SHA256 regardless of the requested
// [FetchDirectoryRequest.digest_function].
build.bazel.remote.execution.v2.DigestFunction.Value digest_function = 6;
}

// The Push service is complementary to the Fetch, and allows for
Expand Down Expand Up @@ -402,6 +430,15 @@ message PushBlobRequest {
// indirectly referencing unavailable blobs.
repeated build.bazel.remote.execution.v2.Digest references_blobs = 6;
repeated build.bazel.remote.execution.v2.Digest references_directories = 7;

// The digest function that was used to compute the blob digest.
//
// If the digest function used is one of MD5, MURMUR3, SHA1, SHA256,
// SHA384, SHA512, or VSO, the client MAY leave this field unset. In
// that case the server SHOULD infer the digest function using the
// length of the action digest hash and the digest functions announced
// in the server's capabilities.
build.bazel.remote.execution.v2.DigestFunction.Value digest_function = 8;
}

// A response message for
Expand Down Expand Up @@ -442,6 +479,15 @@ message PushDirectoryRequest {
// indirectly referencing unavailable blobs.
repeated build.bazel.remote.execution.v2.Digest references_blobs = 6;
repeated build.bazel.remote.execution.v2.Digest references_directories = 7;

// The digest function that was used to compute blob digests.
//
// If the digest function used is one of MD5, MURMUR3, SHA1, SHA256,
// SHA384, SHA512, or VSO, the client MAY leave this field unset. In
// that case the server SHOULD infer the digest function using the
// length of the action digest hash and the digest functions announced
// in the server's capabilities.
build.bazel.remote.execution.v2.DigestFunction.Value digest_function = 8;
}

// A response message for
Expand Down

0 comments on commit 1f36c31

Please sign in to comment.