-
Notifications
You must be signed in to change notification settings - Fork 224
feat(mcm): add methods for multi cluster management #643
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
Conversation
Also have added the option to add `headers` to `_jsonRequest` and changed it into an object-accepting function for "future-proofing" it
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.
👍
src/AlgoliaSearch.js
Outdated
* @example | ||
* client.getTopUserID(); | ||
*/ | ||
AlgoliaSearch.prototype.getTopUserID = function(_, callback) { |
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.
why not just func(callback)? why force to do func(null, cb)?
src/AlgoliaSearch.js
Outdated
return this._jsonRequest({ | ||
method: 'GET', | ||
url: '/1/clusters/mapping/top', | ||
hostType: 'write', |
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.
read?
src/AlgoliaSearch.js
Outdated
return this._jsonRequest({ | ||
method: 'GET', | ||
url: '/1/clusters/mapping/' + data.userID, | ||
hostType: 'write', |
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.
read?
src/AlgoliaSearch.js
Outdated
* @example | ||
* client.listClusters(); | ||
*/ | ||
AlgoliaSearch.prototype.listClusters = function(_, callback) { |
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.
Same, why _, callback?
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.
because this way there's no surprise if this method will later need options 🤔
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.
Given the state of this JS client I think it's best to then do a non-breaking change evolution (from no params to params).
So we must support:
listClusters() => promise
listClusters(callback)
Calling listClusters(null, callback) only in case we add new features is too magic/uncommon
src/AlgoliaSearch.js
Outdated
method: 'GET', | ||
url: '/1/clusters/mapping', | ||
body: data, | ||
hostType: 'write', |
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.
read?
src/AlgoliaSearch.js
Outdated
return this._jsonRequest({ | ||
method: 'GET', | ||
url: '/1/clusters', | ||
hostType: 'write', |
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.
read?
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.
What decides which is read and which is write?
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.
read is anything that is not modifying the index
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.
LGTM
Summary
Adding the MCM methods
Result
Also have added the option to add
headers
to_jsonRequest
and changed it into an object-accepting function for "future-proofing" it