Skip to content

Commit

Permalink
nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jul 8, 2024
1 parent ede9b71 commit dbe90dc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nodejs-client/src/dsn/dsn_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,26 +257,38 @@ rpc_address.prototype.equals = function(other){
};

// TODO(yingchun): host_port is now just a place holder and not well implemented, need improve it
// Error code enum
var host_port_type = {
HOST_TYPE_INVALID : 0,
HOST_TYPE_IPV4 : 1,
HOST_TYPE_GROUP : 2
};
var host_port = function(args) {
this.host = null;
this.port = 0;
this.type = host_port_type.HOST_TYPE_INVALID;
if(args && args.host){
this.host = args.host;
}
if(args && args.port){
this.port = args.port;
}
if(args && args.type){
this.type = args.type;
}
};

host_port.prototype = {};
host_port.prototype.read = function(input){
this.host = input.readBinary();
this.port = input.readI16();
this.type = input.readByte();
};

host_port.prototype.write = function(output){
output.writeBinary(this.host);
output.writeI16(this.port);
output.writeByte(this.type);
};

//value, calculate by app_id and partition index
Expand Down

0 comments on commit dbe90dc

Please sign in to comment.