From 9b5a6a42615c0e9284457b2b99f8d99bc9626db4 Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Fri, 5 Jul 2024 23:14:54 +0800 Subject: [PATCH] node.js host_port --- nodejs-client/src/dsn/dsn_types.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/nodejs-client/src/dsn/dsn_types.js b/nodejs-client/src/dsn/dsn_types.js index 46eb508ffd..479c17a323 100644 --- a/nodejs-client/src/dsn/dsn_types.js +++ b/nodejs-client/src/dsn/dsn_types.js @@ -256,6 +256,28 @@ rpc_address.prototype.equals = function(other){ return false; }; +var host_port = function(args) { + this.host = null; + this.port = 0; + if(args && args.host){ + this.host = args.host; + } + if(args && args.port){ + this.port = args.port; + } +}; + +host_port.prototype = {}; +host_port.prototype.read = function(input){ + this.host = input.readBinary(); + this.port = input.readI16(); +}; + +host_port.prototype.write = function(output){ + output.writeBinary(this.host); + output.writeI16(this.port); +}; + //value, calculate by app_id and partition index var gpid = function(args) { this.value = 0; @@ -298,6 +320,7 @@ module.exports = { error_code : error_code, task_code : task_code, rpc_address : rpc_address, + host_port : host_port, gpid : gpid, };