Skip to content

Commit

Permalink
node.js host_port
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jul 5, 2024
1 parent d90b3ec commit 9b5a6a4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nodejs-client/src/dsn/dsn_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -298,6 +320,7 @@ module.exports = {
error_code : error_code,
task_code : task_code,
rpc_address : rpc_address,
host_port : host_port,
gpid : gpid,
};

0 comments on commit 9b5a6a4

Please sign in to comment.