-
Notifications
You must be signed in to change notification settings - Fork 0
Added headers for CRR Cascaded #24
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
base: development/1.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,8 @@ namespace cloudserver.backbeatRoutes | |
| @http(method: "PUT", uri: "/_/backbeat/metadata/{Bucket}/{Key+}") | ||
| operation PutMetadata { | ||
| input: PutMetadataInput, | ||
| output: PutMetadataOutput | ||
| output: PutMetadataOutput, | ||
| errors: [StaleMicroVersionIdException] | ||
| } | ||
|
|
||
| structure PutMetadataInput { | ||
|
|
@@ -33,12 +34,31 @@ structure PutMetadataInput { | |
|
|
||
| @httpHeader("X-Scal-Request-Uids") | ||
| RequestUids: String, | ||
|
|
||
|
|
||
| @httpHeader("x-scal-micro-version-id") | ||
| MicroVersionId: String, | ||
|
|
||
| @httpPayload | ||
| Body: Blob | ||
| } | ||
|
|
||
| structure PutMetadataOutput { | ||
| /// Version ID of the stored metadata | ||
| versionId: String | ||
| versionId: String, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align all fields to camelCase or PascalCase
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, versionId is an existing field, i think it was already lowered case even before we started using cloudserverclient. |
||
|
|
||
| @httpHeader("x-scal-replication-loop") | ||
| replicationLoop: Boolean | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when do we have 200 and "replicationLoop" ? |
||
| } | ||
|
|
||
| /// Returned by PutMetadata when the incoming microVersionId is older than | ||
| /// the destination's current value (stale cascade event). The write is not | ||
| /// applied; the caller should mark the replication as FAILED (non-retryable). | ||
| @error("client") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add a test for this changes the generated client contract, but nothing checks that MicroVersionId / versionId are serialized as headers, nor that the new 409 errors are deserialized with their headers
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When testing cloudserver client, there is some kind of circular dependency where I can test the client either here, in cloudserver or in backbeat. I have functional tests in both backbeat and cloudserver that triggers these errors |
||
| @httpError(409) | ||
| structure StaleMicroVersionIdException { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same doc-comment suggestion as /// Returned by PutMetadata when the incoming microVersionId is older than
/// the destination's current value (stale cascade event). The write is not
/// applied; the caller should mark the replication as FAILED (non-retryable).
@error("client")
@httpError(409)
structure StaleMicroVersionIdException { ... } |
||
| @required | ||
| message: String, | ||
|
|
||
| @httpHeader("x-scal-micro-version-id") | ||
| microVersionId: String | ||
| } | ||
|
maeldonn marked this conversation as resolved.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First I added some tests in this codebase, but they were too functional and not really oriented toward just testing the client itself. + we already have test testing the client itself for putData/putMetadata So I added the tests in Cloudserver : They are functional tests using CloudserverClient with the micro version id, testing 409 error, actual api behavior etc. I think they are better in cloudserver than in here |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,8 @@ use aws.auth#unsignedPayload | |
| @unsignedPayload | ||
| operation PutData { | ||
| input: PutDataInput, | ||
| output: PutDataOutput | ||
| output: PutDataOutput, | ||
| errors: [VersionIdCollisionException] | ||
| } | ||
|
|
||
| structure PutDataInput { | ||
|
|
@@ -31,6 +32,9 @@ structure PutDataInput { | |
| @httpHeader("X-Scal-Request-Uids") | ||
| RequestUids: String, | ||
|
|
||
| @httpHeader("x-scal-version-id") | ||
| VersionId: String, | ||
|
|
||
| @httpPayload | ||
| @default("") | ||
| Body: StreamingBlob | ||
|
|
@@ -45,7 +49,20 @@ structure PutDataOutput { | |
|
|
||
| @httpHeader("x-amz-server-side-encryption-customer-algorithm") | ||
| SSECustomerAlgorithm: String, | ||
|
|
||
| @httpHeader("x-amz-server-side-encryption-aws-kms-key-id") | ||
| SSEKMSKeyId: String | ||
| } | ||
|
|
||
| /// Returned by PutData when the destination already has an object at this | ||
| /// versionId. The existing microVersionId is included in the response header | ||
| /// so the caller can run the cascade loop/stale/proceed classification. | ||
| @error("client") | ||
| @httpError(409) | ||
| structure VersionIdCollisionException { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Backbeat will pattern-match on this ( /// Returned by PutData when the destination already has an object at this
/// versionId. The existing microVersionId is included in the response header
/// so the caller can run the cascade loop/stale/proceed classification.
@error("client")
@httpError(409)
structure VersionIdCollisionException { ... } |
||
| @required | ||
| message: String, | ||
|
|
||
| @httpHeader("x-scal-micro-version-id") | ||
| microVersionId: String | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@scality/cloudserverclient", | ||
| "version": "1.0.8", | ||
| "version": "1.0.9", | ||
| "engines": { | ||
| "node": ">=20" | ||
| }, | ||
|
|
||
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.
nit: to make the semantic explicit, field could be name something like
IfMicroVersionIdOlderThan(i.e. semantics is part of the API)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.
Leaving for now, what do other ppl think about the naming ?
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.
@scality/raving-robots WDYT?
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.
x-scal-micro-version-idis simpler and easier to understand.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.
🤝ok.
We however should document the semantics of this field here: i.e. it will conflict (and not write metadata) if micro version id is older than the one already stored