[#487] Support Range header in object PUT #487

Open
mbiryukova wants to merge 2 commits from mbiryukova/frostfs-s3-gw:feature/put_range into master
Member

Signed-off-by: Marina Biryukova m.biryukova@yadro.com

Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
mbiryukova self-assigned this 2024-09-10 14:18:15 +00:00
mbiryukova added 1 commit 2024-09-10 14:18:15 +00:00
[#xxx] Support Range header in object PUT
Some checks failed
/ DCO (pull_request) Failing after 1m58s
/ Builds (pull_request) Successful in 2m14s
/ Vulncheck (pull_request) Successful in 2m38s
/ Lint (pull_request) Successful in 4m39s
/ Tests (pull_request) Successful in 6m5s
3f1c423844
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
mbiryukova force-pushed feature/put_range from 3f1c423844 to 5467f44e08 2024-09-10 14:18:38 +00:00 Compare
mbiryukova changed title from [#xxx] Support Range header in object PUT to [#487] Support Range header in object PUT 2024-09-10 14:18:55 +00:00
mbiryukova requested review from storage-services-committers 2024-09-10 14:43:10 +00:00
mbiryukova requested review from storage-services-developers 2024-09-10 14:43:11 +00:00
Owner

It would be nice to check this PR compatibility with Dell ECS. Therefore I put v0.32.0 milestone for this feature.

It would be nice to check this PR compatibility with Dell ECS. Therefore I put v0.32.0 milestone for this feature.
alexvanin added this to the v0.32.0 milestone 2024-09-11 12:38:01 +00:00
nzinkevich reviewed 2024-09-13 14:14:51 +00:00
@ -313,0 +459,4 @@
return nil, overwrite, fmt.Errorf("invalid range: %s", rangeStr)
}
}
Member

I think it would be better to write if statement instead of switch, e.g.:

if start == -1 && len(endStr) == 0 {
   return &layer.RangeParams{
	  Start: objSize,
	  End:   objSize + contentLen - 1,
   }, overwrite, nil
} else if start < -1 {
   return nil, overwrite, fmt.Errorf("invalid range: %s", rangeStr)
}

I think it would be better to write `if` statement instead of `switch`, e.g.: ```go if start == -1 && len(endStr) == 0 { return &layer.RangeParams{ Start: objSize, End: objSize + contentLen - 1, }, overwrite, nil } else if start < -1 { return nil, overwrite, fmt.Errorf("invalid range: %s", rangeStr) } ```
mbiryukova force-pushed feature/put_range from 5467f44e08 to d6c031ca23 2024-09-16 11:59:14 +00:00 Compare
dkirillov reviewed 2024-09-26 06:46:09 +00:00
@ -313,0 +400,4 @@
return
}
extendedObjInfo, err := h.obj.PatchObject(ctx, params)
Member

I would try to introduce new method h.patchObject that contains common logic for h.putObjectWithRange and h.PatchObjectHandler

I would try to introduce new method `h.patchObject` that contains common logic for `h.putObjectWithRange` and `h.PatchObjectHandler`
@ -313,0 +448,4 @@
if start == -1 && len(endStr) == 0 {
return &layer.RangeParams{
Start: objSize,
End: objSize + contentLen - 1,
Member

Why do we use contentLen to find out end of range to patch?

Why do we use contentLen to find out end of range to patch?
@ -21,6 +21,7 @@ type PatchObjectParams struct {
Range *RangeParams
VersioningEnabled bool
CopiesNumbers []uint32
Overwrite bool
Member

Why do we need this field? It seems we can just provide correct Range field.

Why do we need this field? It seems we can just provide correct `Range` field.
alexvanin removed this from the v0.32.0 milestone 2024-12-11 07:40:46 +00:00
All checks were successful
/ DCO (pull_request) Successful in 53s
Required
Details
/ Vulncheck (pull_request) Successful in 1m11s
Required
Details
/ Builds (pull_request) Successful in 1m11s
Required
Details
/ Lint (pull_request) Successful in 2m26s
Required
Details
/ Tests (pull_request) Successful in 1m26s
Required
Details
This pull request has changes conflicting with the target branch.
  • api/handler/acl_test.go
  • api/handler/put_test.go
  • api/layer/patch.go
  • go.mod
  • go.sum
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/put_range:mbiryukova-feature/put_range
git checkout mbiryukova-feature/put_range
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-services-committers
TrueCloudLab/storage-services-developers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#487
No description provided.