diff --git a/.github/workflows/test_nodejs-client.yml b/.github/workflows/test_nodejs-client.yml index d08c9478d8..a3d7005c1c 100644 --- a/.github/workflows/test_nodejs-client.yml +++ b/.github/workflows/test_nodejs-client.yml @@ -39,6 +39,10 @@ jobs: name: test runs-on: ubuntu-20.04 steps: + - name: Install thrift + # python-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0 + # to generate code as well. The thrift-compiler version on ubuntu-20.04 is 0.13.0 + run: sudo apt-get install -y thrift-compiler - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: @@ -46,5 +50,6 @@ jobs: - name: test working-directory: ./nodejs-client run: | + ./recompile_thrift.sh npm install ./test.sh diff --git a/.licenserc.yaml b/.licenserc.yaml index f38e309820..97b71e09ec 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -43,7 +43,6 @@ header: - 'go-client/idl/base/dsn_err_string.go' - 'go-client/idl/base/rocskdb_err_string.go' - 'go-client/idl/base/GoUnusedProtection__.go' - - 'nodejs-client/src/dsn/*.js' - '**/.npmigonre' # Copyright (c) Facebook, Inc - 'src/utils/TokenBucket.h' diff --git a/idl/dsn.layer2.thrift b/idl/dsn.layer2.thrift index 7e80cd51a4..086040c9cb 100644 --- a/idl/dsn.layer2.thrift +++ b/idl/dsn.layer2.thrift @@ -26,7 +26,6 @@ include "dsn.thrift" -# TODO(yingchun): reuse the idls for server and all client libs namespace cpp dsn namespace go replication namespace java org.apache.pegasus.replication diff --git a/idl/rrdb.thrift b/idl/rrdb.thrift index 35e3346448..da778f55e7 100644 --- a/idl/rrdb.thrift +++ b/idl/rrdb.thrift @@ -324,7 +324,6 @@ service rrdb oneway void clear_scanner(1:i64 context_id); } -// ONLY FOR GO & JAVA & Python service meta { dsn.layer2.query_cfg_response query_cfg(1:dsn.layer2.query_cfg_request query); diff --git a/nodejs-client/idl/base.thrift b/nodejs-client/idl/base.thrift deleted file mode 100644 index f905e27e20..0000000000 --- a/nodejs-client/idl/base.thrift +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -namespace cpp dsn.base -namespace java dsn.base - -// place holder -struct blob -{ -} - -struct error_code -{ -} - -struct task_code -{ -} - -struct rpc_address -{ -} - -struct gpid -{ -} diff --git a/nodejs-client/idl/recompile_thrift.sh b/nodejs-client/idl/recompile_thrift.sh deleted file mode 100755 index 607504c93b..0000000000 --- a/nodejs-client/idl/recompile_thrift.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# complier require: thrift 0.10.0 - -thrift=thrift - -if ! $thrift -version | grep '0.10.0' -then - echo "Should use thrift 0.10.0" - exit -1 -fi - -TMP_DIR=./gen-nodejs -rm -rf $TMP_DIR - -mkdir -p $TMP_DIR -$thrift --gen js:node rrdb.thrift -$thrift --gen js:node replication.thrift -$thrift --gen js:node base.thrift - -cp -v -r $TMP_DIR/* ../dsn -rm -rf $TMP_DIR - -echo "done" diff --git a/nodejs-client/idl/replication.thrift b/nodejs-client/idl/replication.thrift deleted file mode 100644 index c88ae7fd21..0000000000 --- a/nodejs-client/idl/replication.thrift +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -include "base.thrift" - -namespace cpp dsn.replication -namespace java dsn.replication - -struct partition_configuration -{ - 1:base.gpid pid; - 2:i64 ballot; - 3:i32 max_replica_count; - 4:base.rpc_address primary; - 5:list secondaries; - 6:list last_drops; - 7:i64 last_committed_decree; -} - -struct query_cfg_request -{ - 1:string app_name; - 2:list partition_indices; -} - -struct query_cfg_response -{ - 1:base.error_code err; - 2:i32 app_id; - 3:i32 partition_count; - 4:bool is_stateful; - 5:list partitions; -} - -enum app_status -{ - AS_INVALID, - AS_AVAILABLE, - AS_CREATING, - AS_CREATE_FAILED, // depricated - AS_DROPPING, - AS_DROP_FAILED, // depricated - AS_DROPPED, - AS_RECALLING -} - -struct app_info -{ - 1:app_status status = app_status.AS_INVALID; - 2:string app_type; - 3:string app_name; - 4:i32 app_id; - 5:i32 partition_count; - 6:map envs; - 7:bool is_stateful; - 8:i32 max_replica_count; - 9:i64 expire_second; -} - -struct create_app_options -{ - 1:i32 partition_count; - 2:i32 replica_count; - 3:bool success_if_exist; - 4:string app_type; - 5:bool is_stateful; - 6:map envs; -} - -struct configuration_create_app_request -{ - 1:string app_name; - 2:create_app_options options; -} - -struct configuration_create_app_response -{ - 1:base.error_code err; - 2:i32 appid; -} - -struct drop_app_options -{ - 1:bool success_if_not_exist; - 2:optional i64 reserve_seconds; -} - -struct configuration_drop_app_request -{ - 1:string app_name; - 2:drop_app_options options; -} - -struct configuration_drop_app_response -{ - 1:base.error_code err; -} - -struct configuration_recall_app_request -{ - 1:i32 app_id; - 2:string new_app_name; -} - -struct configuration_recall_app_response -{ - 1:base.error_code err; - 2:app_info info; -} - -struct configuration_modify_backup_policy_request -{ - 1:string policy_name; - 2:optional list add_appids; - 3:optional list removal_appids; - 4:optional i64 new_backup_interval_sec; - 5:optional i32 backup_history_count_to_keep; - 6:optional bool is_disable; - 7:optional string start_time; // restrict the start time of each backup, hour:minute -} - -struct configuration_modify_backup_policy_response -{ - 1:base.error_code err; - 2:string hint_message; -} - -struct configuration_add_backup_policy_request -{ - 1:string backup_provider_type; - 2:string policy_name; - 3:list app_ids; - 4:i64 backup_interval_seconds; - 5:i32 backup_history_count_to_keep; - 6:string start_time; -} - -struct configuration_add_backup_policy_response -{ - 1:base.error_code err; - 2:string hint_message; -} - -struct policy_entry -{ - 1:string policy_name; - 2:string backup_provider_type; - 3:string backup_interval_seconds; - 4:set app_ids; - 5:i32 backup_history_count_to_keep; - 6:string start_time; - 7:bool is_disable; -} - -struct backup_entry -{ - 1:i64 backup_id; - 2:i64 start_time_ms; - 3:i64 end_time_ms; - 4:set app_ids; -} - -struct configuration_query_backup_policy_request -{ - 1:list policy_names; - 2:i32 backup_info_count; -} - -struct configuration_query_backup_policy_response -{ - 1:base.error_code err; - 2:list policys; - 3:list> backup_infos; - 4:optional string hint_msg; -} - -struct configuration_restore_request -{ - 1:string cluster_name; - 2:string policy_name; - 3:i64 time_stamp; // namely backup_id - 4:string app_name; - 5:i32 app_id; - 6:string new_app_name; - 7:string backup_provider_name; - 8:bool skip_bad_partition; -} - -struct configuration_query_restore_request -{ - 1:i32 restore_app_id; -} - -struct configuration_query_restore_response -{ - 1:base.error_code err; - 2:list restore_status; - 3:list restore_progress; -} - -struct configuration_list_apps_request -{ - 1:app_status status = app_status.AS_INVALID; -} - -struct configuration_list_apps_response -{ - 1:base.error_code err; - 2:list infos; -} \ No newline at end of file diff --git a/nodejs-client/idl/rrdb.thrift b/nodejs-client/idl/rrdb.thrift deleted file mode 100644 index bcd2f09d80..0000000000 --- a/nodejs-client/idl/rrdb.thrift +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -include "base.thrift" -include "replication.thrift" - -namespace cpp dsn.apps -namespace java dsn.apps - -struct update_request -{ - 1:base.blob key; - 2:base.blob value; - 3:i32 expire_ts_seconds; -} - -struct update_response -{ - 1:i32 error; - 2:i32 app_id; - 3:i32 partition_index; - 4:i64 decree; - 5:string server; -} - -struct read_response -{ - 1:i32 error; - 2:base.blob value; - 3:i32 app_id; - 4:i32 partition_index; - 6:string server; -} - -struct ttl_response -{ - 1:i32 error; - 2:i32 ttl_seconds; - 3:i32 app_id; - 4:i32 partition_index; - 6:string server; -} - -struct count_response -{ - 1:i32 error; - 2:i64 count; - 3:i32 app_id; - 4:i32 partition_index; - 6:string server; -} - -struct key_value -{ - 1:base.blob key; - 2:base.blob value; -} - -struct multi_put_request -{ - 1:base.blob hash_key; - 2:list kvs; // sort_key => value - 3:i32 expire_ts_seconds; -} - -struct multi_remove_request -{ - 1:base.blob hash_key; - 2:list sork_keys; // empty means remove all sortkeys - 3:i64 max_count; // deprecated -} - -struct multi_remove_response -{ - 1:i32 error; - 2:i64 count; // deleted count - 3:i32 app_id; - 4:i32 partition_index; - 5:i64 decree; - 6:string server; -} - -struct multi_get_request -{ - 1:base.blob hash_key; - 2:list sork_keys; // empty means fetch all sortkeys - 3:i32 max_kv_count; // <= 0 means no limit - 4:i32 max_kv_size; // <= 0 means no limit - 5:bool no_value; // not return value, only return sortkeys -} - -struct multi_get_response -{ - 1:i32 error; - 2:list kvs; // sort_key => value - 3:i32 app_id; - 4:i32 partition_index; - 6:string server; -} - -struct get_scanner_request -{ - 1:base.blob start_key; - 2:base.blob stop_key; - 3:bool start_inclusive; - 4:bool stop_inclusive; - 5:i32 batch_size; -} - -struct scan_request -{ - 1:i64 context_id; -} - -struct scan_response -{ - 1:i32 error; - 2:list kvs; - 3:i64 context_id; - 4:i32 app_id; - 5:i32 partition_index; - 6:string server; -} - -service rrdb -{ - update_response put(1:update_request update); - update_response multi_put(1:multi_put_request request); - update_response remove(1:base.blob key); - multi_remove_response multi_remove(1:multi_remove_request request); - read_response get(1:base.blob key); - multi_get_response multi_get(1:multi_get_request request); - count_response sortkey_count(1:base.blob hash_key); - ttl_response ttl(1:base.blob key); - scan_response get_scanner(1:get_scanner_request request); - scan_response scan(1:scan_request request); - oneway void clear_scanner(1:i64 context_id); -} - -service meta -{ - replication.query_cfg_response query_cfg(1:replication.query_cfg_request query); - replication.configuration_create_app_response create_app(1:replication.configuration_create_app_request req); - replication.configuration_list_apps_response list_apps(1:replication.configuration_list_apps_request req); - replication.configuration_drop_app_response drop_app(1:replication.configuration_drop_app_request req); - replication.configuration_recall_app_response recall_app(1:replication.configuration_recall_app_request req); - - replication.configuration_query_backup_policy_response query_backup_policy(1:replication.configuration_query_backup_policy_request req); - replication.configuration_add_backup_policy_response add_backup_policy(1:replication.configuration_add_backup_policy_request req); - replication.configuration_modify_backup_policy_response modify_backup_policy(1:replication.configuration_modify_backup_policy_request req); - - replication.configuration_create_app_response start_restore(1:replication.configuration_restore_request req); - replication.configuration_query_restore_response query_restore(1:replication.configuration_query_restore_request req); -} diff --git a/nodejs-client/recompile_thrift.sh b/nodejs-client/recompile_thrift.sh new file mode 100755 index 0000000000..00a9fd93e1 --- /dev/null +++ b/nodejs-client/recompile_thrift.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e + +thrift=thrift + +# TODO(yingchun): is it necessary to restrict the thrift version as 0.10.0? +#if ! $thrift -version | grep '0.10.0' +#then +# echo "Should use thrift 0.10.0" +# exit -1 +#fi + +$thrift -v --gen js:node,with_ns -out src/dsn ../idl/dsn.layer2.thrift +$thrift -v --gen js:node,with_ns -out src/dsn ../idl/rrdb.thrift + +# TODO(yingchun): There service helpers need to be exported to be used by src/operator.js, +# I didn't find a better method except modifying them manually as follow. +need_export_meta_structs=( + meta_query_cfg_args + meta_query_cfg_result +) + +need_export_rrdb_structs=( + rrdb_put_args + rrdb_put_result + rrdb_multi_put_args + rrdb_multi_put_result + rrdb_remove_args + rrdb_remove_result + rrdb_get_args + rrdb_get_result + rrdb_multi_get_args + rrdb_multi_get_result +) + +for n in ${need_export_meta_structs[*]}; do + sed -i "s/var ${n}/var ${n} = module.exports.${n}/g" src/dsn/meta.js +done + +for n in ${need_export_rrdb_structs[*]}; do + sed -i "s/var ${n}/var ${n} = module.exports.${n}/g" src/dsn/rrdb.js +done + +echo "done" diff --git a/nodejs-client/src/connection.js b/nodejs-client/src/connection.js index 777b041e0a..d71e08fa5f 100644 --- a/nodejs-client/src/connection.js +++ b/nodejs-client/src/connection.js @@ -25,8 +25,8 @@ const util = require('util'); const Exception = require('./errors'); -const ErrorCode = require('./dsn/base_types').error_code; -const ErrorType = require('./dsn/base_types').error_type; +const ErrorCode = require('./dsn/dsn_types').error_code; +const ErrorType = require('./dsn/dsn_types').error_type; const thrift = require('thrift'); const InputBufferUnderrunError = require('thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error'); diff --git a/nodejs-client/src/dsn/base_types.js b/nodejs-client/src/dsn/dsn_types.js similarity index 89% rename from nodejs-client/src/dsn/base_types.js rename to nodejs-client/src/dsn/dsn_types.js index 261bd51fc9..46eb508ffd 100644 --- a/nodejs-client/src/dsn/base_types.js +++ b/nodejs-client/src/dsn/dsn_types.js @@ -1,8 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at // -// Autogenerated by Thrift Compiler (0.10.0) -// -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// http://www.apache.org/licenses/LICENSE-2.0 // +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + "use strict"; var thrift = require('thrift'); diff --git a/nodejs-client/src/dsn/meta.js b/nodejs-client/src/dsn/meta.js deleted file mode 100644 index 97bf89a172..0000000000 --- a/nodejs-client/src/dsn/meta.js +++ /dev/null @@ -1,1956 +0,0 @@ -// -// Autogenerated by Thrift Compiler (0.10.0) -// -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -// -"use strict"; - -var thrift = require('thrift'); -var Thrift = thrift.Thrift; -var Q = thrift.Q; - -var base_ttypes = require('./base_types'); -var replication_ttypes = require('./replication_types'); - - -var ttypes = require('./rrdb_types'); -//HELPER FUNCTIONS AND STRUCTURES - -var meta_query_cfg_args = module.exports.meta_query_cfg_args = function(args) { - this.query = null; - if (args) { - if (args.query !== undefined && args.query !== null) { - this.query = new replication_ttypes.query_cfg_request(args.query); - } - } -}; -meta_query_cfg_args.prototype = {}; -meta_query_cfg_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.query = new replication_ttypes.query_cfg_request(); - this.query.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_query_cfg_args.prototype.write = function(output) { - output.writeStructBegin('meta_query_cfg_args'); - if (this.query !== null && this.query !== undefined) { - output.writeFieldBegin('query', Thrift.Type.STRUCT, 1); - this.query.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_query_cfg_result = module.exports.meta_query_cfg_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.query_cfg_response(args.success); - } - } -}; -meta_query_cfg_result.prototype = {}; -meta_query_cfg_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.query_cfg_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_query_cfg_result.prototype.write = function(output) { - output.writeStructBegin('meta_query_cfg_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_create_app_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_create_app_request(args.req); - } - } -}; -meta_create_app_args.prototype = {}; -meta_create_app_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_create_app_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_create_app_args.prototype.write = function(output) { - output.writeStructBegin('meta_create_app_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_create_app_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_create_app_response(args.success); - } - } -}; -meta_create_app_result.prototype = {}; -meta_create_app_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_create_app_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_create_app_result.prototype.write = function(output) { - output.writeStructBegin('meta_create_app_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_list_apps_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_list_apps_request(args.req); - } - } -}; -meta_list_apps_args.prototype = {}; -meta_list_apps_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_list_apps_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_list_apps_args.prototype.write = function(output) { - output.writeStructBegin('meta_list_apps_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_list_apps_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_list_apps_response(args.success); - } - } -}; -meta_list_apps_result.prototype = {}; -meta_list_apps_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_list_apps_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_list_apps_result.prototype.write = function(output) { - output.writeStructBegin('meta_list_apps_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_drop_app_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_drop_app_request(args.req); - } - } -}; -meta_drop_app_args.prototype = {}; -meta_drop_app_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_drop_app_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_drop_app_args.prototype.write = function(output) { - output.writeStructBegin('meta_drop_app_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_drop_app_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_drop_app_response(args.success); - } - } -}; -meta_drop_app_result.prototype = {}; -meta_drop_app_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_drop_app_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_drop_app_result.prototype.write = function(output) { - output.writeStructBegin('meta_drop_app_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_recall_app_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_recall_app_request(args.req); - } - } -}; -meta_recall_app_args.prototype = {}; -meta_recall_app_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_recall_app_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_recall_app_args.prototype.write = function(output) { - output.writeStructBegin('meta_recall_app_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_recall_app_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_recall_app_response(args.success); - } - } -}; -meta_recall_app_result.prototype = {}; -meta_recall_app_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_recall_app_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_recall_app_result.prototype.write = function(output) { - output.writeStructBegin('meta_recall_app_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_query_backup_policy_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_query_backup_policy_request(args.req); - } - } -}; -meta_query_backup_policy_args.prototype = {}; -meta_query_backup_policy_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_query_backup_policy_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_query_backup_policy_args.prototype.write = function(output) { - output.writeStructBegin('meta_query_backup_policy_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_query_backup_policy_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_query_backup_policy_response(args.success); - } - } -}; -meta_query_backup_policy_result.prototype = {}; -meta_query_backup_policy_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_query_backup_policy_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_query_backup_policy_result.prototype.write = function(output) { - output.writeStructBegin('meta_query_backup_policy_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_add_backup_policy_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_add_backup_policy_request(args.req); - } - } -}; -meta_add_backup_policy_args.prototype = {}; -meta_add_backup_policy_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_add_backup_policy_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_add_backup_policy_args.prototype.write = function(output) { - output.writeStructBegin('meta_add_backup_policy_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_add_backup_policy_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_add_backup_policy_response(args.success); - } - } -}; -meta_add_backup_policy_result.prototype = {}; -meta_add_backup_policy_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_add_backup_policy_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_add_backup_policy_result.prototype.write = function(output) { - output.writeStructBegin('meta_add_backup_policy_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_modify_backup_policy_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_modify_backup_policy_request(args.req); - } - } -}; -meta_modify_backup_policy_args.prototype = {}; -meta_modify_backup_policy_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_modify_backup_policy_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_modify_backup_policy_args.prototype.write = function(output) { - output.writeStructBegin('meta_modify_backup_policy_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_modify_backup_policy_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_modify_backup_policy_response(args.success); - } - } -}; -meta_modify_backup_policy_result.prototype = {}; -meta_modify_backup_policy_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_modify_backup_policy_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_modify_backup_policy_result.prototype.write = function(output) { - output.writeStructBegin('meta_modify_backup_policy_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_start_restore_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_restore_request(args.req); - } - } -}; -meta_start_restore_args.prototype = {}; -meta_start_restore_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_restore_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_start_restore_args.prototype.write = function(output) { - output.writeStructBegin('meta_start_restore_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_start_restore_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_create_app_response(args.success); - } - } -}; -meta_start_restore_result.prototype = {}; -meta_start_restore_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_create_app_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_start_restore_result.prototype.write = function(output) { - output.writeStructBegin('meta_start_restore_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_query_restore_args = function(args) { - this.req = null; - if (args) { - if (args.req !== undefined && args.req !== null) { - this.req = new replication_ttypes.configuration_query_restore_request(args.req); - } - } -}; -meta_query_restore_args.prototype = {}; -meta_query_restore_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.req = new replication_ttypes.configuration_query_restore_request(); - this.req.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_query_restore_args.prototype.write = function(output) { - output.writeStructBegin('meta_query_restore_args'); - if (this.req !== null && this.req !== undefined) { - output.writeFieldBegin('req', Thrift.Type.STRUCT, 1); - this.req.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var meta_query_restore_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new replication_ttypes.configuration_query_restore_response(args.success); - } - } -}; -meta_query_restore_result.prototype = {}; -meta_query_restore_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new replication_ttypes.configuration_query_restore_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -meta_query_restore_result.prototype.write = function(output) { - output.writeStructBegin('meta_query_restore_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var metaClient = exports.Client = function(output, pClass) { - this.output = output; - this.pClass = pClass; - this._seqid = 0; - this._reqs = {}; -}; -metaClient.prototype = {}; -metaClient.prototype.seqid = function() { return this._seqid; }; -metaClient.prototype.new_seqid = function() { return this._seqid += 1; }; -metaClient.prototype.query_cfg = function(query, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_query_cfg(query); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_query_cfg(query); - } -}; - -metaClient.prototype.send_query_cfg = function(query) { - var output = new this.pClass(this.output); - output.writeMessageBegin('query_cfg', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_query_cfg_args(); - args.query = query; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_query_cfg = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_query_cfg_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('query_cfg failed: unknown result'); -}; -metaClient.prototype.create_app = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_create_app(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_create_app(req); - } -}; - -metaClient.prototype.send_create_app = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('create_app', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_create_app_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_create_app = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_create_app_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('create_app failed: unknown result'); -}; -metaClient.prototype.list_apps = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_list_apps(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_list_apps(req); - } -}; - -metaClient.prototype.send_list_apps = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('list_apps', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_list_apps_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_list_apps = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_list_apps_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('list_apps failed: unknown result'); -}; -metaClient.prototype.drop_app = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_drop_app(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_drop_app(req); - } -}; - -metaClient.prototype.send_drop_app = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('drop_app', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_drop_app_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_drop_app = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_drop_app_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('drop_app failed: unknown result'); -}; -metaClient.prototype.recall_app = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_recall_app(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_recall_app(req); - } -}; - -metaClient.prototype.send_recall_app = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('recall_app', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_recall_app_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_recall_app = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_recall_app_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('recall_app failed: unknown result'); -}; -metaClient.prototype.query_backup_policy = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_query_backup_policy(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_query_backup_policy(req); - } -}; - -metaClient.prototype.send_query_backup_policy = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('query_backup_policy', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_query_backup_policy_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_query_backup_policy = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_query_backup_policy_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('query_backup_policy failed: unknown result'); -}; -metaClient.prototype.add_backup_policy = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_add_backup_policy(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_add_backup_policy(req); - } -}; - -metaClient.prototype.send_add_backup_policy = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('add_backup_policy', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_add_backup_policy_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_add_backup_policy = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_add_backup_policy_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('add_backup_policy failed: unknown result'); -}; -metaClient.prototype.modify_backup_policy = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_modify_backup_policy(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_modify_backup_policy(req); - } -}; - -metaClient.prototype.send_modify_backup_policy = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('modify_backup_policy', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_modify_backup_policy_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_modify_backup_policy = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_modify_backup_policy_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('modify_backup_policy failed: unknown result'); -}; -metaClient.prototype.start_restore = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_start_restore(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_start_restore(req); - } -}; - -metaClient.prototype.send_start_restore = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('start_restore', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_start_restore_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_start_restore = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_start_restore_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('start_restore failed: unknown result'); -}; -metaClient.prototype.query_restore = function(req, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_query_restore(req); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_query_restore(req); - } -}; - -metaClient.prototype.send_query_restore = function(req) { - var output = new this.pClass(this.output); - output.writeMessageBegin('query_restore', Thrift.MessageType.CALL, this.seqid()); - var args = new meta_query_restore_args(); - args.req = req; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -metaClient.prototype.recv_query_restore = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new meta_query_restore_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('query_restore failed: unknown result'); -}; -var metaProcessor = exports.Processor = function(handler) { - this._handler = handler; -} -; -metaProcessor.prototype.process = function(input, output) { - var r = input.readMessageBegin(); - if (this['process_' + r.fname]) { - return this['process_' + r.fname].call(this, r.rseqid, input, output); - } else { - input.skip(Thrift.Type.STRUCT); - input.readMessageEnd(); - var x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname); - output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid); - x.write(output); - output.writeMessageEnd(); - output.flush(); - } -} -; -metaProcessor.prototype.process_query_cfg = function(seqid, input, output) { - var args = new meta_query_cfg_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.query_cfg.length === 1) { - Q.fcall(this._handler.query_cfg, args.query) - .then(function(result) { - var result_obj = new meta_query_cfg_result({success: result}); - output.writeMessageBegin("query_cfg", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("query_cfg", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.query_cfg(args.query, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_query_cfg_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("query_cfg", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("query_cfg", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_create_app = function(seqid, input, output) { - var args = new meta_create_app_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.create_app.length === 1) { - Q.fcall(this._handler.create_app, args.req) - .then(function(result) { - var result_obj = new meta_create_app_result({success: result}); - output.writeMessageBegin("create_app", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("create_app", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.create_app(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_create_app_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("create_app", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("create_app", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_list_apps = function(seqid, input, output) { - var args = new meta_list_apps_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.list_apps.length === 1) { - Q.fcall(this._handler.list_apps, args.req) - .then(function(result) { - var result_obj = new meta_list_apps_result({success: result}); - output.writeMessageBegin("list_apps", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("list_apps", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.list_apps(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_list_apps_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("list_apps", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("list_apps", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_drop_app = function(seqid, input, output) { - var args = new meta_drop_app_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.drop_app.length === 1) { - Q.fcall(this._handler.drop_app, args.req) - .then(function(result) { - var result_obj = new meta_drop_app_result({success: result}); - output.writeMessageBegin("drop_app", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("drop_app", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.drop_app(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_drop_app_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("drop_app", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("drop_app", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_recall_app = function(seqid, input, output) { - var args = new meta_recall_app_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.recall_app.length === 1) { - Q.fcall(this._handler.recall_app, args.req) - .then(function(result) { - var result_obj = new meta_recall_app_result({success: result}); - output.writeMessageBegin("recall_app", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("recall_app", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.recall_app(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_recall_app_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("recall_app", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("recall_app", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_query_backup_policy = function(seqid, input, output) { - var args = new meta_query_backup_policy_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.query_backup_policy.length === 1) { - Q.fcall(this._handler.query_backup_policy, args.req) - .then(function(result) { - var result_obj = new meta_query_backup_policy_result({success: result}); - output.writeMessageBegin("query_backup_policy", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("query_backup_policy", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.query_backup_policy(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_query_backup_policy_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("query_backup_policy", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("query_backup_policy", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_add_backup_policy = function(seqid, input, output) { - var args = new meta_add_backup_policy_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.add_backup_policy.length === 1) { - Q.fcall(this._handler.add_backup_policy, args.req) - .then(function(result) { - var result_obj = new meta_add_backup_policy_result({success: result}); - output.writeMessageBegin("add_backup_policy", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("add_backup_policy", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.add_backup_policy(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_add_backup_policy_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("add_backup_policy", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("add_backup_policy", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_modify_backup_policy = function(seqid, input, output) { - var args = new meta_modify_backup_policy_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.modify_backup_policy.length === 1) { - Q.fcall(this._handler.modify_backup_policy, args.req) - .then(function(result) { - var result_obj = new meta_modify_backup_policy_result({success: result}); - output.writeMessageBegin("modify_backup_policy", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("modify_backup_policy", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.modify_backup_policy(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_modify_backup_policy_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("modify_backup_policy", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("modify_backup_policy", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_start_restore = function(seqid, input, output) { - var args = new meta_start_restore_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.start_restore.length === 1) { - Q.fcall(this._handler.start_restore, args.req) - .then(function(result) { - var result_obj = new meta_start_restore_result({success: result}); - output.writeMessageBegin("start_restore", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("start_restore", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.start_restore(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_start_restore_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("start_restore", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("start_restore", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -metaProcessor.prototype.process_query_restore = function(seqid, input, output) { - var args = new meta_query_restore_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.query_restore.length === 1) { - Q.fcall(this._handler.query_restore, args.req) - .then(function(result) { - var result_obj = new meta_query_restore_result({success: result}); - output.writeMessageBegin("query_restore", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("query_restore", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.query_restore(args.req, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new meta_query_restore_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("query_restore", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("query_restore", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; diff --git a/nodejs-client/src/dsn/replication_types.js b/nodejs-client/src/dsn/replication_types.js deleted file mode 100644 index 0b2654fb4a..0000000000 --- a/nodejs-client/src/dsn/replication_types.js +++ /dev/null @@ -1,2767 +0,0 @@ -// -// Autogenerated by Thrift Compiler (0.10.0) -// -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -// -"use strict"; - -var thrift = require('thrift'); -var Thrift = thrift.Thrift; -var Q = thrift.Q; - -var base_ttypes = require('./base_types'); - - -var ttypes = module.exports = {}; -ttypes.app_status = { - 'AS_INVALID' : 0, - 'AS_AVAILABLE' : 1, - 'AS_CREATING' : 2, - 'AS_CREATE_FAILED' : 3, - 'AS_DROPPING' : 4, - 'AS_DROP_FAILED' : 5, - 'AS_DROPPED' : 6, - 'AS_RECALLING' : 7 -}; -var partition_configuration = module.exports.partition_configuration = function(args) { - this.pid = null; - this.ballot = null; - this.max_replica_count = null; - this.primary = null; - this.secondaries = null; - this.last_drops = null; - this.last_committed_decree = null; - if (args) { - if (args.pid !== undefined && args.pid !== null) { - this.pid = new base_ttypes.gpid(args.pid); - } - if (args.ballot !== undefined && args.ballot !== null) { - this.ballot = args.ballot; - } - if (args.max_replica_count !== undefined && args.max_replica_count !== null) { - this.max_replica_count = args.max_replica_count; - } - if (args.primary !== undefined && args.primary !== null) { - this.primary = new base_ttypes.rpc_address(args.primary); - } - if (args.secondaries !== undefined && args.secondaries !== null) { - this.secondaries = Thrift.copyList(args.secondaries, [base_ttypes.rpc_address]); - } - if (args.last_drops !== undefined && args.last_drops !== null) { - this.last_drops = Thrift.copyList(args.last_drops, [base_ttypes.rpc_address]); - } - if (args.last_committed_decree !== undefined && args.last_committed_decree !== null) { - this.last_committed_decree = args.last_committed_decree; - } - } -}; -partition_configuration.prototype = {}; -partition_configuration.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.pid = new base_ttypes.gpid(); - this.pid.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I64) { - this.ballot = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.max_replica_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRUCT) { - this.primary = new base_ttypes.rpc_address(); - this.primary.read(input); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.LIST) { - var _size0 = 0; - var _rtmp34; - this.secondaries = []; - var _etype3 = 0; - _rtmp34 = input.readListBegin(); - _etype3 = _rtmp34.etype; - _size0 = _rtmp34.size; - for (var _i5 = 0; _i5 < _size0; ++_i5) - { - var elem6 = null; - elem6 = new base_ttypes.rpc_address(); - elem6.read(input); - this.secondaries.push(elem6); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.LIST) { - var _size7 = 0; - var _rtmp311; - this.last_drops = []; - var _etype10 = 0; - _rtmp311 = input.readListBegin(); - _etype10 = _rtmp311.etype; - _size7 = _rtmp311.size; - for (var _i12 = 0; _i12 < _size7; ++_i12) - { - var elem13 = null; - elem13 = new base_ttypes.rpc_address(); - elem13.read(input); - this.last_drops.push(elem13); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 7: - if (ftype == Thrift.Type.I64) { - this.last_committed_decree = input.readI64(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -partition_configuration.prototype.write = function(output) { - output.writeStructBegin('partition_configuration'); - if (this.pid !== null && this.pid !== undefined) { - output.writeFieldBegin('pid', Thrift.Type.STRUCT, 1); - this.pid.write(output); - output.writeFieldEnd(); - } - if (this.ballot !== null && this.ballot !== undefined) { - output.writeFieldBegin('ballot', Thrift.Type.I64, 2); - output.writeI64(this.ballot); - output.writeFieldEnd(); - } - if (this.max_replica_count !== null && this.max_replica_count !== undefined) { - output.writeFieldBegin('max_replica_count', Thrift.Type.I32, 3); - output.writeI32(this.max_replica_count); - output.writeFieldEnd(); - } - if (this.primary !== null && this.primary !== undefined) { - output.writeFieldBegin('primary', Thrift.Type.STRUCT, 4); - this.primary.write(output); - output.writeFieldEnd(); - } - if (this.secondaries !== null && this.secondaries !== undefined) { - output.writeFieldBegin('secondaries', Thrift.Type.LIST, 5); - output.writeListBegin(Thrift.Type.STRUCT, this.secondaries.length); - for (var iter14 in this.secondaries) - { - if (this.secondaries.hasOwnProperty(iter14)) - { - iter14 = this.secondaries[iter14]; - iter14.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.last_drops !== null && this.last_drops !== undefined) { - output.writeFieldBegin('last_drops', Thrift.Type.LIST, 6); - output.writeListBegin(Thrift.Type.STRUCT, this.last_drops.length); - for (var iter15 in this.last_drops) - { - if (this.last_drops.hasOwnProperty(iter15)) - { - iter15 = this.last_drops[iter15]; - iter15.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.last_committed_decree !== null && this.last_committed_decree !== undefined) { - output.writeFieldBegin('last_committed_decree', Thrift.Type.I64, 7); - output.writeI64(this.last_committed_decree); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var query_cfg_request = module.exports.query_cfg_request = function(args) { - this.app_name = null; - this.partition_indices = null; - if (args) { - if (args.app_name !== undefined && args.app_name !== null) { - this.app_name = args.app_name; - } - if (args.partition_indices !== undefined && args.partition_indices !== null) { - this.partition_indices = Thrift.copyList(args.partition_indices, [null]); - } - } -}; -query_cfg_request.prototype = {}; -query_cfg_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRING) { - this.app_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size16 = 0; - var _rtmp320; - this.partition_indices = []; - var _etype19 = 0; - _rtmp320 = input.readListBegin(); - _etype19 = _rtmp320.etype; - _size16 = _rtmp320.size; - for (var _i21 = 0; _i21 < _size16; ++_i21) - { - var elem22 = null; - elem22 = input.readI32(); - this.partition_indices.push(elem22); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -query_cfg_request.prototype.write = function(output) { - output.writeStructBegin('query_cfg_request'); - if (this.app_name !== null && this.app_name !== undefined) { - output.writeFieldBegin('app_name', Thrift.Type.STRING, 1); - output.writeString(this.app_name); - output.writeFieldEnd(); - } - if (this.partition_indices !== null && this.partition_indices !== undefined) { - output.writeFieldBegin('partition_indices', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.I32, this.partition_indices.length); - for (var iter23 in this.partition_indices) - { - if (this.partition_indices.hasOwnProperty(iter23)) - { - iter23 = this.partition_indices[iter23]; - output.writeI32(iter23); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var query_cfg_response = module.exports.query_cfg_response = function(args) { - this.err = null; - this.app_id = null; - this.partition_count = null; - this.is_stateful = null; - this.partitions = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_count !== undefined && args.partition_count !== null) { - this.partition_count = args.partition_count; - } - if (args.is_stateful !== undefined && args.is_stateful !== null) { - this.is_stateful = args.is_stateful; - } - if (args.partitions !== undefined && args.partitions !== null) { - this.partitions = Thrift.copyList(args.partitions, [ttypes.partition_configuration]); - } - } -}; -query_cfg_response.prototype = {}; -query_cfg_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.partition_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.BOOL) { - this.is_stateful = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.LIST) { - var _size24 = 0; - var _rtmp328; - this.partitions = []; - var _etype27 = 0; - _rtmp328 = input.readListBegin(); - _etype27 = _rtmp328.etype; - _size24 = _rtmp328.size; - for (var _i29 = 0; _i29 < _size24; ++_i29) - { - var elem30 = null; - elem30 = new ttypes.partition_configuration(); - elem30.read(input); - this.partitions.push(elem30); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -query_cfg_response.prototype.write = function(output) { - output.writeStructBegin('query_cfg_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 2); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_count !== null && this.partition_count !== undefined) { - output.writeFieldBegin('partition_count', Thrift.Type.I32, 3); - output.writeI32(this.partition_count); - output.writeFieldEnd(); - } - if (this.is_stateful !== null && this.is_stateful !== undefined) { - output.writeFieldBegin('is_stateful', Thrift.Type.BOOL, 4); - output.writeBool(this.is_stateful); - output.writeFieldEnd(); - } - if (this.partitions !== null && this.partitions !== undefined) { - output.writeFieldBegin('partitions', Thrift.Type.LIST, 5); - output.writeListBegin(Thrift.Type.STRUCT, this.partitions.length); - for (var iter31 in this.partitions) - { - if (this.partitions.hasOwnProperty(iter31)) - { - iter31 = this.partitions[iter31]; - iter31.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var app_info = module.exports.app_info = function(args) { - this.status = 0; - this.app_type = null; - this.app_name = null; - this.app_id = null; - this.partition_count = null; - this.envs = null; - this.is_stateful = null; - this.max_replica_count = null; - this.expire_second = null; - if (args) { - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - if (args.app_type !== undefined && args.app_type !== null) { - this.app_type = args.app_type; - } - if (args.app_name !== undefined && args.app_name !== null) { - this.app_name = args.app_name; - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_count !== undefined && args.partition_count !== null) { - this.partition_count = args.partition_count; - } - if (args.envs !== undefined && args.envs !== null) { - this.envs = Thrift.copyMap(args.envs, [null]); - } - if (args.is_stateful !== undefined && args.is_stateful !== null) { - this.is_stateful = args.is_stateful; - } - if (args.max_replica_count !== undefined && args.max_replica_count !== null) { - this.max_replica_count = args.max_replica_count; - } - if (args.expire_second !== undefined && args.expire_second !== null) { - this.expire_second = args.expire_second; - } - } -}; -app_info.prototype = {}; -app_info.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.app_type = input.readString(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.STRING) { - this.app_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I32) { - this.partition_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.MAP) { - var _size32 = 0; - var _rtmp336; - this.envs = {}; - var _ktype33 = 0; - var _vtype34 = 0; - _rtmp336 = input.readMapBegin(); - _ktype33 = _rtmp336.ktype; - _vtype34 = _rtmp336.vtype; - _size32 = _rtmp336.size; - for (var _i37 = 0; _i37 < _size32; ++_i37) - { - var key38 = null; - var val39 = null; - key38 = input.readString(); - val39 = input.readString(); - this.envs[key38] = val39; - } - input.readMapEnd(); - } else { - input.skip(ftype); - } - break; - case 7: - if (ftype == Thrift.Type.BOOL) { - this.is_stateful = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 8: - if (ftype == Thrift.Type.I32) { - this.max_replica_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 9: - if (ftype == Thrift.Type.I64) { - this.expire_second = input.readI64(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -app_info.prototype.write = function(output) { - output.writeStructBegin('app_info'); - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 1); - output.writeI32(this.status); - output.writeFieldEnd(); - } - if (this.app_type !== null && this.app_type !== undefined) { - output.writeFieldBegin('app_type', Thrift.Type.STRING, 2); - output.writeString(this.app_type); - output.writeFieldEnd(); - } - if (this.app_name !== null && this.app_name !== undefined) { - output.writeFieldBegin('app_name', Thrift.Type.STRING, 3); - output.writeString(this.app_name); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 4); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_count !== null && this.partition_count !== undefined) { - output.writeFieldBegin('partition_count', Thrift.Type.I32, 5); - output.writeI32(this.partition_count); - output.writeFieldEnd(); - } - if (this.envs !== null && this.envs !== undefined) { - output.writeFieldBegin('envs', Thrift.Type.MAP, 6); - output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.envs)); - for (var kiter40 in this.envs) - { - if (this.envs.hasOwnProperty(kiter40)) - { - var viter41 = this.envs[kiter40]; - output.writeString(kiter40); - output.writeString(viter41); - } - } - output.writeMapEnd(); - output.writeFieldEnd(); - } - if (this.is_stateful !== null && this.is_stateful !== undefined) { - output.writeFieldBegin('is_stateful', Thrift.Type.BOOL, 7); - output.writeBool(this.is_stateful); - output.writeFieldEnd(); - } - if (this.max_replica_count !== null && this.max_replica_count !== undefined) { - output.writeFieldBegin('max_replica_count', Thrift.Type.I32, 8); - output.writeI32(this.max_replica_count); - output.writeFieldEnd(); - } - if (this.expire_second !== null && this.expire_second !== undefined) { - output.writeFieldBegin('expire_second', Thrift.Type.I64, 9); - output.writeI64(this.expire_second); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var create_app_options = module.exports.create_app_options = function(args) { - this.partition_count = null; - this.replica_count = null; - this.success_if_exist = null; - this.app_type = null; - this.is_stateful = null; - this.envs = null; - if (args) { - if (args.partition_count !== undefined && args.partition_count !== null) { - this.partition_count = args.partition_count; - } - if (args.replica_count !== undefined && args.replica_count !== null) { - this.replica_count = args.replica_count; - } - if (args.success_if_exist !== undefined && args.success_if_exist !== null) { - this.success_if_exist = args.success_if_exist; - } - if (args.app_type !== undefined && args.app_type !== null) { - this.app_type = args.app_type; - } - if (args.is_stateful !== undefined && args.is_stateful !== null) { - this.is_stateful = args.is_stateful; - } - if (args.envs !== undefined && args.envs !== null) { - this.envs = Thrift.copyMap(args.envs, [null]); - } - } -}; -create_app_options.prototype = {}; -create_app_options.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.partition_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.replica_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.BOOL) { - this.success_if_exist = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.app_type = input.readString(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.BOOL) { - this.is_stateful = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.MAP) { - var _size42 = 0; - var _rtmp346; - this.envs = {}; - var _ktype43 = 0; - var _vtype44 = 0; - _rtmp346 = input.readMapBegin(); - _ktype43 = _rtmp346.ktype; - _vtype44 = _rtmp346.vtype; - _size42 = _rtmp346.size; - for (var _i47 = 0; _i47 < _size42; ++_i47) - { - var key48 = null; - var val49 = null; - key48 = input.readString(); - val49 = input.readString(); - this.envs[key48] = val49; - } - input.readMapEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -create_app_options.prototype.write = function(output) { - output.writeStructBegin('create_app_options'); - if (this.partition_count !== null && this.partition_count !== undefined) { - output.writeFieldBegin('partition_count', Thrift.Type.I32, 1); - output.writeI32(this.partition_count); - output.writeFieldEnd(); - } - if (this.replica_count !== null && this.replica_count !== undefined) { - output.writeFieldBegin('replica_count', Thrift.Type.I32, 2); - output.writeI32(this.replica_count); - output.writeFieldEnd(); - } - if (this.success_if_exist !== null && this.success_if_exist !== undefined) { - output.writeFieldBegin('success_if_exist', Thrift.Type.BOOL, 3); - output.writeBool(this.success_if_exist); - output.writeFieldEnd(); - } - if (this.app_type !== null && this.app_type !== undefined) { - output.writeFieldBegin('app_type', Thrift.Type.STRING, 4); - output.writeString(this.app_type); - output.writeFieldEnd(); - } - if (this.is_stateful !== null && this.is_stateful !== undefined) { - output.writeFieldBegin('is_stateful', Thrift.Type.BOOL, 5); - output.writeBool(this.is_stateful); - output.writeFieldEnd(); - } - if (this.envs !== null && this.envs !== undefined) { - output.writeFieldBegin('envs', Thrift.Type.MAP, 6); - output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.envs)); - for (var kiter50 in this.envs) - { - if (this.envs.hasOwnProperty(kiter50)) - { - var viter51 = this.envs[kiter50]; - output.writeString(kiter50); - output.writeString(viter51); - } - } - output.writeMapEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_create_app_request = module.exports.configuration_create_app_request = function(args) { - this.app_name = null; - this.options = null; - if (args) { - if (args.app_name !== undefined && args.app_name !== null) { - this.app_name = args.app_name; - } - if (args.options !== undefined && args.options !== null) { - this.options = new ttypes.create_app_options(args.options); - } - } -}; -configuration_create_app_request.prototype = {}; -configuration_create_app_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRING) { - this.app_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.options = new ttypes.create_app_options(); - this.options.read(input); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_create_app_request.prototype.write = function(output) { - output.writeStructBegin('configuration_create_app_request'); - if (this.app_name !== null && this.app_name !== undefined) { - output.writeFieldBegin('app_name', Thrift.Type.STRING, 1); - output.writeString(this.app_name); - output.writeFieldEnd(); - } - if (this.options !== null && this.options !== undefined) { - output.writeFieldBegin('options', Thrift.Type.STRUCT, 2); - this.options.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_create_app_response = module.exports.configuration_create_app_response = function(args) { - this.err = null; - this.appid = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.appid !== undefined && args.appid !== null) { - this.appid = args.appid; - } - } -}; -configuration_create_app_response.prototype = {}; -configuration_create_app_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.appid = input.readI32(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_create_app_response.prototype.write = function(output) { - output.writeStructBegin('configuration_create_app_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.appid !== null && this.appid !== undefined) { - output.writeFieldBegin('appid', Thrift.Type.I32, 2); - output.writeI32(this.appid); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var drop_app_options = module.exports.drop_app_options = function(args) { - this.success_if_not_exist = null; - this.reserve_seconds = null; - if (args) { - if (args.success_if_not_exist !== undefined && args.success_if_not_exist !== null) { - this.success_if_not_exist = args.success_if_not_exist; - } - if (args.reserve_seconds !== undefined && args.reserve_seconds !== null) { - this.reserve_seconds = args.reserve_seconds; - } - } -}; -drop_app_options.prototype = {}; -drop_app_options.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.BOOL) { - this.success_if_not_exist = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I64) { - this.reserve_seconds = input.readI64(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -drop_app_options.prototype.write = function(output) { - output.writeStructBegin('drop_app_options'); - if (this.success_if_not_exist !== null && this.success_if_not_exist !== undefined) { - output.writeFieldBegin('success_if_not_exist', Thrift.Type.BOOL, 1); - output.writeBool(this.success_if_not_exist); - output.writeFieldEnd(); - } - if (this.reserve_seconds !== null && this.reserve_seconds !== undefined) { - output.writeFieldBegin('reserve_seconds', Thrift.Type.I64, 2); - output.writeI64(this.reserve_seconds); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_drop_app_request = module.exports.configuration_drop_app_request = function(args) { - this.app_name = null; - this.options = null; - if (args) { - if (args.app_name !== undefined && args.app_name !== null) { - this.app_name = args.app_name; - } - if (args.options !== undefined && args.options !== null) { - this.options = new ttypes.drop_app_options(args.options); - } - } -}; -configuration_drop_app_request.prototype = {}; -configuration_drop_app_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRING) { - this.app_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.options = new ttypes.drop_app_options(); - this.options.read(input); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_drop_app_request.prototype.write = function(output) { - output.writeStructBegin('configuration_drop_app_request'); - if (this.app_name !== null && this.app_name !== undefined) { - output.writeFieldBegin('app_name', Thrift.Type.STRING, 1); - output.writeString(this.app_name); - output.writeFieldEnd(); - } - if (this.options !== null && this.options !== undefined) { - output.writeFieldBegin('options', Thrift.Type.STRUCT, 2); - this.options.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_drop_app_response = module.exports.configuration_drop_app_response = function(args) { - this.err = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - } -}; -configuration_drop_app_response.prototype = {}; -configuration_drop_app_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_drop_app_response.prototype.write = function(output) { - output.writeStructBegin('configuration_drop_app_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_recall_app_request = module.exports.configuration_recall_app_request = function(args) { - this.app_id = null; - this.new_app_name = null; - if (args) { - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.new_app_name !== undefined && args.new_app_name !== null) { - this.new_app_name = args.new_app_name; - } - } -}; -configuration_recall_app_request.prototype = {}; -configuration_recall_app_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.new_app_name = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_recall_app_request.prototype.write = function(output) { - output.writeStructBegin('configuration_recall_app_request'); - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 1); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.new_app_name !== null && this.new_app_name !== undefined) { - output.writeFieldBegin('new_app_name', Thrift.Type.STRING, 2); - output.writeString(this.new_app_name); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_recall_app_response = module.exports.configuration_recall_app_response = function(args) { - this.err = null; - this.info = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.info !== undefined && args.info !== null) { - this.info = new ttypes.app_info(args.info); - } - } -}; -configuration_recall_app_response.prototype = {}; -configuration_recall_app_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.info = new ttypes.app_info(); - this.info.read(input); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_recall_app_response.prototype.write = function(output) { - output.writeStructBegin('configuration_recall_app_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.info !== null && this.info !== undefined) { - output.writeFieldBegin('info', Thrift.Type.STRUCT, 2); - this.info.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_modify_backup_policy_request = module.exports.configuration_modify_backup_policy_request = function(args) { - this.policy_name = null; - this.add_appids = null; - this.removal_appids = null; - this.new_backup_interval_sec = null; - this.backup_history_count_to_keep = null; - this.is_disable = null; - this.start_time = null; - if (args) { - if (args.policy_name !== undefined && args.policy_name !== null) { - this.policy_name = args.policy_name; - } - if (args.add_appids !== undefined && args.add_appids !== null) { - this.add_appids = Thrift.copyList(args.add_appids, [null]); - } - if (args.removal_appids !== undefined && args.removal_appids !== null) { - this.removal_appids = Thrift.copyList(args.removal_appids, [null]); - } - if (args.new_backup_interval_sec !== undefined && args.new_backup_interval_sec !== null) { - this.new_backup_interval_sec = args.new_backup_interval_sec; - } - if (args.backup_history_count_to_keep !== undefined && args.backup_history_count_to_keep !== null) { - this.backup_history_count_to_keep = args.backup_history_count_to_keep; - } - if (args.is_disable !== undefined && args.is_disable !== null) { - this.is_disable = args.is_disable; - } - if (args.start_time !== undefined && args.start_time !== null) { - this.start_time = args.start_time; - } - } -}; -configuration_modify_backup_policy_request.prototype = {}; -configuration_modify_backup_policy_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRING) { - this.policy_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size52 = 0; - var _rtmp356; - this.add_appids = []; - var _etype55 = 0; - _rtmp356 = input.readListBegin(); - _etype55 = _rtmp356.etype; - _size52 = _rtmp356.size; - for (var _i57 = 0; _i57 < _size52; ++_i57) - { - var elem58 = null; - elem58 = input.readI32(); - this.add_appids.push(elem58); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.LIST) { - var _size59 = 0; - var _rtmp363; - this.removal_appids = []; - var _etype62 = 0; - _rtmp363 = input.readListBegin(); - _etype62 = _rtmp363.etype; - _size59 = _rtmp363.size; - for (var _i64 = 0; _i64 < _size59; ++_i64) - { - var elem65 = null; - elem65 = input.readI32(); - this.removal_appids.push(elem65); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I64) { - this.new_backup_interval_sec = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I32) { - this.backup_history_count_to_keep = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.BOOL) { - this.is_disable = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 7: - if (ftype == Thrift.Type.STRING) { - this.start_time = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_modify_backup_policy_request.prototype.write = function(output) { - output.writeStructBegin('configuration_modify_backup_policy_request'); - if (this.policy_name !== null && this.policy_name !== undefined) { - output.writeFieldBegin('policy_name', Thrift.Type.STRING, 1); - output.writeString(this.policy_name); - output.writeFieldEnd(); - } - if (this.add_appids !== null && this.add_appids !== undefined) { - output.writeFieldBegin('add_appids', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.I32, this.add_appids.length); - for (var iter66 in this.add_appids) - { - if (this.add_appids.hasOwnProperty(iter66)) - { - iter66 = this.add_appids[iter66]; - output.writeI32(iter66); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.removal_appids !== null && this.removal_appids !== undefined) { - output.writeFieldBegin('removal_appids', Thrift.Type.LIST, 3); - output.writeListBegin(Thrift.Type.I32, this.removal_appids.length); - for (var iter67 in this.removal_appids) - { - if (this.removal_appids.hasOwnProperty(iter67)) - { - iter67 = this.removal_appids[iter67]; - output.writeI32(iter67); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.new_backup_interval_sec !== null && this.new_backup_interval_sec !== undefined) { - output.writeFieldBegin('new_backup_interval_sec', Thrift.Type.I64, 4); - output.writeI64(this.new_backup_interval_sec); - output.writeFieldEnd(); - } - if (this.backup_history_count_to_keep !== null && this.backup_history_count_to_keep !== undefined) { - output.writeFieldBegin('backup_history_count_to_keep', Thrift.Type.I32, 5); - output.writeI32(this.backup_history_count_to_keep); - output.writeFieldEnd(); - } - if (this.is_disable !== null && this.is_disable !== undefined) { - output.writeFieldBegin('is_disable', Thrift.Type.BOOL, 6); - output.writeBool(this.is_disable); - output.writeFieldEnd(); - } - if (this.start_time !== null && this.start_time !== undefined) { - output.writeFieldBegin('start_time', Thrift.Type.STRING, 7); - output.writeString(this.start_time); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_modify_backup_policy_response = module.exports.configuration_modify_backup_policy_response = function(args) { - this.err = null; - this.hint_message = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.hint_message !== undefined && args.hint_message !== null) { - this.hint_message = args.hint_message; - } - } -}; -configuration_modify_backup_policy_response.prototype = {}; -configuration_modify_backup_policy_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.hint_message = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_modify_backup_policy_response.prototype.write = function(output) { - output.writeStructBegin('configuration_modify_backup_policy_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.hint_message !== null && this.hint_message !== undefined) { - output.writeFieldBegin('hint_message', Thrift.Type.STRING, 2); - output.writeString(this.hint_message); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_add_backup_policy_request = module.exports.configuration_add_backup_policy_request = function(args) { - this.backup_provider_type = null; - this.policy_name = null; - this.app_ids = null; - this.backup_interval_seconds = null; - this.backup_history_count_to_keep = null; - this.start_time = null; - if (args) { - if (args.backup_provider_type !== undefined && args.backup_provider_type !== null) { - this.backup_provider_type = args.backup_provider_type; - } - if (args.policy_name !== undefined && args.policy_name !== null) { - this.policy_name = args.policy_name; - } - if (args.app_ids !== undefined && args.app_ids !== null) { - this.app_ids = Thrift.copyList(args.app_ids, [null]); - } - if (args.backup_interval_seconds !== undefined && args.backup_interval_seconds !== null) { - this.backup_interval_seconds = args.backup_interval_seconds; - } - if (args.backup_history_count_to_keep !== undefined && args.backup_history_count_to_keep !== null) { - this.backup_history_count_to_keep = args.backup_history_count_to_keep; - } - if (args.start_time !== undefined && args.start_time !== null) { - this.start_time = args.start_time; - } - } -}; -configuration_add_backup_policy_request.prototype = {}; -configuration_add_backup_policy_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRING) { - this.backup_provider_type = input.readString(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.policy_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.LIST) { - var _size68 = 0; - var _rtmp372; - this.app_ids = []; - var _etype71 = 0; - _rtmp372 = input.readListBegin(); - _etype71 = _rtmp372.etype; - _size68 = _rtmp372.size; - for (var _i73 = 0; _i73 < _size68; ++_i73) - { - var elem74 = null; - elem74 = input.readI32(); - this.app_ids.push(elem74); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I64) { - this.backup_interval_seconds = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I32) { - this.backup_history_count_to_keep = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.start_time = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_add_backup_policy_request.prototype.write = function(output) { - output.writeStructBegin('configuration_add_backup_policy_request'); - if (this.backup_provider_type !== null && this.backup_provider_type !== undefined) { - output.writeFieldBegin('backup_provider_type', Thrift.Type.STRING, 1); - output.writeString(this.backup_provider_type); - output.writeFieldEnd(); - } - if (this.policy_name !== null && this.policy_name !== undefined) { - output.writeFieldBegin('policy_name', Thrift.Type.STRING, 2); - output.writeString(this.policy_name); - output.writeFieldEnd(); - } - if (this.app_ids !== null && this.app_ids !== undefined) { - output.writeFieldBegin('app_ids', Thrift.Type.LIST, 3); - output.writeListBegin(Thrift.Type.I32, this.app_ids.length); - for (var iter75 in this.app_ids) - { - if (this.app_ids.hasOwnProperty(iter75)) - { - iter75 = this.app_ids[iter75]; - output.writeI32(iter75); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.backup_interval_seconds !== null && this.backup_interval_seconds !== undefined) { - output.writeFieldBegin('backup_interval_seconds', Thrift.Type.I64, 4); - output.writeI64(this.backup_interval_seconds); - output.writeFieldEnd(); - } - if (this.backup_history_count_to_keep !== null && this.backup_history_count_to_keep !== undefined) { - output.writeFieldBegin('backup_history_count_to_keep', Thrift.Type.I32, 5); - output.writeI32(this.backup_history_count_to_keep); - output.writeFieldEnd(); - } - if (this.start_time !== null && this.start_time !== undefined) { - output.writeFieldBegin('start_time', Thrift.Type.STRING, 6); - output.writeString(this.start_time); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_add_backup_policy_response = module.exports.configuration_add_backup_policy_response = function(args) { - this.err = null; - this.hint_message = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.hint_message !== undefined && args.hint_message !== null) { - this.hint_message = args.hint_message; - } - } -}; -configuration_add_backup_policy_response.prototype = {}; -configuration_add_backup_policy_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.hint_message = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_add_backup_policy_response.prototype.write = function(output) { - output.writeStructBegin('configuration_add_backup_policy_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.hint_message !== null && this.hint_message !== undefined) { - output.writeFieldBegin('hint_message', Thrift.Type.STRING, 2); - output.writeString(this.hint_message); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var policy_entry = module.exports.policy_entry = function(args) { - this.policy_name = null; - this.backup_provider_type = null; - this.backup_interval_seconds = null; - this.app_ids = null; - this.backup_history_count_to_keep = null; - this.start_time = null; - this.is_disable = null; - if (args) { - if (args.policy_name !== undefined && args.policy_name !== null) { - this.policy_name = args.policy_name; - } - if (args.backup_provider_type !== undefined && args.backup_provider_type !== null) { - this.backup_provider_type = args.backup_provider_type; - } - if (args.backup_interval_seconds !== undefined && args.backup_interval_seconds !== null) { - this.backup_interval_seconds = args.backup_interval_seconds; - } - if (args.app_ids !== undefined && args.app_ids !== null) { - this.app_ids = Thrift.copyList(args.app_ids, [null]); - } - if (args.backup_history_count_to_keep !== undefined && args.backup_history_count_to_keep !== null) { - this.backup_history_count_to_keep = args.backup_history_count_to_keep; - } - if (args.start_time !== undefined && args.start_time !== null) { - this.start_time = args.start_time; - } - if (args.is_disable !== undefined && args.is_disable !== null) { - this.is_disable = args.is_disable; - } - } -}; -policy_entry.prototype = {}; -policy_entry.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRING) { - this.policy_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.backup_provider_type = input.readString(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.STRING) { - this.backup_interval_seconds = input.readString(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.SET) { - var _size76 = 0; - var _rtmp380; - this.app_ids = []; - var _etype79 = 0; - _rtmp380 = input.readSetBegin(); - _etype79 = _rtmp380.etype; - _size76 = _rtmp380.size; - for (var _i81 = 0; _i81 < _size76; ++_i81) - { - var elem82 = null; - elem82 = input.readI32(); - this.app_ids.push(elem82); - } - input.readSetEnd(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I32) { - this.backup_history_count_to_keep = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.start_time = input.readString(); - } else { - input.skip(ftype); - } - break; - case 7: - if (ftype == Thrift.Type.BOOL) { - this.is_disable = input.readBool(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -policy_entry.prototype.write = function(output) { - output.writeStructBegin('policy_entry'); - if (this.policy_name !== null && this.policy_name !== undefined) { - output.writeFieldBegin('policy_name', Thrift.Type.STRING, 1); - output.writeString(this.policy_name); - output.writeFieldEnd(); - } - if (this.backup_provider_type !== null && this.backup_provider_type !== undefined) { - output.writeFieldBegin('backup_provider_type', Thrift.Type.STRING, 2); - output.writeString(this.backup_provider_type); - output.writeFieldEnd(); - } - if (this.backup_interval_seconds !== null && this.backup_interval_seconds !== undefined) { - output.writeFieldBegin('backup_interval_seconds', Thrift.Type.STRING, 3); - output.writeString(this.backup_interval_seconds); - output.writeFieldEnd(); - } - if (this.app_ids !== null && this.app_ids !== undefined) { - output.writeFieldBegin('app_ids', Thrift.Type.SET, 4); - output.writeSetBegin(Thrift.Type.I32, this.app_ids.length); - for (var iter83 in this.app_ids) - { - if (this.app_ids.hasOwnProperty(iter83)) - { - iter83 = this.app_ids[iter83]; - output.writeI32(iter83); - } - } - output.writeSetEnd(); - output.writeFieldEnd(); - } - if (this.backup_history_count_to_keep !== null && this.backup_history_count_to_keep !== undefined) { - output.writeFieldBegin('backup_history_count_to_keep', Thrift.Type.I32, 5); - output.writeI32(this.backup_history_count_to_keep); - output.writeFieldEnd(); - } - if (this.start_time !== null && this.start_time !== undefined) { - output.writeFieldBegin('start_time', Thrift.Type.STRING, 6); - output.writeString(this.start_time); - output.writeFieldEnd(); - } - if (this.is_disable !== null && this.is_disable !== undefined) { - output.writeFieldBegin('is_disable', Thrift.Type.BOOL, 7); - output.writeBool(this.is_disable); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var backup_entry = module.exports.backup_entry = function(args) { - this.backup_id = null; - this.start_time_ms = null; - this.end_time_ms = null; - this.app_ids = null; - if (args) { - if (args.backup_id !== undefined && args.backup_id !== null) { - this.backup_id = args.backup_id; - } - if (args.start_time_ms !== undefined && args.start_time_ms !== null) { - this.start_time_ms = args.start_time_ms; - } - if (args.end_time_ms !== undefined && args.end_time_ms !== null) { - this.end_time_ms = args.end_time_ms; - } - if (args.app_ids !== undefined && args.app_ids !== null) { - this.app_ids = Thrift.copyList(args.app_ids, [null]); - } - } -}; -backup_entry.prototype = {}; -backup_entry.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I64) { - this.backup_id = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I64) { - this.start_time_ms = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I64) { - this.end_time_ms = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.SET) { - var _size84 = 0; - var _rtmp388; - this.app_ids = []; - var _etype87 = 0; - _rtmp388 = input.readSetBegin(); - _etype87 = _rtmp388.etype; - _size84 = _rtmp388.size; - for (var _i89 = 0; _i89 < _size84; ++_i89) - { - var elem90 = null; - elem90 = input.readI32(); - this.app_ids.push(elem90); - } - input.readSetEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -backup_entry.prototype.write = function(output) { - output.writeStructBegin('backup_entry'); - if (this.backup_id !== null && this.backup_id !== undefined) { - output.writeFieldBegin('backup_id', Thrift.Type.I64, 1); - output.writeI64(this.backup_id); - output.writeFieldEnd(); - } - if (this.start_time_ms !== null && this.start_time_ms !== undefined) { - output.writeFieldBegin('start_time_ms', Thrift.Type.I64, 2); - output.writeI64(this.start_time_ms); - output.writeFieldEnd(); - } - if (this.end_time_ms !== null && this.end_time_ms !== undefined) { - output.writeFieldBegin('end_time_ms', Thrift.Type.I64, 3); - output.writeI64(this.end_time_ms); - output.writeFieldEnd(); - } - if (this.app_ids !== null && this.app_ids !== undefined) { - output.writeFieldBegin('app_ids', Thrift.Type.SET, 4); - output.writeSetBegin(Thrift.Type.I32, this.app_ids.length); - for (var iter91 in this.app_ids) - { - if (this.app_ids.hasOwnProperty(iter91)) - { - iter91 = this.app_ids[iter91]; - output.writeI32(iter91); - } - } - output.writeSetEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_query_backup_policy_request = module.exports.configuration_query_backup_policy_request = function(args) { - this.policy_names = null; - this.backup_info_count = null; - if (args) { - if (args.policy_names !== undefined && args.policy_names !== null) { - this.policy_names = Thrift.copyList(args.policy_names, [null]); - } - if (args.backup_info_count !== undefined && args.backup_info_count !== null) { - this.backup_info_count = args.backup_info_count; - } - } -}; -configuration_query_backup_policy_request.prototype = {}; -configuration_query_backup_policy_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.LIST) { - var _size92 = 0; - var _rtmp396; - this.policy_names = []; - var _etype95 = 0; - _rtmp396 = input.readListBegin(); - _etype95 = _rtmp396.etype; - _size92 = _rtmp396.size; - for (var _i97 = 0; _i97 < _size92; ++_i97) - { - var elem98 = null; - elem98 = input.readString(); - this.policy_names.push(elem98); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.backup_info_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_query_backup_policy_request.prototype.write = function(output) { - output.writeStructBegin('configuration_query_backup_policy_request'); - if (this.policy_names !== null && this.policy_names !== undefined) { - output.writeFieldBegin('policy_names', Thrift.Type.LIST, 1); - output.writeListBegin(Thrift.Type.STRING, this.policy_names.length); - for (var iter99 in this.policy_names) - { - if (this.policy_names.hasOwnProperty(iter99)) - { - iter99 = this.policy_names[iter99]; - output.writeString(iter99); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.backup_info_count !== null && this.backup_info_count !== undefined) { - output.writeFieldBegin('backup_info_count', Thrift.Type.I32, 2); - output.writeI32(this.backup_info_count); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_query_backup_policy_response = module.exports.configuration_query_backup_policy_response = function(args) { - this.err = null; - this.policys = null; - this.backup_infos = null; - this.hint_msg = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.policys !== undefined && args.policys !== null) { - this.policys = Thrift.copyList(args.policys, [ttypes.policy_entry]); - } - if (args.backup_infos !== undefined && args.backup_infos !== null) { - this.backup_infos = Thrift.copyList(args.backup_infos, [Thrift.copyList, ttypes.backup_entry]); - } - if (args.hint_msg !== undefined && args.hint_msg !== null) { - this.hint_msg = args.hint_msg; - } - } -}; -configuration_query_backup_policy_response.prototype = {}; -configuration_query_backup_policy_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size100 = 0; - var _rtmp3104; - this.policys = []; - var _etype103 = 0; - _rtmp3104 = input.readListBegin(); - _etype103 = _rtmp3104.etype; - _size100 = _rtmp3104.size; - for (var _i105 = 0; _i105 < _size100; ++_i105) - { - var elem106 = null; - elem106 = new ttypes.policy_entry(); - elem106.read(input); - this.policys.push(elem106); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.LIST) { - var _size107 = 0; - var _rtmp3111; - this.backup_infos = []; - var _etype110 = 0; - _rtmp3111 = input.readListBegin(); - _etype110 = _rtmp3111.etype; - _size107 = _rtmp3111.size; - for (var _i112 = 0; _i112 < _size107; ++_i112) - { - var elem113 = null; - var _size114 = 0; - var _rtmp3118; - elem113 = []; - var _etype117 = 0; - _rtmp3118 = input.readListBegin(); - _etype117 = _rtmp3118.etype; - _size114 = _rtmp3118.size; - for (var _i119 = 0; _i119 < _size114; ++_i119) - { - var elem120 = null; - elem120 = new ttypes.backup_entry(); - elem120.read(input); - elem113.push(elem120); - } - input.readListEnd(); - this.backup_infos.push(elem113); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.hint_msg = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_query_backup_policy_response.prototype.write = function(output) { - output.writeStructBegin('configuration_query_backup_policy_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.policys !== null && this.policys !== undefined) { - output.writeFieldBegin('policys', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.policys.length); - for (var iter121 in this.policys) - { - if (this.policys.hasOwnProperty(iter121)) - { - iter121 = this.policys[iter121]; - iter121.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.backup_infos !== null && this.backup_infos !== undefined) { - output.writeFieldBegin('backup_infos', Thrift.Type.LIST, 3); - output.writeListBegin(Thrift.Type.LIST, this.backup_infos.length); - for (var iter122 in this.backup_infos) - { - if (this.backup_infos.hasOwnProperty(iter122)) - { - iter122 = this.backup_infos[iter122]; - output.writeListBegin(Thrift.Type.STRUCT, iter122.length); - for (var iter123 in iter122) - { - if (iter122.hasOwnProperty(iter123)) - { - iter123 = iter122[iter123]; - iter123.write(output); - } - } - output.writeListEnd(); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.hint_msg !== null && this.hint_msg !== undefined) { - output.writeFieldBegin('hint_msg', Thrift.Type.STRING, 4); - output.writeString(this.hint_msg); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_restore_request = module.exports.configuration_restore_request = function(args) { - this.cluster_name = null; - this.policy_name = null; - this.time_stamp = null; - this.app_name = null; - this.app_id = null; - this.new_app_name = null; - this.backup_provider_name = null; - this.skip_bad_partition = null; - if (args) { - if (args.cluster_name !== undefined && args.cluster_name !== null) { - this.cluster_name = args.cluster_name; - } - if (args.policy_name !== undefined && args.policy_name !== null) { - this.policy_name = args.policy_name; - } - if (args.time_stamp !== undefined && args.time_stamp !== null) { - this.time_stamp = args.time_stamp; - } - if (args.app_name !== undefined && args.app_name !== null) { - this.app_name = args.app_name; - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.new_app_name !== undefined && args.new_app_name !== null) { - this.new_app_name = args.new_app_name; - } - if (args.backup_provider_name !== undefined && args.backup_provider_name !== null) { - this.backup_provider_name = args.backup_provider_name; - } - if (args.skip_bad_partition !== undefined && args.skip_bad_partition !== null) { - this.skip_bad_partition = args.skip_bad_partition; - } - } -}; -configuration_restore_request.prototype = {}; -configuration_restore_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRING) { - this.cluster_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.policy_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I64) { - this.time_stamp = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.app_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.new_app_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 7: - if (ftype == Thrift.Type.STRING) { - this.backup_provider_name = input.readString(); - } else { - input.skip(ftype); - } - break; - case 8: - if (ftype == Thrift.Type.BOOL) { - this.skip_bad_partition = input.readBool(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_restore_request.prototype.write = function(output) { - output.writeStructBegin('configuration_restore_request'); - if (this.cluster_name !== null && this.cluster_name !== undefined) { - output.writeFieldBegin('cluster_name', Thrift.Type.STRING, 1); - output.writeString(this.cluster_name); - output.writeFieldEnd(); - } - if (this.policy_name !== null && this.policy_name !== undefined) { - output.writeFieldBegin('policy_name', Thrift.Type.STRING, 2); - output.writeString(this.policy_name); - output.writeFieldEnd(); - } - if (this.time_stamp !== null && this.time_stamp !== undefined) { - output.writeFieldBegin('time_stamp', Thrift.Type.I64, 3); - output.writeI64(this.time_stamp); - output.writeFieldEnd(); - } - if (this.app_name !== null && this.app_name !== undefined) { - output.writeFieldBegin('app_name', Thrift.Type.STRING, 4); - output.writeString(this.app_name); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 5); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.new_app_name !== null && this.new_app_name !== undefined) { - output.writeFieldBegin('new_app_name', Thrift.Type.STRING, 6); - output.writeString(this.new_app_name); - output.writeFieldEnd(); - } - if (this.backup_provider_name !== null && this.backup_provider_name !== undefined) { - output.writeFieldBegin('backup_provider_name', Thrift.Type.STRING, 7); - output.writeString(this.backup_provider_name); - output.writeFieldEnd(); - } - if (this.skip_bad_partition !== null && this.skip_bad_partition !== undefined) { - output.writeFieldBegin('skip_bad_partition', Thrift.Type.BOOL, 8); - output.writeBool(this.skip_bad_partition); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_query_restore_request = module.exports.configuration_query_restore_request = function(args) { - this.restore_app_id = null; - if (args) { - if (args.restore_app_id !== undefined && args.restore_app_id !== null) { - this.restore_app_id = args.restore_app_id; - } - } -}; -configuration_query_restore_request.prototype = {}; -configuration_query_restore_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.restore_app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_query_restore_request.prototype.write = function(output) { - output.writeStructBegin('configuration_query_restore_request'); - if (this.restore_app_id !== null && this.restore_app_id !== undefined) { - output.writeFieldBegin('restore_app_id', Thrift.Type.I32, 1); - output.writeI32(this.restore_app_id); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_query_restore_response = module.exports.configuration_query_restore_response = function(args) { - this.err = null; - this.restore_status = null; - this.restore_progress = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.restore_status !== undefined && args.restore_status !== null) { - this.restore_status = Thrift.copyList(args.restore_status, [base_ttypes.error_code]); - } - if (args.restore_progress !== undefined && args.restore_progress !== null) { - this.restore_progress = Thrift.copyList(args.restore_progress, [null]); - } - } -}; -configuration_query_restore_response.prototype = {}; -configuration_query_restore_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size124 = 0; - var _rtmp3128; - this.restore_status = []; - var _etype127 = 0; - _rtmp3128 = input.readListBegin(); - _etype127 = _rtmp3128.etype; - _size124 = _rtmp3128.size; - for (var _i129 = 0; _i129 < _size124; ++_i129) - { - var elem130 = null; - elem130 = new base_ttypes.error_code(); - elem130.read(input); - this.restore_status.push(elem130); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.LIST) { - var _size131 = 0; - var _rtmp3135; - this.restore_progress = []; - var _etype134 = 0; - _rtmp3135 = input.readListBegin(); - _etype134 = _rtmp3135.etype; - _size131 = _rtmp3135.size; - for (var _i136 = 0; _i136 < _size131; ++_i136) - { - var elem137 = null; - elem137 = input.readI32(); - this.restore_progress.push(elem137); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_query_restore_response.prototype.write = function(output) { - output.writeStructBegin('configuration_query_restore_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.restore_status !== null && this.restore_status !== undefined) { - output.writeFieldBegin('restore_status', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.restore_status.length); - for (var iter138 in this.restore_status) - { - if (this.restore_status.hasOwnProperty(iter138)) - { - iter138 = this.restore_status[iter138]; - iter138.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.restore_progress !== null && this.restore_progress !== undefined) { - output.writeFieldBegin('restore_progress', Thrift.Type.LIST, 3); - output.writeListBegin(Thrift.Type.I32, this.restore_progress.length); - for (var iter139 in this.restore_progress) - { - if (this.restore_progress.hasOwnProperty(iter139)) - { - iter139 = this.restore_progress[iter139]; - output.writeI32(iter139); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_list_apps_request = module.exports.configuration_list_apps_request = function(args) { - this.status = 0; - if (args) { - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - } -}; -configuration_list_apps_request.prototype = {}; -configuration_list_apps_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_list_apps_request.prototype.write = function(output) { - output.writeStructBegin('configuration_list_apps_request'); - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 1); - output.writeI32(this.status); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var configuration_list_apps_response = module.exports.configuration_list_apps_response = function(args) { - this.err = null; - this.infos = null; - if (args) { - if (args.err !== undefined && args.err !== null) { - this.err = new base_ttypes.error_code(args.err); - } - if (args.infos !== undefined && args.infos !== null) { - this.infos = Thrift.copyList(args.infos, [ttypes.app_info]); - } - } -}; -configuration_list_apps_response.prototype = {}; -configuration_list_apps_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.err = new base_ttypes.error_code(); - this.err.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size140 = 0; - var _rtmp3144; - this.infos = []; - var _etype143 = 0; - _rtmp3144 = input.readListBegin(); - _etype143 = _rtmp3144.etype; - _size140 = _rtmp3144.size; - for (var _i145 = 0; _i145 < _size140; ++_i145) - { - var elem146 = null; - elem146 = new ttypes.app_info(); - elem146.read(input); - this.infos.push(elem146); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -configuration_list_apps_response.prototype.write = function(output) { - output.writeStructBegin('configuration_list_apps_response'); - if (this.err !== null && this.err !== undefined) { - output.writeFieldBegin('err', Thrift.Type.STRUCT, 1); - this.err.write(output); - output.writeFieldEnd(); - } - if (this.infos !== null && this.infos !== undefined) { - output.writeFieldBegin('infos', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.infos.length); - for (var iter147 in this.infos) - { - if (this.infos.hasOwnProperty(iter147)) - { - iter147 = this.infos[iter147]; - iter147.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - diff --git a/nodejs-client/src/dsn/rrdb.js b/nodejs-client/src/dsn/rrdb.js deleted file mode 100644 index 7fdd5341db..0000000000 --- a/nodejs-client/src/dsn/rrdb.js +++ /dev/null @@ -1,2072 +0,0 @@ -// -// Autogenerated by Thrift Compiler (0.10.0) -// -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -// -"use strict"; - -var thrift = require('thrift'); -var Thrift = thrift.Thrift; -var Q = thrift.Q; - -var base_ttypes = require('./base_types'); -var replication_ttypes = require('./replication_types'); - - -var ttypes = require('./rrdb_types'); -//HELPER FUNCTIONS AND STRUCTURES - -var rrdb_put_args = module.exports.rrdb_put_args = function(args) { - this.update = null; - if (args) { - if (args.update !== undefined && args.update !== null) { - this.update = new ttypes.update_request(args.update); - } - } -}; -rrdb_put_args.prototype = {}; -rrdb_put_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.update = new ttypes.update_request(); - this.update.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_put_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_put_args'); - if (this.update !== null && this.update !== undefined) { - output.writeFieldBegin('update', Thrift.Type.STRUCT, 1); - this.update.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_put_result = module.exports.rrdb_put_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.update_response(args.success); - } - } -}; -rrdb_put_result.prototype = {}; -rrdb_put_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.update_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_put_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_put_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_multi_put_args = module.exports.rrdb_multi_put_args = function(args) { - this.request = null; - if (args) { - if (args.request !== undefined && args.request !== null) { - this.request = new ttypes.multi_put_request(args.request); - } - } -}; -rrdb_multi_put_args.prototype = {}; -rrdb_multi_put_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.request = new ttypes.multi_put_request(); - this.request.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_multi_put_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_multi_put_args'); - if (this.request !== null && this.request !== undefined) { - output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); - this.request.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_multi_put_result = module.exports.rrdb_multi_put_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.update_response(args.success); - } - } -}; -rrdb_multi_put_result.prototype = {}; -rrdb_multi_put_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.update_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_multi_put_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_multi_put_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_remove_args = module.exports.rrdb_remove_args = function(args) { - this.key = null; - if (args) { - if (args.key !== undefined && args.key !== null) { - this.key = new base_ttypes.blob(args.key); - } - } -}; -rrdb_remove_args.prototype = {}; -rrdb_remove_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.key = new base_ttypes.blob(); - this.key.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_remove_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_remove_args'); - if (this.key !== null && this.key !== undefined) { - output.writeFieldBegin('key', Thrift.Type.STRUCT, 1); - this.key.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_remove_result = module.exports.rrdb_remove_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.update_response(args.success); - } - } -}; -rrdb_remove_result.prototype = {}; -rrdb_remove_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.update_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_remove_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_remove_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_multi_remove_args = function(args) { - this.request = null; - if (args) { - if (args.request !== undefined && args.request !== null) { - this.request = new ttypes.multi_remove_request(args.request); - } - } -}; -rrdb_multi_remove_args.prototype = {}; -rrdb_multi_remove_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.request = new ttypes.multi_remove_request(); - this.request.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_multi_remove_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_multi_remove_args'); - if (this.request !== null && this.request !== undefined) { - output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); - this.request.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_multi_remove_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.multi_remove_response(args.success); - } - } -}; -rrdb_multi_remove_result.prototype = {}; -rrdb_multi_remove_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.multi_remove_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_multi_remove_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_multi_remove_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_get_args = module.exports.rrdb_get_args = function(args) { - this.key = null; - if (args) { - if (args.key !== undefined && args.key !== null) { - this.key = new base_ttypes.blob(args.key); - } - } -}; -rrdb_get_args.prototype = {}; -rrdb_get_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.key = new base_ttypes.blob(); - this.key.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_get_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_get_args'); - if (this.key !== null && this.key !== undefined) { - output.writeFieldBegin('key', Thrift.Type.STRUCT, 1); - this.key.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_get_result = module.exports.rrdb_get_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.read_response(args.success); - } - } -}; -rrdb_get_result.prototype = {}; -rrdb_get_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.read_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_get_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_get_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_multi_get_args = module.exports.rrdb_multi_get_args = function(args) { - this.request = null; - if (args) { - if (args.request !== undefined && args.request !== null) { - this.request = new ttypes.multi_get_request(args.request); - } - } -}; -rrdb_multi_get_args.prototype = {}; -rrdb_multi_get_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.request = new ttypes.multi_get_request(); - this.request.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_multi_get_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_multi_get_args'); - if (this.request !== null && this.request !== undefined) { - output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); - this.request.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_multi_get_result = module.exports.rrdb_multi_get_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.multi_get_response(args.success); - } - } -}; -rrdb_multi_get_result.prototype = {}; -rrdb_multi_get_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.multi_get_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_multi_get_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_multi_get_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_sortkey_count_args = function(args) { - this.hash_key = null; - if (args) { - if (args.hash_key !== undefined && args.hash_key !== null) { - this.hash_key = new base_ttypes.blob(args.hash_key); - } - } -}; -rrdb_sortkey_count_args.prototype = {}; -rrdb_sortkey_count_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.hash_key = new base_ttypes.blob(); - this.hash_key.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_sortkey_count_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_sortkey_count_args'); - if (this.hash_key !== null && this.hash_key !== undefined) { - output.writeFieldBegin('hash_key', Thrift.Type.STRUCT, 1); - this.hash_key.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_sortkey_count_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.count_response(args.success); - } - } -}; -rrdb_sortkey_count_result.prototype = {}; -rrdb_sortkey_count_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.count_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_sortkey_count_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_sortkey_count_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_ttl_args = function(args) { - this.key = null; - if (args) { - if (args.key !== undefined && args.key !== null) { - this.key = new base_ttypes.blob(args.key); - } - } -}; -rrdb_ttl_args.prototype = {}; -rrdb_ttl_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.key = new base_ttypes.blob(); - this.key.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_ttl_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_ttl_args'); - if (this.key !== null && this.key !== undefined) { - output.writeFieldBegin('key', Thrift.Type.STRUCT, 1); - this.key.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_ttl_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.ttl_response(args.success); - } - } -}; -rrdb_ttl_result.prototype = {}; -rrdb_ttl_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.ttl_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_ttl_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_ttl_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_get_scanner_args = function(args) { - this.request = null; - if (args) { - if (args.request !== undefined && args.request !== null) { - this.request = new ttypes.get_scanner_request(args.request); - } - } -}; -rrdb_get_scanner_args.prototype = {}; -rrdb_get_scanner_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.request = new ttypes.get_scanner_request(); - this.request.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_get_scanner_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_get_scanner_args'); - if (this.request !== null && this.request !== undefined) { - output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); - this.request.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_get_scanner_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.scan_response(args.success); - } - } -}; -rrdb_get_scanner_result.prototype = {}; -rrdb_get_scanner_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.scan_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_get_scanner_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_get_scanner_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_scan_args = function(args) { - this.request = null; - if (args) { - if (args.request !== undefined && args.request !== null) { - this.request = new ttypes.scan_request(args.request); - } - } -}; -rrdb_scan_args.prototype = {}; -rrdb_scan_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.request = new ttypes.scan_request(); - this.request.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_scan_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_scan_args'); - if (this.request !== null && this.request !== undefined) { - output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); - this.request.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_scan_result = function(args) { - this.success = null; - if (args) { - if (args.success !== undefined && args.success !== null) { - this.success = new ttypes.scan_response(args.success); - } - } -}; -rrdb_scan_result.prototype = {}; -rrdb_scan_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == Thrift.Type.STRUCT) { - this.success = new ttypes.scan_response(); - this.success.read(input); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_scan_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_scan_result'); - if (this.success !== null && this.success !== undefined) { - output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); - this.success.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_clear_scanner_args = function(args) { - this.context_id = null; - if (args) { - if (args.context_id !== undefined && args.context_id !== null) { - this.context_id = args.context_id; - } - } -}; -rrdb_clear_scanner_args.prototype = {}; -rrdb_clear_scanner_args.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I64) { - this.context_id = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_clear_scanner_args.prototype.write = function(output) { - output.writeStructBegin('rrdb_clear_scanner_args'); - if (this.context_id !== null && this.context_id !== undefined) { - output.writeFieldBegin('context_id', Thrift.Type.I64, 1); - output.writeI64(this.context_id); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdb_clear_scanner_result = function(args) { -}; -rrdb_clear_scanner_result.prototype = {}; -rrdb_clear_scanner_result.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - input.skip(ftype); - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -rrdb_clear_scanner_result.prototype.write = function(output) { - output.writeStructBegin('rrdb_clear_scanner_result'); - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var rrdbClient = exports.Client = function(output, pClass) { - this.output = output; - this.pClass = pClass; - this._seqid = 0; - this._reqs = {}; -}; -rrdbClient.prototype = {}; -rrdbClient.prototype.seqid = function() { return this._seqid; }; -rrdbClient.prototype.new_seqid = function() { return this._seqid += 1; }; -rrdbClient.prototype.put = function(update, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_put(update); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_put(update); - } -}; - -rrdbClient.prototype.send_put = function(update) { - var output = new this.pClass(this.output); - output.writeMessageBegin('put', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_put_args(); - args.update = update; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_put = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_put_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('put failed: unknown result'); -}; -rrdbClient.prototype.multi_put = function(request, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_multi_put(request); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_multi_put(request); - } -}; - -rrdbClient.prototype.send_multi_put = function(request) { - var output = new this.pClass(this.output); - output.writeMessageBegin('multi_put', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_multi_put_args(); - args.request = request; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_multi_put = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_multi_put_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('multi_put failed: unknown result'); -}; -rrdbClient.prototype.remove = function(key, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_remove(key); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_remove(key); - } -}; - -rrdbClient.prototype.send_remove = function(key) { - var output = new this.pClass(this.output); - output.writeMessageBegin('remove', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_remove_args(); - args.key = key; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_remove = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_remove_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('remove failed: unknown result'); -}; -rrdbClient.prototype.multi_remove = function(request, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_multi_remove(request); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_multi_remove(request); - } -}; - -rrdbClient.prototype.send_multi_remove = function(request) { - var output = new this.pClass(this.output); - output.writeMessageBegin('multi_remove', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_multi_remove_args(); - args.request = request; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_multi_remove = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_multi_remove_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('multi_remove failed: unknown result'); -}; -rrdbClient.prototype.get = function(key, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_get(key); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_get(key); - } -}; - -rrdbClient.prototype.send_get = function(key) { - var output = new this.pClass(this.output); - output.writeMessageBegin('get', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_get_args(); - args.key = key; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_get = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_get_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('get failed: unknown result'); -}; -rrdbClient.prototype.multi_get = function(request, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_multi_get(request); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_multi_get(request); - } -}; - -rrdbClient.prototype.send_multi_get = function(request) { - var output = new this.pClass(this.output); - output.writeMessageBegin('multi_get', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_multi_get_args(); - args.request = request; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_multi_get = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_multi_get_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('multi_get failed: unknown result'); -}; -rrdbClient.prototype.sortkey_count = function(hash_key, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_sortkey_count(hash_key); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_sortkey_count(hash_key); - } -}; - -rrdbClient.prototype.send_sortkey_count = function(hash_key) { - var output = new this.pClass(this.output); - output.writeMessageBegin('sortkey_count', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_sortkey_count_args(); - args.hash_key = hash_key; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_sortkey_count = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_sortkey_count_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('sortkey_count failed: unknown result'); -}; -rrdbClient.prototype.ttl = function(key, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_ttl(key); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_ttl(key); - } -}; - -rrdbClient.prototype.send_ttl = function(key) { - var output = new this.pClass(this.output); - output.writeMessageBegin('ttl', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_ttl_args(); - args.key = key; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_ttl = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_ttl_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('ttl failed: unknown result'); -}; -rrdbClient.prototype.get_scanner = function(request, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_get_scanner(request); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_get_scanner(request); - } -}; - -rrdbClient.prototype.send_get_scanner = function(request) { - var output = new this.pClass(this.output); - output.writeMessageBegin('get_scanner', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_get_scanner_args(); - args.request = request; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_get_scanner = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_get_scanner_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('get_scanner failed: unknown result'); -}; -rrdbClient.prototype.scan = function(request, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_scan(request); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_scan(request); - } -}; - -rrdbClient.prototype.send_scan = function(request) { - var output = new this.pClass(this.output); - output.writeMessageBegin('scan', Thrift.MessageType.CALL, this.seqid()); - var args = new rrdb_scan_args(); - args.request = request; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; - -rrdbClient.prototype.recv_scan = function(input,mtype,rseqid) { - var callback = this._reqs[rseqid] || function() {}; - delete this._reqs[rseqid]; - if (mtype == Thrift.MessageType.EXCEPTION) { - var x = new Thrift.TApplicationException(); - x.read(input); - input.readMessageEnd(); - return callback(x); - } - var result = new rrdb_scan_result(); - result.read(input); - input.readMessageEnd(); - - if (null !== result.success) { - return callback(null, result.success); - } - return callback('scan failed: unknown result'); -}; -rrdbClient.prototype.clear_scanner = function(context_id, callback) { - this._seqid = this.new_seqid(); - if (callback === undefined) { - var _defer = Q.defer(); - this._reqs[this.seqid()] = function(error, result) { - if (error) { - _defer.reject(error); - } else { - _defer.resolve(result); - } - }; - this.send_clear_scanner(context_id); - return _defer.promise; - } else { - this._reqs[this.seqid()] = callback; - this.send_clear_scanner(context_id); - } -}; - -rrdbClient.prototype.send_clear_scanner = function(context_id) { - var output = new this.pClass(this.output); - output.writeMessageBegin('clear_scanner', Thrift.MessageType.ONEWAY, this.seqid()); - var args = new rrdb_clear_scanner_args(); - args.context_id = context_id; - args.write(output); - output.writeMessageEnd(); - return this.output.flush(); -}; -var rrdbProcessor = exports.Processor = function(handler) { - this._handler = handler; -} -; -rrdbProcessor.prototype.process = function(input, output) { - var r = input.readMessageBegin(); - if (this['process_' + r.fname]) { - return this['process_' + r.fname].call(this, r.rseqid, input, output); - } else { - input.skip(Thrift.Type.STRUCT); - input.readMessageEnd(); - var x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname); - output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid); - x.write(output); - output.writeMessageEnd(); - output.flush(); - } -} -; -rrdbProcessor.prototype.process_put = function(seqid, input, output) { - var args = new rrdb_put_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.put.length === 1) { - Q.fcall(this._handler.put, args.update) - .then(function(result) { - var result_obj = new rrdb_put_result({success: result}); - output.writeMessageBegin("put", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("put", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.put(args.update, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_put_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("put", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("put", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_multi_put = function(seqid, input, output) { - var args = new rrdb_multi_put_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.multi_put.length === 1) { - Q.fcall(this._handler.multi_put, args.request) - .then(function(result) { - var result_obj = new rrdb_multi_put_result({success: result}); - output.writeMessageBegin("multi_put", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("multi_put", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.multi_put(args.request, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_multi_put_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("multi_put", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("multi_put", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_remove = function(seqid, input, output) { - var args = new rrdb_remove_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.remove.length === 1) { - Q.fcall(this._handler.remove, args.key) - .then(function(result) { - var result_obj = new rrdb_remove_result({success: result}); - output.writeMessageBegin("remove", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("remove", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.remove(args.key, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_remove_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("remove", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("remove", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_multi_remove = function(seqid, input, output) { - var args = new rrdb_multi_remove_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.multi_remove.length === 1) { - Q.fcall(this._handler.multi_remove, args.request) - .then(function(result) { - var result_obj = new rrdb_multi_remove_result({success: result}); - output.writeMessageBegin("multi_remove", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("multi_remove", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.multi_remove(args.request, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_multi_remove_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("multi_remove", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("multi_remove", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_get = function(seqid, input, output) { - var args = new rrdb_get_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.get.length === 1) { - Q.fcall(this._handler.get, args.key) - .then(function(result) { - var result_obj = new rrdb_get_result({success: result}); - output.writeMessageBegin("get", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("get", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.get(args.key, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_get_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("get", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("get", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_multi_get = function(seqid, input, output) { - var args = new rrdb_multi_get_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.multi_get.length === 1) { - Q.fcall(this._handler.multi_get, args.request) - .then(function(result) { - var result_obj = new rrdb_multi_get_result({success: result}); - output.writeMessageBegin("multi_get", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("multi_get", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.multi_get(args.request, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_multi_get_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("multi_get", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("multi_get", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_sortkey_count = function(seqid, input, output) { - var args = new rrdb_sortkey_count_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.sortkey_count.length === 1) { - Q.fcall(this._handler.sortkey_count, args.hash_key) - .then(function(result) { - var result_obj = new rrdb_sortkey_count_result({success: result}); - output.writeMessageBegin("sortkey_count", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("sortkey_count", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.sortkey_count(args.hash_key, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_sortkey_count_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("sortkey_count", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("sortkey_count", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_ttl = function(seqid, input, output) { - var args = new rrdb_ttl_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.ttl.length === 1) { - Q.fcall(this._handler.ttl, args.key) - .then(function(result) { - var result_obj = new rrdb_ttl_result({success: result}); - output.writeMessageBegin("ttl", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("ttl", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.ttl(args.key, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_ttl_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("ttl", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("ttl", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_get_scanner = function(seqid, input, output) { - var args = new rrdb_get_scanner_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.get_scanner.length === 1) { - Q.fcall(this._handler.get_scanner, args.request) - .then(function(result) { - var result_obj = new rrdb_get_scanner_result({success: result}); - output.writeMessageBegin("get_scanner", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("get_scanner", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.get_scanner(args.request, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_get_scanner_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("get_scanner", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("get_scanner", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_scan = function(seqid, input, output) { - var args = new rrdb_scan_args(); - args.read(input); - input.readMessageEnd(); - if (this._handler.scan.length === 1) { - Q.fcall(this._handler.scan, args.request) - .then(function(result) { - var result_obj = new rrdb_scan_result({success: result}); - output.writeMessageBegin("scan", Thrift.MessageType.REPLY, seqid); - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }, function (err) { - var result; - result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("scan", Thrift.MessageType.EXCEPTION, seqid); - result.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } else { - this._handler.scan(args.request, function (err, result) { - var result_obj; - if ((err === null || typeof err === 'undefined')) { - result_obj = new rrdb_scan_result((err !== null || typeof err === 'undefined') ? err : {success: result}); - output.writeMessageBegin("scan", Thrift.MessageType.REPLY, seqid); - } else { - result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); - output.writeMessageBegin("scan", Thrift.MessageType.EXCEPTION, seqid); - } - result_obj.write(output); - output.writeMessageEnd(); - output.flush(); - }); - } -}; -rrdbProcessor.prototype.process_clear_scanner = function(seqid, input, output) { - var args = new rrdb_clear_scanner_args(); - args.read(input); - input.readMessageEnd(); - this._handler.clear_scanner(args.context_id); -} -; diff --git a/nodejs-client/src/dsn/rrdb_types.js b/nodejs-client/src/dsn/rrdb_types.js deleted file mode 100644 index 68ade93e59..0000000000 --- a/nodejs-client/src/dsn/rrdb_types.js +++ /dev/null @@ -1,1564 +0,0 @@ -// -// Autogenerated by Thrift Compiler (0.10.0) -// -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -// -"use strict"; - -var thrift = require('thrift'); -var Thrift = thrift.Thrift; -var Q = thrift.Q; - -var base_ttypes = require('./base_types'); -var replication_ttypes = require('./replication_types'); - - -var ttypes = module.exports = {}; -var update_request = module.exports.update_request = function(args) { - this.key = null; - this.value = null; - this.expire_ts_seconds = null; - if (args) { - if (args.key !== undefined && args.key !== null) { - this.key = new base_ttypes.blob(args.key); - } - if (args.value !== undefined && args.value !== null) { - this.value = new base_ttypes.blob(args.value); - } - if (args.expire_ts_seconds !== undefined && args.expire_ts_seconds !== null) { - this.expire_ts_seconds = args.expire_ts_seconds; - } - } -}; -update_request.prototype = {}; -update_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.key = new base_ttypes.blob(); - this.key.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.value = new base_ttypes.blob(); - this.value.read(input); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.expire_ts_seconds = input.readI32(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -update_request.prototype.write = function(output) { - output.writeStructBegin('update_request'); - if (this.key !== null && this.key !== undefined) { - output.writeFieldBegin('key', Thrift.Type.STRUCT, 1); - this.key.write(output); - output.writeFieldEnd(); - } - if (this.value !== null && this.value !== undefined) { - output.writeFieldBegin('value', Thrift.Type.STRUCT, 2); - this.value.write(output); - output.writeFieldEnd(); - } - if (this.expire_ts_seconds !== null && this.expire_ts_seconds !== undefined) { - output.writeFieldBegin('expire_ts_seconds', Thrift.Type.I32, 3); - output.writeI32(this.expire_ts_seconds); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var update_response = module.exports.update_response = function(args) { - this.error = null; - this.app_id = null; - this.partition_index = null; - this.decree = null; - this.server = null; - if (args) { - if (args.error !== undefined && args.error !== null) { - this.error = args.error; - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_index !== undefined && args.partition_index !== null) { - this.partition_index = args.partition_index; - } - if (args.decree !== undefined && args.decree !== null) { - this.decree = args.decree; - } - if (args.server !== undefined && args.server !== null) { - this.server = args.server; - } - } -}; -update_response.prototype = {}; -update_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.error = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.partition_index = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I64) { - this.decree = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.STRING) { - this.server = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -update_response.prototype.write = function(output) { - output.writeStructBegin('update_response'); - if (this.error !== null && this.error !== undefined) { - output.writeFieldBegin('error', Thrift.Type.I32, 1); - output.writeI32(this.error); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 2); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_index !== null && this.partition_index !== undefined) { - output.writeFieldBegin('partition_index', Thrift.Type.I32, 3); - output.writeI32(this.partition_index); - output.writeFieldEnd(); - } - if (this.decree !== null && this.decree !== undefined) { - output.writeFieldBegin('decree', Thrift.Type.I64, 4); - output.writeI64(this.decree); - output.writeFieldEnd(); - } - if (this.server !== null && this.server !== undefined) { - output.writeFieldBegin('server', Thrift.Type.STRING, 5); - output.writeString(this.server); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var read_response = module.exports.read_response = function(args) { - this.error = null; - this.value = null; - this.app_id = null; - this.partition_index = null; - this.server = null; - if (args) { - if (args.error !== undefined && args.error !== null) { - this.error = args.error; - } - if (args.value !== undefined && args.value !== null) { - this.value = new base_ttypes.blob(args.value); - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_index !== undefined && args.partition_index !== null) { - this.partition_index = args.partition_index; - } - if (args.server !== undefined && args.server !== null) { - this.server = args.server; - } - } -}; -read_response.prototype = {}; -read_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.error = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.value = new base_ttypes.blob(); - this.value.read(input); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.partition_index = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.server = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -read_response.prototype.write = function(output) { - output.writeStructBegin('read_response'); - if (this.error !== null && this.error !== undefined) { - output.writeFieldBegin('error', Thrift.Type.I32, 1); - output.writeI32(this.error); - output.writeFieldEnd(); - } - if (this.value !== null && this.value !== undefined) { - output.writeFieldBegin('value', Thrift.Type.STRUCT, 2); - this.value.write(output); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 3); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_index !== null && this.partition_index !== undefined) { - output.writeFieldBegin('partition_index', Thrift.Type.I32, 4); - output.writeI32(this.partition_index); - output.writeFieldEnd(); - } - if (this.server !== null && this.server !== undefined) { - output.writeFieldBegin('server', Thrift.Type.STRING, 6); - output.writeString(this.server); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var ttl_response = module.exports.ttl_response = function(args) { - this.error = null; - this.ttl_seconds = null; - this.app_id = null; - this.partition_index = null; - this.server = null; - if (args) { - if (args.error !== undefined && args.error !== null) { - this.error = args.error; - } - if (args.ttl_seconds !== undefined && args.ttl_seconds !== null) { - this.ttl_seconds = args.ttl_seconds; - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_index !== undefined && args.partition_index !== null) { - this.partition_index = args.partition_index; - } - if (args.server !== undefined && args.server !== null) { - this.server = args.server; - } - } -}; -ttl_response.prototype = {}; -ttl_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.error = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.ttl_seconds = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.partition_index = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.server = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -ttl_response.prototype.write = function(output) { - output.writeStructBegin('ttl_response'); - if (this.error !== null && this.error !== undefined) { - output.writeFieldBegin('error', Thrift.Type.I32, 1); - output.writeI32(this.error); - output.writeFieldEnd(); - } - if (this.ttl_seconds !== null && this.ttl_seconds !== undefined) { - output.writeFieldBegin('ttl_seconds', Thrift.Type.I32, 2); - output.writeI32(this.ttl_seconds); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 3); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_index !== null && this.partition_index !== undefined) { - output.writeFieldBegin('partition_index', Thrift.Type.I32, 4); - output.writeI32(this.partition_index); - output.writeFieldEnd(); - } - if (this.server !== null && this.server !== undefined) { - output.writeFieldBegin('server', Thrift.Type.STRING, 6); - output.writeString(this.server); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var count_response = module.exports.count_response = function(args) { - this.error = null; - this.count = null; - this.app_id = null; - this.partition_index = null; - this.server = null; - if (args) { - if (args.error !== undefined && args.error !== null) { - this.error = args.error; - } - if (args.count !== undefined && args.count !== null) { - this.count = args.count; - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_index !== undefined && args.partition_index !== null) { - this.partition_index = args.partition_index; - } - if (args.server !== undefined && args.server !== null) { - this.server = args.server; - } - } -}; -count_response.prototype = {}; -count_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.error = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I64) { - this.count = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.partition_index = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.server = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -count_response.prototype.write = function(output) { - output.writeStructBegin('count_response'); - if (this.error !== null && this.error !== undefined) { - output.writeFieldBegin('error', Thrift.Type.I32, 1); - output.writeI32(this.error); - output.writeFieldEnd(); - } - if (this.count !== null && this.count !== undefined) { - output.writeFieldBegin('count', Thrift.Type.I64, 2); - output.writeI64(this.count); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 3); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_index !== null && this.partition_index !== undefined) { - output.writeFieldBegin('partition_index', Thrift.Type.I32, 4); - output.writeI32(this.partition_index); - output.writeFieldEnd(); - } - if (this.server !== null && this.server !== undefined) { - output.writeFieldBegin('server', Thrift.Type.STRING, 6); - output.writeString(this.server); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var key_value = module.exports.key_value = function(args) { - this.key = null; - this.value = null; - if (args) { - if (args.key !== undefined && args.key !== null) { - this.key = new base_ttypes.blob(args.key); - } - if (args.value !== undefined && args.value !== null) { - this.value = new base_ttypes.blob(args.value); - } - } -}; -key_value.prototype = {}; -key_value.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.key = new base_ttypes.blob(); - this.key.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.value = new base_ttypes.blob(); - this.value.read(input); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -key_value.prototype.write = function(output) { - output.writeStructBegin('key_value'); - if (this.key !== null && this.key !== undefined) { - output.writeFieldBegin('key', Thrift.Type.STRUCT, 1); - this.key.write(output); - output.writeFieldEnd(); - } - if (this.value !== null && this.value !== undefined) { - output.writeFieldBegin('value', Thrift.Type.STRUCT, 2); - this.value.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var multi_put_request = module.exports.multi_put_request = function(args) { - this.hash_key = null; - this.kvs = null; - this.expire_ts_seconds = null; - if (args) { - if (args.hash_key !== undefined && args.hash_key !== null) { - this.hash_key = new base_ttypes.blob(args.hash_key); - } - if (args.kvs !== undefined && args.kvs !== null) { - this.kvs = Thrift.copyList(args.kvs, [ttypes.key_value]); - } - if (args.expire_ts_seconds !== undefined && args.expire_ts_seconds !== null) { - this.expire_ts_seconds = args.expire_ts_seconds; - } - } -}; -multi_put_request.prototype = {}; -multi_put_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.hash_key = new base_ttypes.blob(); - this.hash_key.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size0 = 0; - var _rtmp34; - this.kvs = []; - var _etype3 = 0; - _rtmp34 = input.readListBegin(); - _etype3 = _rtmp34.etype; - _size0 = _rtmp34.size; - for (var _i5 = 0; _i5 < _size0; ++_i5) - { - var elem6 = null; - elem6 = new ttypes.key_value(); - elem6.read(input); - this.kvs.push(elem6); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.expire_ts_seconds = input.readI32(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -multi_put_request.prototype.write = function(output) { - output.writeStructBegin('multi_put_request'); - if (this.hash_key !== null && this.hash_key !== undefined) { - output.writeFieldBegin('hash_key', Thrift.Type.STRUCT, 1); - this.hash_key.write(output); - output.writeFieldEnd(); - } - if (this.kvs !== null && this.kvs !== undefined) { - output.writeFieldBegin('kvs', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.kvs.length); - for (var iter7 in this.kvs) - { - if (this.kvs.hasOwnProperty(iter7)) - { - iter7 = this.kvs[iter7]; - iter7.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.expire_ts_seconds !== null && this.expire_ts_seconds !== undefined) { - output.writeFieldBegin('expire_ts_seconds', Thrift.Type.I32, 3); - output.writeI32(this.expire_ts_seconds); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var multi_remove_request = module.exports.multi_remove_request = function(args) { - this.hash_key = null; - this.sork_keys = null; - this.max_count = null; - if (args) { - if (args.hash_key !== undefined && args.hash_key !== null) { - this.hash_key = new base_ttypes.blob(args.hash_key); - } - if (args.sork_keys !== undefined && args.sork_keys !== null) { - this.sork_keys = Thrift.copyList(args.sork_keys, [base_ttypes.blob]); - } - if (args.max_count !== undefined && args.max_count !== null) { - this.max_count = args.max_count; - } - } -}; -multi_remove_request.prototype = {}; -multi_remove_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.hash_key = new base_ttypes.blob(); - this.hash_key.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size8 = 0; - var _rtmp312; - this.sork_keys = []; - var _etype11 = 0; - _rtmp312 = input.readListBegin(); - _etype11 = _rtmp312.etype; - _size8 = _rtmp312.size; - for (var _i13 = 0; _i13 < _size8; ++_i13) - { - var elem14 = null; - elem14 = new base_ttypes.blob(); - elem14.read(input); - this.sork_keys.push(elem14); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I64) { - this.max_count = input.readI64(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -multi_remove_request.prototype.write = function(output) { - output.writeStructBegin('multi_remove_request'); - if (this.hash_key !== null && this.hash_key !== undefined) { - output.writeFieldBegin('hash_key', Thrift.Type.STRUCT, 1); - this.hash_key.write(output); - output.writeFieldEnd(); - } - if (this.sork_keys !== null && this.sork_keys !== undefined) { - output.writeFieldBegin('sork_keys', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.sork_keys.length); - for (var iter15 in this.sork_keys) - { - if (this.sork_keys.hasOwnProperty(iter15)) - { - iter15 = this.sork_keys[iter15]; - iter15.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.max_count !== null && this.max_count !== undefined) { - output.writeFieldBegin('max_count', Thrift.Type.I64, 3); - output.writeI64(this.max_count); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var multi_remove_response = module.exports.multi_remove_response = function(args) { - this.error = null; - this.count = null; - this.app_id = null; - this.partition_index = null; - this.decree = null; - this.server = null; - if (args) { - if (args.error !== undefined && args.error !== null) { - this.error = args.error; - } - if (args.count !== undefined && args.count !== null) { - this.count = args.count; - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_index !== undefined && args.partition_index !== null) { - this.partition_index = args.partition_index; - } - if (args.decree !== undefined && args.decree !== null) { - this.decree = args.decree; - } - if (args.server !== undefined && args.server !== null) { - this.server = args.server; - } - } -}; -multi_remove_response.prototype = {}; -multi_remove_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.error = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I64) { - this.count = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.partition_index = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I64) { - this.decree = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.server = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -multi_remove_response.prototype.write = function(output) { - output.writeStructBegin('multi_remove_response'); - if (this.error !== null && this.error !== undefined) { - output.writeFieldBegin('error', Thrift.Type.I32, 1); - output.writeI32(this.error); - output.writeFieldEnd(); - } - if (this.count !== null && this.count !== undefined) { - output.writeFieldBegin('count', Thrift.Type.I64, 2); - output.writeI64(this.count); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 3); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_index !== null && this.partition_index !== undefined) { - output.writeFieldBegin('partition_index', Thrift.Type.I32, 4); - output.writeI32(this.partition_index); - output.writeFieldEnd(); - } - if (this.decree !== null && this.decree !== undefined) { - output.writeFieldBegin('decree', Thrift.Type.I64, 5); - output.writeI64(this.decree); - output.writeFieldEnd(); - } - if (this.server !== null && this.server !== undefined) { - output.writeFieldBegin('server', Thrift.Type.STRING, 6); - output.writeString(this.server); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var multi_get_request = module.exports.multi_get_request = function(args) { - this.hash_key = null; - this.sork_keys = null; - this.max_kv_count = null; - this.max_kv_size = null; - this.no_value = null; - if (args) { - if (args.hash_key !== undefined && args.hash_key !== null) { - this.hash_key = new base_ttypes.blob(args.hash_key); - } - if (args.sork_keys !== undefined && args.sork_keys !== null) { - this.sork_keys = Thrift.copyList(args.sork_keys, [base_ttypes.blob]); - } - if (args.max_kv_count !== undefined && args.max_kv_count !== null) { - this.max_kv_count = args.max_kv_count; - } - if (args.max_kv_size !== undefined && args.max_kv_size !== null) { - this.max_kv_size = args.max_kv_size; - } - if (args.no_value !== undefined && args.no_value !== null) { - this.no_value = args.no_value; - } - } -}; -multi_get_request.prototype = {}; -multi_get_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.hash_key = new base_ttypes.blob(); - this.hash_key.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size16 = 0; - var _rtmp320; - this.sork_keys = []; - var _etype19 = 0; - _rtmp320 = input.readListBegin(); - _etype19 = _rtmp320.etype; - _size16 = _rtmp320.size; - for (var _i21 = 0; _i21 < _size16; ++_i21) - { - var elem22 = null; - elem22 = new base_ttypes.blob(); - elem22.read(input); - this.sork_keys.push(elem22); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.max_kv_count = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.max_kv_size = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.BOOL) { - this.no_value = input.readBool(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -multi_get_request.prototype.write = function(output) { - output.writeStructBegin('multi_get_request'); - if (this.hash_key !== null && this.hash_key !== undefined) { - output.writeFieldBegin('hash_key', Thrift.Type.STRUCT, 1); - this.hash_key.write(output); - output.writeFieldEnd(); - } - if (this.sork_keys !== null && this.sork_keys !== undefined) { - output.writeFieldBegin('sork_keys', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.sork_keys.length); - for (var iter23 in this.sork_keys) - { - if (this.sork_keys.hasOwnProperty(iter23)) - { - iter23 = this.sork_keys[iter23]; - iter23.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.max_kv_count !== null && this.max_kv_count !== undefined) { - output.writeFieldBegin('max_kv_count', Thrift.Type.I32, 3); - output.writeI32(this.max_kv_count); - output.writeFieldEnd(); - } - if (this.max_kv_size !== null && this.max_kv_size !== undefined) { - output.writeFieldBegin('max_kv_size', Thrift.Type.I32, 4); - output.writeI32(this.max_kv_size); - output.writeFieldEnd(); - } - if (this.no_value !== null && this.no_value !== undefined) { - output.writeFieldBegin('no_value', Thrift.Type.BOOL, 5); - output.writeBool(this.no_value); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var multi_get_response = module.exports.multi_get_response = function(args) { - this.error = null; - this.kvs = null; - this.app_id = null; - this.partition_index = null; - this.server = null; - if (args) { - if (args.error !== undefined && args.error !== null) { - this.error = args.error; - } - if (args.kvs !== undefined && args.kvs !== null) { - this.kvs = Thrift.copyList(args.kvs, [ttypes.key_value]); - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_index !== undefined && args.partition_index !== null) { - this.partition_index = args.partition_index; - } - if (args.server !== undefined && args.server !== null) { - this.server = args.server; - } - } -}; -multi_get_response.prototype = {}; -multi_get_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.error = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size24 = 0; - var _rtmp328; - this.kvs = []; - var _etype27 = 0; - _rtmp328 = input.readListBegin(); - _etype27 = _rtmp328.etype; - _size24 = _rtmp328.size; - for (var _i29 = 0; _i29 < _size24; ++_i29) - { - var elem30 = null; - elem30 = new ttypes.key_value(); - elem30.read(input); - this.kvs.push(elem30); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.partition_index = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.server = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -multi_get_response.prototype.write = function(output) { - output.writeStructBegin('multi_get_response'); - if (this.error !== null && this.error !== undefined) { - output.writeFieldBegin('error', Thrift.Type.I32, 1); - output.writeI32(this.error); - output.writeFieldEnd(); - } - if (this.kvs !== null && this.kvs !== undefined) { - output.writeFieldBegin('kvs', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.kvs.length); - for (var iter31 in this.kvs) - { - if (this.kvs.hasOwnProperty(iter31)) - { - iter31 = this.kvs[iter31]; - iter31.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 3); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_index !== null && this.partition_index !== undefined) { - output.writeFieldBegin('partition_index', Thrift.Type.I32, 4); - output.writeI32(this.partition_index); - output.writeFieldEnd(); - } - if (this.server !== null && this.server !== undefined) { - output.writeFieldBegin('server', Thrift.Type.STRING, 6); - output.writeString(this.server); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var get_scanner_request = module.exports.get_scanner_request = function(args) { - this.start_key = null; - this.stop_key = null; - this.start_inclusive = null; - this.stop_inclusive = null; - this.batch_size = null; - if (args) { - if (args.start_key !== undefined && args.start_key !== null) { - this.start_key = new base_ttypes.blob(args.start_key); - } - if (args.stop_key !== undefined && args.stop_key !== null) { - this.stop_key = new base_ttypes.blob(args.stop_key); - } - if (args.start_inclusive !== undefined && args.start_inclusive !== null) { - this.start_inclusive = args.start_inclusive; - } - if (args.stop_inclusive !== undefined && args.stop_inclusive !== null) { - this.stop_inclusive = args.stop_inclusive; - } - if (args.batch_size !== undefined && args.batch_size !== null) { - this.batch_size = args.batch_size; - } - } -}; -get_scanner_request.prototype = {}; -get_scanner_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.start_key = new base_ttypes.blob(); - this.start_key.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.stop_key = new base_ttypes.blob(); - this.stop_key.read(input); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.BOOL) { - this.start_inclusive = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.BOOL) { - this.stop_inclusive = input.readBool(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I32) { - this.batch_size = input.readI32(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -get_scanner_request.prototype.write = function(output) { - output.writeStructBegin('get_scanner_request'); - if (this.start_key !== null && this.start_key !== undefined) { - output.writeFieldBegin('start_key', Thrift.Type.STRUCT, 1); - this.start_key.write(output); - output.writeFieldEnd(); - } - if (this.stop_key !== null && this.stop_key !== undefined) { - output.writeFieldBegin('stop_key', Thrift.Type.STRUCT, 2); - this.stop_key.write(output); - output.writeFieldEnd(); - } - if (this.start_inclusive !== null && this.start_inclusive !== undefined) { - output.writeFieldBegin('start_inclusive', Thrift.Type.BOOL, 3); - output.writeBool(this.start_inclusive); - output.writeFieldEnd(); - } - if (this.stop_inclusive !== null && this.stop_inclusive !== undefined) { - output.writeFieldBegin('stop_inclusive', Thrift.Type.BOOL, 4); - output.writeBool(this.stop_inclusive); - output.writeFieldEnd(); - } - if (this.batch_size !== null && this.batch_size !== undefined) { - output.writeFieldBegin('batch_size', Thrift.Type.I32, 5); - output.writeI32(this.batch_size); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var scan_request = module.exports.scan_request = function(args) { - this.context_id = null; - if (args) { - if (args.context_id !== undefined && args.context_id !== null) { - this.context_id = args.context_id; - } - } -}; -scan_request.prototype = {}; -scan_request.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I64) { - this.context_id = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -scan_request.prototype.write = function(output) { - output.writeStructBegin('scan_request'); - if (this.context_id !== null && this.context_id !== undefined) { - output.writeFieldBegin('context_id', Thrift.Type.I64, 1); - output.writeI64(this.context_id); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -var scan_response = module.exports.scan_response = function(args) { - this.error = null; - this.kvs = null; - this.context_id = null; - this.app_id = null; - this.partition_index = null; - this.server = null; - if (args) { - if (args.error !== undefined && args.error !== null) { - this.error = args.error; - } - if (args.kvs !== undefined && args.kvs !== null) { - this.kvs = Thrift.copyList(args.kvs, [ttypes.key_value]); - } - if (args.context_id !== undefined && args.context_id !== null) { - this.context_id = args.context_id; - } - if (args.app_id !== undefined && args.app_id !== null) { - this.app_id = args.app_id; - } - if (args.partition_index !== undefined && args.partition_index !== null) { - this.partition_index = args.partition_index; - } - if (args.server !== undefined && args.server !== null) { - this.server = args.server; - } - } -}; -scan_response.prototype = {}; -scan_response.prototype.read = function(input) { - input.readStructBegin(); - while (true) - { - var ret = input.readFieldBegin(); - var fname = ret.fname; - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == Thrift.Type.I32) { - this.error = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - var _size32 = 0; - var _rtmp336; - this.kvs = []; - var _etype35 = 0; - _rtmp336 = input.readListBegin(); - _etype35 = _rtmp336.etype; - _size32 = _rtmp336.size; - for (var _i37 = 0; _i37 < _size32; ++_i37) - { - var elem38 = null; - elem38 = new ttypes.key_value(); - elem38.read(input); - this.kvs.push(elem38); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I64) { - this.context_id = input.readI64(); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.I32) { - this.app_id = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.I32) { - this.partition_index = input.readI32(); - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.server = input.readString(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -scan_response.prototype.write = function(output) { - output.writeStructBegin('scan_response'); - if (this.error !== null && this.error !== undefined) { - output.writeFieldBegin('error', Thrift.Type.I32, 1); - output.writeI32(this.error); - output.writeFieldEnd(); - } - if (this.kvs !== null && this.kvs !== undefined) { - output.writeFieldBegin('kvs', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.kvs.length); - for (var iter39 in this.kvs) - { - if (this.kvs.hasOwnProperty(iter39)) - { - iter39 = this.kvs[iter39]; - iter39.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.context_id !== null && this.context_id !== undefined) { - output.writeFieldBegin('context_id', Thrift.Type.I64, 3); - output.writeI64(this.context_id); - output.writeFieldEnd(); - } - if (this.app_id !== null && this.app_id !== undefined) { - output.writeFieldBegin('app_id', Thrift.Type.I32, 4); - output.writeI32(this.app_id); - output.writeFieldEnd(); - } - if (this.partition_index !== null && this.partition_index !== undefined) { - output.writeFieldBegin('partition_index', Thrift.Type.I32, 5); - output.writeI32(this.partition_index); - output.writeFieldEnd(); - } - if (this.server !== null && this.server !== undefined) { - output.writeFieldBegin('server', Thrift.Type.STRING, 6); - output.writeString(this.server); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - diff --git a/nodejs-client/src/errors.js b/nodejs-client/src/errors.js index 49922e9413..9b08a55dac 100644 --- a/nodejs-client/src/errors.js +++ b/nodejs-client/src/errors.js @@ -20,7 +20,7 @@ "use strict"; const util = require('util'); -const ErrorType = require('./dsn/base_types').error_type; +const ErrorType = require('./dsn/dsn_types').error_type; //Base Error function PException(msg) { diff --git a/nodejs-client/src/operator.js b/nodejs-client/src/operator.js index a191e95710..109c5f166d 100644 --- a/nodejs-client/src/operator.js +++ b/nodejs-client/src/operator.js @@ -19,7 +19,7 @@ "use strict"; -const type = require('./dsn/base_types'); +const type = require('./dsn/dsn_types'); const tools = require('./tools'); const Int64 = require('node-int64'); const Long = require('long'); diff --git a/nodejs-client/src/session.js b/nodejs-client/src/session.js index f3c2a839f3..55cd55f73b 100644 --- a/nodejs-client/src/session.js +++ b/nodejs-client/src/session.js @@ -19,8 +19,8 @@ "use strict"; -const RpcAddress = require('./dsn/base_types').rpc_address; -const ErrorType = require('./dsn/base_types').error_type; +const RpcAddress = require('./dsn/dsn_types').rpc_address; +const ErrorType = require('./dsn/dsn_types').error_type; const Connection = require('./connection'); const util = require('util'); const Exception = require('./errors'); diff --git a/nodejs-client/src/table_handler.js b/nodejs-client/src/table_handler.js index 2ea28afec7..3504758d72 100644 --- a/nodejs-client/src/table_handler.js +++ b/nodejs-client/src/table_handler.js @@ -19,11 +19,11 @@ "use strict"; -const Blob = require('./dsn/base_types').blob; -const Gpid = require('./dsn/base_types').gpid; -const ErrorType = require('./dsn/base_types').error_type; +const Blob = require('./dsn/dsn_types').blob; +const Gpid = require('./dsn/dsn_types').gpid; +const ErrorType = require('./dsn/dsn_types').error_type; const RrdbType = require('./dsn/rrdb_types'); -const replica = require('./dsn/replication_types'); +const replica = require('./dsn/dsn.layer2_types'); const Exception = require('./errors'); const ReplicaSession = require('./session').ReplicaSession; const MetaRequestRound = require('./session').MetaRequestRound; diff --git a/nodejs-client/test/client.test.js b/nodejs-client/test/client.test.js index d8efd2874b..58be66b51e 100644 --- a/nodejs-client/test/client.test.js +++ b/nodejs-client/test/client.test.js @@ -21,7 +21,7 @@ let assert = require('assert'); let pegasusClient = require('../'); let PException = require('../src/errors').PException; -let ErrorType = require('../src/dsn/base_types').error_type; +let ErrorType = require('../src/dsn/dsn_types').error_type; let log4js = require('log4js'); describe('test/client.test.js', function(){