Commit Graph

48 Commits

Author SHA1 Message Date
Quentin b4592a00fe Implement ListMultipartUploads (#171)
continuous-integration/drone/push Build is passing Details
Implement ListMultipartUploads, also refactor ListObjects and ListObjectsV2.

It took me some times as I wanted to propose the following things:
  - Using an iterator instead of the loop+goto pattern. I find it easier to read and it should enable some optimizations. For example, when consuming keys of a common prefix, we do many [redundant checks](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/branch/main/src/api/s3_list.rs#L125-L156) while the only thing to do is to [check if the following key is still part of the common prefix](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/branch/feature/s3-multipart-compat/src/api/s3_list.rs#L476).
  - Try to name things (see ExtractionResult and RangeBegin enums) and to separate concerns (see ListQuery and Accumulator)
  - An IO closure to make unit tests possibles.
  - Unit tests, to track regressions and document how to interact with the code
  - Integration tests with `s3api`. In the future, I would like to move them in Rust with the aws rust SDK.

Merging of the logic of ListMultipartUploads and ListObjects was not a goal but a consequence of the previous modifications.

Some points that we might want to discuss:
  - ListObjectsV1, when using pagination and delimiters, has a weird behavior (it lists multiple times the same prefix) with `aws s3api` due to the fact that it can not use our optimization to skip the whole prefix. It is independant from my refactor and can be tested with the commented `s3api` tests in `test-smoke.sh`. It probably has the same weird behavior on the official AWS S3 implementation.
  - Considering ListMultipartUploads, I had to "abuse" upload id marker to support prefix skipping. I send an `upload-id-marker` with the hardcoded value `include` to emulate your "including" token.
  - Some ways to test ListMultipartUploads with existing software (my tests are limited to s3api for now).

Co-authored-by: Quentin Dufour <quentin@deuxfleurs.fr>
Reviewed-on: #171
Co-authored-by: Quentin <quentin@dufour.io>
Co-committed-by: Quentin <quentin@dufour.io>
2022-01-12 19:04:55 +01:00
Alex 168a90dfb5
Fix some error codes
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details
2022-01-05 17:07:36 +01:00
Alex 5b1117e582
New model for buckets 2022-01-04 12:45:46 +01:00
trinity-1686a c4ac8835d3 add proper request router for s3 api (#163)
continuous-integration/drone/push Build is passing Details
fix #161

Current request router was organically grown, and is getting messier and messier with each addition.
This router cover exaustively existing API endpoints (with exceptions listed in [#161(comment)](#161 (comment)) either because new and old api endpoint can't feasabily be differentied, or it's more lambda than s3).

Co-authored-by: Trinity Pointard <trinity.pointard@gmail.com>
Reviewed-on: #163
Reviewed-by: Alex <alex@adnab.me>
Co-authored-by: trinity-1686a <trinity.pointard@gmail.com>
Co-committed-by: trinity-1686a <trinity.pointard@gmail.com>
2021-12-06 15:17:47 +01:00
Alex ada7899b24
Fix clippy lints (fix #121)
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2021-10-26 10:20:05 +02:00
Alex 6ccffc3162
Improved XML serialization
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
- Use quick_xml and serde for all XML response returned by the S3 API.
- Include tests for all structs used to generate XML
- Remove old manual XML escaping function which was unsafe
2021-05-06 22:37:15 +02:00
Trinity Pointard e4b9e4e24d
rename types to CamelCase
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2021-05-03 22:15:09 +02:00
Trinity Pointard 84856e84e5
fix clippy warnings on api 2021-05-03 22:11:41 +02:00
Alex f4346cc5f4 Update dependencies
continuous-integration/drone/push Build is passing Details
2021-03-16 15:58:40 +01:00
Alex 3bf2df622a Time and metadata improvements
continuous-integration/drone/push Build is passing Details
2021-03-15 16:21:41 +01:00
Alex 097c339d98 Fix race condition
continuous-integration/drone/push Build is passing Details
2021-03-15 15:26:29 +01:00
Alex c475471e7a Implement table gc, currently for block_ref and version only
continuous-integration/drone/push Build is passing Details
2021-03-12 19:57:37 +01:00
Alex 7fdaf7aef0 Fix merkle updater not being notified; improved logging
continuous-integration/drone/push Build is passing Details
2021-03-12 14:37:46 +01:00
Alex 3214dd52dd Very minor changes
continuous-integration/drone/push Build is passing Details
2021-03-10 21:50:09 +01:00
Alex af7600f989 Correctly implement CompleteMultipartUpload with etag check of parts
continuous-integration/drone/push Build is passing Details
2021-03-10 17:01:05 +01:00
Alex 0fd7df8fa0 Switch to blake2 sum for identifying blocks by their data
continuous-integration/drone/push Build is passing Details
2021-03-10 16:33:31 +01:00
Alex f319a7d374 Refactor model stuff, including cleaner CRDTs 2021-03-10 16:21:56 +01:00
Alex 40763fd749 Cargo fmt 2021-02-23 18:46:25 +01:00
Alex b1b640ae8b rename hash() to sha256sum(), we might want to change it at some places
continuous-integration/drone/push Build is passing Details
2021-02-21 15:24:30 +01:00
Alex 10b983b8e7 Add verification of part numbers in CompleteMultipartUpload (WIP #30)
continuous-integration/drone/push Build is passing Details
2021-02-20 00:13:07 +01:00
Alex e64ecbdccd S3 compatibility: return 404 instead of 400 on some multipart commands
continuous-integration/drone/push Build is passing Details
2021-02-19 18:51:05 +01:00
Alex 02d512f3fd Fix #28, extra headers being ignored (because of profound stupidity)
continuous-integration/drone/push Build is passing Details
2021-02-19 12:38:22 +01:00
Alex 76390085ef Small improvements in the S3 put workflow
continuous-integration/drone/push Build was killed Details
2021-02-19 12:11:02 +01:00
Alex 4a5bbbb810 Propose ETag fix 2020-12-05 19:23:46 +01:00
Alex d54f15b2c6 Small optimisation 2020-11-29 17:07:14 +01:00
Alex fed97f37e1 ETag patch 2020-11-29 16:38:01 +01:00
Alex 601ae25ad2 Small refactorings 2020-11-29 16:21:28 +01:00
Quentin 17dc610f8a Also check hash for < 3KB files 2020-11-22 11:14:46 +01:00
Quentin 435d5f9205 Fix base64/hex checksum comparison 2020-11-22 11:04:33 +01:00
Alex f8a04852a2 Convert bucket table to better CRDT representation 2020-11-20 23:53:54 +01:00
Quentin 5a5592c176 Replace with option syntaxic sugar 2020-11-11 16:12:42 +01:00
Alex a50fa70d45 Refactor error management in API part 2020-11-08 15:05:28 +01:00
Alex 5faf069e33 trace test 2020-07-15 15:41:49 +02:00
Alex 27a0d0d859 pretty 2020-07-15 15:37:35 +02:00
Alex 1c70552f95 Validate content MD5 and SHA256 sums for PutObject and UploadPart 2020-07-15 15:31:13 +02:00
Alex 6c7f9704ea Implement correct ETag for objects created with PutObject 2020-07-13 16:51:30 +02:00
Alex 9305e5e87f More headers taken into account 2020-07-09 17:04:43 +02:00
Alex 44dba0e53c cargo fmt 2020-07-08 17:34:37 +02:00
Alex 64a6eda0d2 Migrate S3 api to use new model 2020-07-08 17:33:24 +02:00
Alex f22ecb60a8 Update to Hyper 0.13.6 that accepts non-Sync streams in wrap_stream.
Simplifies code and makes it possible to publish on crates.io
2020-07-07 17:15:53 +02:00
Alex bec26a1312 Rename garage_core to garage_model 2020-07-07 13:59:22 +02:00
Alex 3324971701 Slightly improved S3 compatibility
- ListBucket does not require any of the parameters (delimiter,
    prefix, max-keys, etc)
- URLs are properly percent_decoded
- PutObject and DeleteObject calls now answer correctly
    (empty body, version id in the x-amz-version-id: header)
2020-05-01 14:30:50 +00:00
Alex 0957d0fdfa Work on API 2020-04-28 10:18:14 +00:00
Alex 0877a5500c Abort multipart upload 2020-04-26 20:46:33 +00:00
Alex 81ecc4999e Implement multipart uploads 2020-04-26 20:39:32 +00:00
Alex 1999c0ae51 Update delete code 2020-04-26 19:11:19 +00:00
Alex 9cb870f950 Prepare for multipart uploads 2020-04-26 18:55:13 +00:00
Alex 91b2d1fcc1 Some basic S3 functionnality 2020-04-24 18:47:11 +00:00