Commit Graph

53 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 135858d067
Implement DeleteBucket 2022-01-05 16:28:19 +01:00
Alex 8395030e48
Implement CreateBucket
continuous-integration/drone/push Build is failing Details
2022-01-05 15:56:48 +01:00
Alex 1bcd6fabbd
New buckets for 0.6.0: small changes
- Fix bucket delete

- fix merge of bucket creation date

- Replace deletable with option in aliases
    Rationale: if two aliases point to conflicting bucket, resolving
    by making an arbitrary choice risks making data accessible when it
    shouldn't be. We'd rather resolve to deleting the alias until
    someone puts it back.
2022-01-04 12:52:47 +01:00
Alex b1cfd16913
New buckets for 0.6.0: small fixes, including:
- ensure bucket names are correct aws s3 names
- when making aliases, ensure timestamps of links in both ways are the
  same
- fix small remarks by trinity
- don't have a separate website_access field
2022-01-04 12:46:41 +01:00
Alex 0bbb6673e7
Model changes 2022-01-04 12:45:52 +01:00
Alex 5b1117e582
New model for buckets 2022-01-04 12:45:46 +01:00
trinity-1686a 60d4459926 BucketWebsite (#174)
continuous-integration/drone/push Build is passing Details
fix #77

this does not store anything but a on/off switch for website, and does not implement GetBucketWebsite as it would require storing more. GetBucketWebsite should be pretty easy to implement once data is stored though.

Co-authored-by: Trinity Pointard <trinity.pointard@gmail.com>
Reviewed-on: #174
Co-authored-by: trinity-1686a <trinity.pointard@gmail.com>
Co-committed-by: trinity-1686a <trinity.pointard@gmail.com>
2021-12-15 10:41:39 +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
trinity-1686a 7f26ed55cd Improved handling of HTTP ranges
continuous-integration/drone/push Build is failing Details
- correct HTTP code when range syntax is invalid (fix #140)
- when multiple ranges are given, simply ignore and send whole file

Co-authored-by: Trinity Pointard <trinity.pointard@gmail.com>
Reviewed-on: #157
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-11-29 11:52:42 +01:00
Trinity Pointard 53888995bd update doc and comments
continuous-integration/drone/push Build is passing Details
2021-11-16 15:41:41 +01:00
Trinity Pointard 396fe4c702 clippy 2021-11-16 15:41:41 +01:00
Trinity Pointard 02158ee666 fix issue where list on vhost-bucket would list bucket instead of bucket content 2021-11-16 15:41:41 +01:00
Trinity Pointard 9c58ec28d3 add support for vhost-style s3 bucket 2021-11-16 15:41:41 +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
Quentin 5fdabf3e75
Add basic support for the "Versioning" command
continuous-integration/drone/push Build is passing Details
2021-05-14 22:33:26 +02:00
Trinity Pointard 84856e84e5
fix clippy warnings on api 2021-05-03 22:11:41 +02:00
Quentin 631c36b3ff S3 API: support ListBuckets
continuous-integration/drone/push Build is passing Details
2021-05-03 21:55:30 +02:00
Alex dcfc32cf85
Many S3 compatibility improvements:
continuous-integration/drone/push Build is passing Details
- return XML errors
- implement AuthorizationHeaderMalformed error to redirect clients to
  correct location (used by minio client)
- implement GetBucketLocation
- fix DeleteObjects XML parsing and response
2021-04-28 01:05:40 +02:00
Trinity Pointard 1e3df189d0
document api crate 2021-04-27 16:37:10 +02:00
Trinity Pointard b4c903371c add support for caching headers
continuous-integration/drone/pr Build is failing Details
2021-03-18 15:46:33 +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 40763fd749 Cargo fmt 2021-02-23 18:46:25 +01:00
Alex 3bcbbe1e31 More precise logging (warn only when returning a 500)
continuous-integration/drone/push Build is passing Details
2021-02-20 00:30:39 +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 5d1fa591d9 Add compatibility list
continuous-integration/drone/push Build is passing Details
2021-02-19 19:10:23 +01:00
Alex 55a2a636ca Implement ListObjectsV2
continuous-integration/drone/push Build is passing Details
2021-02-19 16:44:06 +01:00
Alex 36814be447 Fix S3 ListObjects result and replace println!s by debug!s 2021-01-16 16:05:54 +01:00
Alex a50fa70d45 Refactor error management in API part 2020-11-08 15:05:28 +01:00
Alex 6a8b972f3a Modif parse_bucket_key to fail when bucket is "" 2020-11-08 13:39:44 +01:00
Quentin e1415f5976 Add a second test 2020-11-07 15:34:53 +01:00
Quentin 9a50ce12a8 Fix formatting 2020-11-07 13:59:30 +01:00
Quentin 8f4ada1965 Add a test for parse_bucket_key 2020-11-07 13:53:32 +01:00
Alex 1c70552f95 Validate content MD5 and SHA256 sums for PutObject and UploadPart 2020-07-15 15:31:13 +02:00
Alex 86fb7bbba5 Apply cargo fmt; add trace output when request signature is bad 2020-07-08 13:33:02 +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 b46a7788d1 Implement HTTP ranges in get 2020-05-04 13:09:23 +00:00
Alex d867bbcfb5 Implement DeleteObjects 2020-05-01 15:52:35 +00: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 3686f100b7 Compatibility fixes 2020-04-28 10:35:04 +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 9cb870f950 Prepare for multipart uploads 2020-04-26 18:55:13 +00:00
Alex ea7e4748ed S3 compatibility: fix bucket listing and HEAD and PUT on bucket 2020-04-26 16:22:33 +00:00
Alex e3203f998b Remove leading / in keys; better delimiter handling 2020-04-24 22:28:15 +02:00
Alex 91b2d1fcc1 Some basic S3 functionnality 2020-04-24 18:47:11 +00:00
Alex f2e05986c4 Starting to be S3 compatible 2020-04-24 17:46:52 +00:00