-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feature/zenko 18/metadata proxy server #498
Feature/zenko 18/metadata proxy server #498
Conversation
Hello ploki,My role is to assist you with the merge of this Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
PR has been updated. Reviewers, please be cautious. |
There were the following issues with this Pull Request
You may need to change the commit messages to comply with the repository contributing guidelines. 🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding! |
8f68d62
to
670f1c6
Compare
PR has been updated. Reviewers, please be cautious. |
Do it again human slave!:point_right: :runner: (Oh and the pull request has been updated, by the way.)
PR has been updated. Reviewers, please be cautious. |
a3cf6d4
to
b7cf797
Compare
PR has been updated. Reviewers, please be cautious. |
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.
I like your usage of RequestDispatcher
in the tests.
|
||
_putObject(req, res, bucketName, objectName, objectValue, params, logger) { | ||
return this._metadataWrapper.client.putObject( | ||
bucketName, objectName, JSON.parse(objectValue), |
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.
JSON.parse
will call cause a server crash if the JSON is malformed. I recommend a try...catch
for safe parsing.
* the purpose of this server. The `value' fields are stringified twice and | ||
* have to be deserialized here before being sent to the client. | ||
*/ | ||
_destringifyValues(data) { |
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.
Is this method being used anywhere or is it a placeholder for future use?
*/ | ||
_destringifyValues(data) { | ||
const newContents = data.Contents.map(entry => { | ||
const value = JSON.parse(entry.value); |
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.
I recommend safe json parsing as above.
* | ||
* @param {http.IncomingMessage} req - request being processed | ||
* @param {http.OutgoingMessage} res - response associated to the request | ||
* @param {object} uriComponents - |
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.
You can list here the properties expected to be used in the object.
lib/storage/metadata/proxy/utils.js
Outdated
* @param {string} uri - uri part of the received request | ||
* @param {werelogs.Logger} logger - | ||
* @return {object} ret - contains up to 4 string properties, | ||
* @return {string} ret.namespace |
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.
Can you add a one-liner describing what namespace and context are?
const bucketIndex = pathname.indexOf('/', typeIndex + 1); | ||
const objectIndex = pathname.indexOf('/', bucketIndex + 1); | ||
|
||
if (typeIndex === -1 || typeIndex === pathname.length - 1) { |
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.
Suggestion: If you abstract pathname.length - 1
into a var, it will be more readable.
lib/storage/metadata/proxy/utils.js
Outdated
}; | ||
} catch (ex) { | ||
logger.error('Invalid URI: failed to parse', | ||
{ uri, error: ex, errorStack: ex.stack }); |
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.
ex.message
is worth logging too.
request.on('data', data => { | ||
body.push(data); | ||
bodyLen += data.length; | ||
}).on('error', cb).on('end', () => { |
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.
http.IncomingMessage
emits close
if the client abruptly disconnects. We need to add a listener and destroy the stream/cleanup when the close
event is emitted. This was the source of our TCP socket leak issue in January.
}), | ||
next => dispatcher.delete(`/default/bucket/${Bucket}/test1`, | ||
err => next(err)), | ||
], err => done(err)); |
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.
Minor style comment: In instances like this err => done(err)
you can pass the callback directly done
.
Do it again human slave!:point_right: :runner: (Oh and the pull request has been updated, by the way.)
PR has been updated. Reviewers, please be cautious. |
8799960
to
e4e3d04
Compare
PR has been updated. Reviewers, please be cautious. |
e4e3d04
to
2e02fe1
Compare
PR has been updated. Reviewers, please be cautious. |
2e02fe1
to
de77400
Compare
PR has been updated. Reviewers, please be cautious. |
de77400
to
32c2a6f
Compare
Do it again human slave!:point_right: :runner: (Oh and the pull request has been updated, by the way.)
PR has been updated. Reviewers, please be cautious. |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a |
I have successfully merged the changeset of this pull request
Please check the status of the associated issue ZENKO-18. Goodbye ploki. |
replaces #462