-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
objstore: add ObjectSize() implementation #1792
Conversation
Adds a new method ObjectSize(context.Context, string) method to our object storage interface which returns the size of the specified object in uint64 without actually downloading all of it. This is a pre-requisite to one check that we want to add. Add a check to our E2E tests to see if it works. Signed-off-by: Giedrius Statkevičius <[email protected]>
Signed-off-by: Giedrius Statkevičius <[email protected]>
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.
Happy with this 👍
LGTM!
@@ -42,6 +42,11 @@ func TestObjStore_AcceptanceTest_e2e(t *testing.T) { | |||
testutil.Ok(t, err) | |||
testutil.Equals(t, "@test-data@", string(content)) | |||
|
|||
// Check if we can get the correct size. |
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.
Can we check if ObjectSize for non existing block properly errors? Also if we can find assert NotFound on such operation if block is missing? The latter is not critical, but if we cannot assume so, we should document that as a method comment (:
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.
Added a test for this before the initial upload and cleaned up the functions so that IsObjNotFoundErr(error)
would be properly triggered in such cases.
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.
👍
The exact error is needed by the callers so that they could check `IsObjNotFoundErr` correctly. Add a test for this to the E2E tests. Signed-off-by: Giedrius Statkevičius <[email protected]>
Signed-off-by: Giedrius Statkevičius <[email protected]>
Merging this as I have addressed the comments and since it doesn't change the behaviour in any way ATM. Will rebase #1550 on these methods now. |
Thanks! |
Adds a new method ObjectSize(context.Context, string) method to our
object storage interface which returns the size of the specified object
in uint64 without actually downloading all of it.
This is a pre-requisite to one check that we want to add (#1550).
Add a check to our E2E tests to see if it works.
Signed-off-by: Giedrius Statkevičius [email protected]