Commit graph

58 commits

Author SHA1 Message Date
Alex 5768bf3622 First implementation of K2V (#293)
All checks were successful
continuous-integration/drone/push Build is passing
**Specification:**

View spec at [this URL](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/branch/k2v/doc/drafts/k2v-spec.md)

- [x] Specify the structure of K2V triples
- [x] Specify the DVVS format used for causality detection
- [x] Specify the K2V index (just a counter of number of values per partition key)
- [x] Specify single-item endpoints: ReadItem, InsertItem, DeleteItem
- [x] Specify index endpoint: ReadIndex
- [x] Specify multi-item endpoints: InsertBatch, ReadBatch, DeleteBatch
- [x] Move to JSON objects instead of tuples
- [x] Specify endpoints for polling for updates on single values (PollItem)

**Implementation:**

- [x] Table for K2V items, causal contexts
- [x] Indexing mechanism and table for K2V index
- [x] Make API handlers a bit more generic
- [x] K2V API endpoint
- [x] K2V API router
- [x] ReadItem
- [x] InsertItem
- [x] DeleteItem
- [x] PollItem
- [x] ReadIndex
- [x] InsertBatch
- [x] ReadBatch
- [x] DeleteBatch

**Testing:**

- [x] Just a simple Python script that does some requests to check visually that things are going right (does not contain parsing of results or assertions on returned values)
- [x] Actual tests:
  - [x] Adapt testing framework
  - [x] Simple test with InsertItem + ReadItem
  - [x] Test with several Insert/Read/DeleteItem + ReadIndex
  - [x] Test all combinations of return formats for ReadItem
  - [x] Test with ReadBatch, InsertBatch, DeleteBatch
  - [x] Test with PollItem
  - [x] Test error codes
- [ ] Fix most broken stuff
  - [x] test PollItem broken randomly
  - [x] when invalid causality tokens are given, errors should be 4xx not 5xx

**Improvements:**

- [x] Descending range queries
  - [x] Specify
  - [x] Implement
  - [x] Add test
- [x] Batch updates to index counter
- [x] Put K2V behind `k2v` feature flag

Co-authored-by: Alex Auvolat <alex@adnab.me>
Reviewed-on: #293
Co-authored-by: Alex <alex@adnab.me>
Co-committed-by: Alex <alex@adnab.me>
2022-05-10 13:16:57 +02:00
Alex c1d9854d2c
Move block manager to separate module 2022-03-23 10:25:15 +01:00
Jill 98545a16dd garage_api: Handle streaming payload early in request handling 2022-03-23 10:22:36 +01:00
trinity-1686a f6f8b7f1ad Support for PostObject (#222)
All checks were successful
continuous-integration/drone/push Build is passing
Add support for [PostObject](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html)

- [x] routing PostObject properly
- [x] parsing multipart body
- [x] validating signature
- [x] validating policy
- [x] validating content length
- [x] actually saving data

Co-authored-by: trinity-1686a <trinity@deuxfleurs.fr>
Co-authored-by: Trinity Pointard <trinity.pointard@gmail.com>
Reviewed-on: #222
Reviewed-by: Alex <alex@adnab.me>
Co-authored-by: trinity-1686a <trinity.pointard@gmail.com>
Co-committed-by: trinity-1686a <trinity.pointard@gmail.com>
2022-02-21 23:02:30 +01:00
Alex c99f55c420
Add restriction on part ordering in CompleteMultipartUpload
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
continuous-integration/drone Build is passing
2022-01-25 12:45:00 +01:00
Alex 6dab836f3a
Multipart improvements
- support part_number for HeadObject
- add checks in complete_multipart_upload
2022-01-24 21:04:40 +01:00
Jill fdcddbe168 Fix Multipart Upload with WinSCP (#164) (#193)
All checks were successful
continuous-integration/drone/push Build is passing
Closes #164.

Reviewed-on: #193
Co-authored-by: Jill <kokakiwi@deuxfleurs.fr>
Co-committed-by: Jill <kokakiwi@deuxfleurs.fr>
2022-01-17 11:18:40 +01:00
Jill b45dcc1925 Support STREAMING-AWS4-HMAC-SHA256-PAYLOAD (#64) (#156)
All checks were successful
continuous-integration/drone/push Build is passing
Closes #64.

Reviewed-on: #156
Co-authored-by: Jill <kokakiwi@deuxfleurs.fr>
Co-committed-by: Jill <kokakiwi@deuxfleurs.fr>
2022-01-17 10:55:31 +01:00
Alex f7349f4005
Add quotes in returned etags
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2022-01-13 14:03:33 +01:00
Alex 6617a72220
Implement UploadPartCopy 2022-01-13 13:58:47 +01:00
Quentin b4592a00fe Implement ListMultipartUploads (#171)
All checks were successful
continuous-integration/drone/push Build is passing
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
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
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)
All checks were successful
continuous-integration/drone/push Build is passing
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)
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2021-10-26 10:20:05 +02:00
Alex 6ccffc3162
Improved XML serialization
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
- 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
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
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
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-16 15:58:40 +01:00
Alex 3bf2df622a Time and metadata improvements
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-15 16:21:41 +01:00
Alex 097c339d98 Fix race condition
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-15 15:26:29 +01:00
Alex c475471e7a Implement table gc, currently for block_ref and version only
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-12 19:57:37 +01:00
Alex 7fdaf7aef0 Fix merkle updater not being notified; improved logging
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-12 14:37:46 +01:00
Alex 3214dd52dd Very minor changes
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-10 21:50:09 +01:00
Alex af7600f989 Correctly implement CompleteMultipartUpload with etag check of parts
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-10 17:01:05 +01:00
Alex 0fd7df8fa0 Switch to blake2 sum for identifying blocks by their data
All checks were successful
continuous-integration/drone/push Build is passing
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
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-21 15:24:30 +01:00
Alex 10b983b8e7 Add verification of part numbers in CompleteMultipartUpload (WIP #30)
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-20 00:13:07 +01:00
Alex e64ecbdccd S3 compatibility: return 404 instead of 400 on some multipart commands
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-19 18:51:05 +01:00
Alex 02d512f3fd Fix #28, extra headers being ignored (because of profound stupidity)
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-19 12:38:22 +01:00
Alex 76390085ef Small improvements in the S3 put workflow
Some checks reported errors
continuous-integration/drone/push Build was killed
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