[Groonga-commit] droonga/express-droonga at c828912 [master] Use correct host:port for RPC

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 5 12:47:29 JST 2014


YUKI Hiroshi	2014-11-05 12:47:29 +0900 (Wed, 05 Nov 2014)

  New Revision: c82891262ac5674ba0633568cccbdcbd29209cc3
  https://github.com/droonga/express-droonga/commit/c82891262ac5674ba0633568cccbdcbd29209cc3

  Message:
    Use correct host:port for RPC

  Modified files:
    lib/serf/client.js
    lib/serf/options.js

  Modified: lib/serf/client.js (+5 -4)
===================================================================
--- lib/serf/client.js    2014-11-05 12:46:56 +0900 (ace4e26)
+++ lib/serf/client.js    2014-11-05 12:47:29 +0900 (a490c0b)
@@ -2,7 +2,7 @@
  * usage:
  *   var Client = require('lib/serf/client');
  *   var serf = new Client({
- *                host:       'node0', // host name that the serf agent is working
+ *                rpcAddress: 'node0:7373', // endpoint of Serf RPC
  *                tag:        'droonga', // tag of engines, can be omitted
  *                enginePort: 10031 // port number of engines, can be omitted
  *              });
@@ -27,17 +27,18 @@ var SerfRPC = require('serf-rpc'),
     Q       = require('q');
 
 var ENGINE_NODE_NAME_PATTERN = /^([^:]+):(\d+)\/(.+)$/;
+var DEFAULT_RPC_PORT = 7373;
 
 function Client(options) {
   options = options || {};
+  options.rpcAddress = options.rpcAddress || '127.0.0.1';
 
-  this._droongaHost       = options.host || '127.0.0.1';
   this._droongaEnginePort = options.enginePort || 10031;
   this._droongaTag        = options.tag || 'droonga';
 
   this._connectionOptions = {
-    rpc_host: this._droongaHost,
-    rpc_port: 7373
+    rpc_host: options.rpcAddress.split(':')[0],
+    rpc_port: parseInt(options.rpcAddress.split(':')[1] || DEFAULT_RPC_PORT)
   };
   this._client = new SerfRPC();
   this._connected = false;

  Modified: lib/serf/options.js (+3 -3)
===================================================================
--- lib/serf/options.js    2014-11-05 12:46:56 +0900 (dcc625e)
+++ lib/serf/options.js    2014-11-05 12:47:29 +0900 (a118b13)
@@ -1,6 +1,6 @@
 var options = require('commander');
 
-options.rpcHostName       = '127.0.0.1';
+options.rpcAddress        = '127.0.0.1:7373';
 options.droongaEnginePort = 10031;
 options.tag               = 'droonga';
 
@@ -25,8 +25,8 @@ function add() {
 exports.add = add;
 
 function define() {
-  add('--rpc-host-name <name>',
-      'Host name of the node Serf agent is running on (' + options.rpcHostName + ')');
+  add('--rpc-address <address>',
+      'Host:port of the Serf RPC endpoint (' + options.rpcAddress + ')');
   add('--droonga-engine-port <port>',
       'Port number of Droonga engine (' + options.droongaEnginePort + ')',
       intOption);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index