Skip to content

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

Merged
merged 3 commits into from
Dec 13, 2017
Merged

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Dec 13, 2017

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

Also have added the option to add `headers` to `_jsonRequest` and changed it into an object-accepting function for "future-proofing" it
@Haroenv Haroenv requested review from vvo and kokliKo December 13, 2017 15:10
Copy link

@kokliKo kokliKo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* @example
* client.getTopUserID();
*/
AlgoliaSearch.prototype.getTopUserID = function(_, callback) {
Copy link

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)?

return this._jsonRequest({
method: 'GET',
url: '/1/clusters/mapping/top',
hostType: 'write',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read?

return this._jsonRequest({
method: 'GET',
url: '/1/clusters/mapping/' + data.userID,
hostType: 'write',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read?

* @example
* client.listClusters();
*/
AlgoliaSearch.prototype.listClusters = function(_, callback) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, why _, callback?

Copy link
Contributor Author

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 🤔

Copy link

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

method: 'GET',
url: '/1/clusters/mapping',
body: data,
hostType: 'write',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read?

return this._jsonRequest({
method: 'GET',
url: '/1/clusters',
hostType: 'write',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read?

Copy link
Contributor Author

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?

Copy link

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

Copy link

@vvo vvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Haroenv Haroenv merged commit 31bfc55 into master Dec 13, 2017
@Haroenv Haroenv deleted the feat/mcm branch December 13, 2017 17:20
@Haroenv Haroenv mentioned this pull request Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants