-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
Can you please rebase? Thank you! |
191e9de
to
a175914
Compare
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.