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

Optimise out uploading the empty blob in a couple of places #184

Closed

Conversation

peterebden
Copy link
Contributor

Per bazelbuild/remote-apis#131 there is no longer any requirement to upload the empty blob since the server must provide it. This optimises it out in a couple of places to make callers' life a bit easier.

@ola-rozenfeld
Copy link
Contributor

Can you please rebase? Thank you!

@peterebden
Copy link
Contributor Author

Apologies for the delay - have rebased.

@@ -597,6 +601,9 @@ func (c *Client) ResourceNameWrite(hash string, sizeBytes int64) string {
// GetDirectoryTree returns the entire directory tree rooted at the given digest (which must target
// a Directory stored in the CAS).
func (c *Client) GetDirectoryTree(ctx context.Context, d *repb.Digest) (result []*repb.Directory, err error) {
if d.SizeBytes == 0 && d.Hash == digest.Empty.Hash {
return nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, is that correct? Shouldn't this return an empty Directory proto?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's returning a slice of directory protos, so nil is pretty equivalent to an empty slice here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I mean: shouldn't it return a slice containing one item, []*repb.Directory{&repb.Directory{}}, instead? An empty digest maps to an empty directory.

ola-rozenfeld pushed a commit to ola-rozenfeld/remote-apis-sdks that referenced this pull request Feb 18, 2021
ola-rozenfeld pushed a commit to ola-rozenfeld/remote-apis-sdks that referenced this pull request Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes The author signed a CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants