basho / riak-nodejs-client

The Riak client for Node.js.
Apache License 2.0
72 stars 29 forks source link

RiakCluster updateNodes [JIRA: CLIENTS-678] #114

Closed mogadanez closed 8 years ago

mogadanez commented 8 years ago

now RiakCluster have methods addNode and removeNode it will be nice to have updateNodes method

use case: when cluster configuration is updated and I receive some notification event i want update client without restarting application.

lukebakken commented 8 years ago

You should be able to use removeNode followed by addNode using your updated node configuration. Does this not work as expected?

mogadanez commented 8 years ago

yes, but it require me to store and manage list of nodes in parallel.

so when I get new nodes list, I need compare this list with current nodes inside client.getRiakCluster().nodes and make decision which nodes is new, and which is old and should be removed. Also when calling addNode I need construct node manual, but on initial client creation I just provided string array in Riak.Client([])

As for me such code can be bundled inside, since it pretty common.

lukebakken commented 8 years ago

Based on your need to dynamically modify the nodes you're using, I recommend building the RiakNode objects yourself, passing them to the RiakCluster constructor, and using that RiakCluster object as the argument to the client constructor. That way you will have the exact same list of nodes to manage as the Client object, and can use the removeNode and addNode methods from then on.

Updating a RiakNode while it is running is not trivial to implement, which is why none of the Riak client libraries support this feature.