Skip to content

Add FetchDirectoryStream to save the extra GetTree call #355

@sluongng

Description

@sluongng

Currently in Remote Asset API, we have FetchDirectory with the following

  rpc FetchDirectory(FetchDirectoryRequest) returns (FetchDirectoryResponse) {
    option (google.api.http) = { post: "/v1/{instance_name=**}/assets:fetchDirectory" body: "*" };
  }

...

message FetchDirectoryResponse {
  google.rpc.Status status = 1;

  string uri = 2;

  repeated Qualifier qualifiers = 3;

  google.protobuf.Timestamp expires_at = 4;

  // The result of the fetch, if the status had code `OK`.
  // the root digest of a directory tree, suitable for fetching via
  // [ContentAddressableStorage.GetTree].
  build.bazel.remote.execution.v2.Digest root_directory_digest = 5;

  build.bazel.remote.execution.v2.DigestFunction.Value digest_function = 6;
}

Note how the client will have to call GetTree with the returned digest to get the whole tree, which is an additional round trip

  rpc GetTree(GetTreeRequest) returns (stream GetTreeResponse) {
    option (google.api.http) = { get: "/v2/{instance_name=**}/blobs/{root_digest.hash}/{root_digest.size_bytes}:getTree" };
  }

I wonder if we can simply return the GetTreeResponse, at least the first page, directly in FetchDirectoryResponse. That can simplify the call path for clients who are expecting a small and relatively shallow tree.

Otherwise, perhaps a FetchDirectoryStream variant that returns a stream of Directory messages of the whole tree would be nice to have as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions