diff --git a/include/dsn/cpp/json_helper.h b/include/dsn/cpp/json_helper.h index aa0126bc9d..3062df9687 100644 --- a/include/dsn/cpp/json_helper.h +++ b/include/dsn/cpp/json_helper.h @@ -73,6 +73,12 @@ #define JSON_ENCODE_ENTRIES9(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9) \ JSON_ENCODE_ENTRIES8(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8); \ JSON_ENCODE_ENTRY(out, prefix, T9) +#define JSON_ENCODE_ENTRIES10(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) \ + JSON_ENCODE_ENTRIES9(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9); \ + JSON_ENCODE_ENTRY(out, prefix, T10) +#define JSON_ENCODE_ENTRIES11(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) \ + JSON_ENCODE_ENTRIES10(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10); \ + JSON_ENCODE_ENTRY(out, prefix, T11) #define JSON_DECODE_ENTRY(in, prefix, T) \ do { \ @@ -115,14 +121,23 @@ #define JSON_DECODE_ENTRIES9(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9) \ JSON_DECODE_ENTRIES8(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8); \ JSON_TRY_DECODE_ENTRY(in, prefix, T9) - -#define JSON_ENTRIES_GET_MACRO(ph1, ph2, ph3, ph4, ph5, ph6, ph7, ph8, ph9, NAME, ...) NAME +#define JSON_DECODE_ENTRIES10(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) \ + JSON_DECODE_ENTRIES9(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9); \ + JSON_TRY_DECODE_ENTRY(in, prefix, T10) +#define JSON_DECODE_ENTRIES11(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) \ + JSON_DECODE_ENTRIES10(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10); \ + JSON_TRY_DECODE_ENTRY(in, prefix, T11) + +#define JSON_ENTRIES_GET_MACRO(ph1, ph2, ph3, ph4, ph5, ph6, ph7, ph8, ph9, ph10, ph11, NAME, ...) \ + NAME // workaround due to the way VC handles "..." #define JSON_ENTRIES_GET_MACRO_(tuple) JSON_ENTRIES_GET_MACRO tuple #define JSON_ENCODE_ENTRIES(out, prefix, ...) \ out.StartObject(); \ JSON_ENTRIES_GET_MACRO_((__VA_ARGS__, \ + JSON_ENCODE_ENTRIES11, \ + JSON_ENCODE_ENTRIES10, \ JSON_ENCODE_ENTRIES9, \ JSON_ENCODE_ENTRIES8, \ JSON_ENCODE_ENTRIES7, \ @@ -140,6 +155,8 @@ int arguments_count = 0; \ int parsed_count = 0; \ JSON_ENTRIES_GET_MACRO_((__VA_ARGS__, \ + JSON_DECODE_ENTRIES11, \ + JSON_DECODE_ENTRIES10, \ JSON_DECODE_ENTRIES9, \ JSON_DECODE_ENTRIES8, \ JSON_DECODE_ENTRIES7, \ @@ -582,6 +599,8 @@ NON_MEMBER_JSON_SERIALIZATION(dsn::app_info, envs, is_stateful, max_replica_count, - expire_second) + expire_second, + create_second, + drop_second) } } diff --git a/include/dsn/cpp/serialization_helper/dsn.layer2_types.h b/include/dsn/cpp/serialization_helper/dsn.layer2_types.h index 90945952f4..7cad4ceaa2 100644 --- a/include/dsn/cpp/serialization_helper/dsn.layer2_types.h +++ b/include/dsn/cpp/serialization_helper/dsn.layer2_types.h @@ -17,23 +17,24 @@ #include - namespace dsn { -struct app_status { - enum type { - 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 - }; +struct app_status +{ + enum type + { + 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 + }; }; -extern const std::map _app_status_VALUES_TO_NAMES; +extern const std::map _app_status_VALUES_TO_NAMES; class partition_configuration; @@ -43,318 +44,368 @@ class configuration_query_by_index_response; class app_info; -typedef struct _partition_configuration__isset { - _partition_configuration__isset() : pid(false), ballot(false), max_replica_count(false), primary(false), secondaries(false), last_drops(false), last_committed_decree(false), partition_flags(false) {} - bool pid :1; - bool ballot :1; - bool max_replica_count :1; - bool primary :1; - bool secondaries :1; - bool last_drops :1; - bool last_committed_decree :1; - bool partition_flags :1; +typedef struct _partition_configuration__isset +{ + _partition_configuration__isset() + : pid(false), + ballot(false), + max_replica_count(false), + primary(false), + secondaries(false), + last_drops(false), + last_committed_decree(false), + partition_flags(false) + { + } + bool pid : 1; + bool ballot : 1; + bool max_replica_count : 1; + bool primary : 1; + bool secondaries : 1; + bool last_drops : 1; + bool last_committed_decree : 1; + bool partition_flags : 1; } _partition_configuration__isset; -class partition_configuration { - public: - - partition_configuration(const partition_configuration&); - partition_configuration(partition_configuration&&); - partition_configuration& operator=(const partition_configuration&); - partition_configuration& operator=(partition_configuration&&); - partition_configuration() : ballot(0), max_replica_count(0), last_committed_decree(0), partition_flags(0) { - } - - virtual ~partition_configuration() throw(); - ::dsn::gpid pid; - int64_t ballot; - int32_t max_replica_count; - ::dsn::rpc_address primary; - std::vector< ::dsn::rpc_address> secondaries; - std::vector< ::dsn::rpc_address> last_drops; - int64_t last_committed_decree; - int32_t partition_flags; - - _partition_configuration__isset __isset; - - void __set_pid(const ::dsn::gpid& val); - - void __set_ballot(const int64_t val); - - void __set_max_replica_count(const int32_t val); - - void __set_primary(const ::dsn::rpc_address& val); - - void __set_secondaries(const std::vector< ::dsn::rpc_address> & val); - - void __set_last_drops(const std::vector< ::dsn::rpc_address> & val); - - void __set_last_committed_decree(const int64_t val); - - void __set_partition_flags(const int32_t val); - - bool operator == (const partition_configuration & rhs) const - { - if (!(pid == rhs.pid)) - return false; - if (!(ballot == rhs.ballot)) - return false; - if (!(max_replica_count == rhs.max_replica_count)) - return false; - if (!(primary == rhs.primary)) - return false; - if (!(secondaries == rhs.secondaries)) - return false; - if (!(last_drops == rhs.last_drops)) - return false; - if (!(last_committed_decree == rhs.last_committed_decree)) - return false; - if (!(partition_flags == rhs.partition_flags)) - return false; - return true; - } - bool operator != (const partition_configuration &rhs) const { - return !(*this == rhs); - } - - bool operator < (const partition_configuration & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; +class partition_configuration +{ +public: + partition_configuration(const partition_configuration &); + partition_configuration(partition_configuration &&); + partition_configuration &operator=(const partition_configuration &); + partition_configuration &operator=(partition_configuration &&); + partition_configuration() + : ballot(0), max_replica_count(0), last_committed_decree(0), partition_flags(0) + { + } + + virtual ~partition_configuration() throw(); + ::dsn::gpid pid; + int64_t ballot; + int32_t max_replica_count; + ::dsn::rpc_address primary; + std::vector<::dsn::rpc_address> secondaries; + std::vector<::dsn::rpc_address> last_drops; + int64_t last_committed_decree; + int32_t partition_flags; + + _partition_configuration__isset __isset; + + void __set_pid(const ::dsn::gpid &val); + + void __set_ballot(const int64_t val); + + void __set_max_replica_count(const int32_t val); + + void __set_primary(const ::dsn::rpc_address &val); + + void __set_secondaries(const std::vector<::dsn::rpc_address> &val); + + void __set_last_drops(const std::vector<::dsn::rpc_address> &val); + + void __set_last_committed_decree(const int64_t val); + + void __set_partition_flags(const int32_t val); + + bool operator==(const partition_configuration &rhs) const + { + if (!(pid == rhs.pid)) + return false; + if (!(ballot == rhs.ballot)) + return false; + if (!(max_replica_count == rhs.max_replica_count)) + return false; + if (!(primary == rhs.primary)) + return false; + if (!(secondaries == rhs.secondaries)) + return false; + if (!(last_drops == rhs.last_drops)) + return false; + if (!(last_committed_decree == rhs.last_committed_decree)) + return false; + if (!(partition_flags == rhs.partition_flags)) + return false; + return true; + } + bool operator!=(const partition_configuration &rhs) const { return !(*this == rhs); } + + bool operator<(const partition_configuration &) const; + + uint32_t read(::apache::thrift::protocol::TProtocol *iprot); + uint32_t write(::apache::thrift::protocol::TProtocol *oprot) const; + + virtual void printTo(std::ostream &out) const; }; void swap(partition_configuration &a, partition_configuration &b); -inline std::ostream& operator<<(std::ostream& out, const partition_configuration& obj) +inline std::ostream &operator<<(std::ostream &out, const partition_configuration &obj) { - obj.printTo(out); - return out; + obj.printTo(out); + return out; } -typedef struct _configuration_query_by_index_request__isset { - _configuration_query_by_index_request__isset() : app_name(false), partition_indices(false) {} - bool app_name :1; - bool partition_indices :1; +typedef struct _configuration_query_by_index_request__isset +{ + _configuration_query_by_index_request__isset() : app_name(false), partition_indices(false) {} + bool app_name : 1; + bool partition_indices : 1; } _configuration_query_by_index_request__isset; -class configuration_query_by_index_request { - public: - - configuration_query_by_index_request(const configuration_query_by_index_request&); - configuration_query_by_index_request(configuration_query_by_index_request&&); - configuration_query_by_index_request& operator=(const configuration_query_by_index_request&); - configuration_query_by_index_request& operator=(configuration_query_by_index_request&&); - configuration_query_by_index_request() : app_name() { - } - - virtual ~configuration_query_by_index_request() throw(); - std::string app_name; - std::vector partition_indices; - - _configuration_query_by_index_request__isset __isset; - - void __set_app_name(const std::string& val); - - void __set_partition_indices(const std::vector & val); - - bool operator == (const configuration_query_by_index_request & rhs) const - { - if (!(app_name == rhs.app_name)) - return false; - if (!(partition_indices == rhs.partition_indices)) - return false; - return true; - } - bool operator != (const configuration_query_by_index_request &rhs) const { - return !(*this == rhs); - } - - bool operator < (const configuration_query_by_index_request & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; +class configuration_query_by_index_request +{ +public: + configuration_query_by_index_request(const configuration_query_by_index_request &); + configuration_query_by_index_request(configuration_query_by_index_request &&); + configuration_query_by_index_request &operator=(const configuration_query_by_index_request &); + configuration_query_by_index_request &operator=(configuration_query_by_index_request &&); + configuration_query_by_index_request() : app_name() {} + + virtual ~configuration_query_by_index_request() throw(); + std::string app_name; + std::vector partition_indices; + + _configuration_query_by_index_request__isset __isset; + + void __set_app_name(const std::string &val); + + void __set_partition_indices(const std::vector &val); + + bool operator==(const configuration_query_by_index_request &rhs) const + { + if (!(app_name == rhs.app_name)) + return false; + if (!(partition_indices == rhs.partition_indices)) + return false; + return true; + } + bool operator!=(const configuration_query_by_index_request &rhs) const + { + return !(*this == rhs); + } + + bool operator<(const configuration_query_by_index_request &) const; + + uint32_t read(::apache::thrift::protocol::TProtocol *iprot); + uint32_t write(::apache::thrift::protocol::TProtocol *oprot) const; + + virtual void printTo(std::ostream &out) const; }; void swap(configuration_query_by_index_request &a, configuration_query_by_index_request &b); -inline std::ostream& operator<<(std::ostream& out, const configuration_query_by_index_request& obj) +inline std::ostream &operator<<(std::ostream &out, const configuration_query_by_index_request &obj) { - obj.printTo(out); - return out; + obj.printTo(out); + return out; } -typedef struct _configuration_query_by_index_response__isset { - _configuration_query_by_index_response__isset() : err(false), app_id(false), partition_count(false), is_stateful(false), partitions(false) {} - bool err :1; - bool app_id :1; - bool partition_count :1; - bool is_stateful :1; - bool partitions :1; +typedef struct _configuration_query_by_index_response__isset +{ + _configuration_query_by_index_response__isset() + : err(false), app_id(false), partition_count(false), is_stateful(false), partitions(false) + { + } + bool err : 1; + bool app_id : 1; + bool partition_count : 1; + bool is_stateful : 1; + bool partitions : 1; } _configuration_query_by_index_response__isset; -class configuration_query_by_index_response { - public: - - configuration_query_by_index_response(const configuration_query_by_index_response&); - configuration_query_by_index_response(configuration_query_by_index_response&&); - configuration_query_by_index_response& operator=(const configuration_query_by_index_response&); - configuration_query_by_index_response& operator=(configuration_query_by_index_response&&); - configuration_query_by_index_response() : app_id(0), partition_count(0), is_stateful(0) { - } - - virtual ~configuration_query_by_index_response() throw(); - ::dsn::error_code err; - int32_t app_id; - int32_t partition_count; - bool is_stateful; - std::vector partitions; - - _configuration_query_by_index_response__isset __isset; - - void __set_err(const ::dsn::error_code& val); - - void __set_app_id(const int32_t val); - - void __set_partition_count(const int32_t val); - - void __set_is_stateful(const bool val); - - void __set_partitions(const std::vector & val); - - bool operator == (const configuration_query_by_index_response & rhs) const - { - if (!(err == rhs.err)) - return false; - if (!(app_id == rhs.app_id)) - return false; - if (!(partition_count == rhs.partition_count)) - return false; - if (!(is_stateful == rhs.is_stateful)) - return false; - if (!(partitions == rhs.partitions)) - return false; - return true; - } - bool operator != (const configuration_query_by_index_response &rhs) const { - return !(*this == rhs); - } - - bool operator < (const configuration_query_by_index_response & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; +class configuration_query_by_index_response +{ +public: + configuration_query_by_index_response(const configuration_query_by_index_response &); + configuration_query_by_index_response(configuration_query_by_index_response &&); + configuration_query_by_index_response &operator=(const configuration_query_by_index_response &); + configuration_query_by_index_response &operator=(configuration_query_by_index_response &&); + configuration_query_by_index_response() : app_id(0), partition_count(0), is_stateful(0) {} + + virtual ~configuration_query_by_index_response() throw(); + ::dsn::error_code err; + int32_t app_id; + int32_t partition_count; + bool is_stateful; + std::vector partitions; + + _configuration_query_by_index_response__isset __isset; + + void __set_err(const ::dsn::error_code &val); + + void __set_app_id(const int32_t val); + + void __set_partition_count(const int32_t val); + + void __set_is_stateful(const bool val); + + void __set_partitions(const std::vector &val); + + bool operator==(const configuration_query_by_index_response &rhs) const + { + if (!(err == rhs.err)) + return false; + if (!(app_id == rhs.app_id)) + return false; + if (!(partition_count == rhs.partition_count)) + return false; + if (!(is_stateful == rhs.is_stateful)) + return false; + if (!(partitions == rhs.partitions)) + return false; + return true; + } + bool operator!=(const configuration_query_by_index_response &rhs) const + { + return !(*this == rhs); + } + + bool operator<(const configuration_query_by_index_response &) const; + + uint32_t read(::apache::thrift::protocol::TProtocol *iprot); + uint32_t write(::apache::thrift::protocol::TProtocol *oprot) const; + + virtual void printTo(std::ostream &out) const; }; void swap(configuration_query_by_index_response &a, configuration_query_by_index_response &b); -inline std::ostream& operator<<(std::ostream& out, const configuration_query_by_index_response& obj) +inline std::ostream &operator<<(std::ostream &out, const configuration_query_by_index_response &obj) { - obj.printTo(out); - return out; + obj.printTo(out); + return out; } -typedef struct _app_info__isset { - _app_info__isset() : status(true), app_type(false), app_name(false), app_id(false), partition_count(false), envs(false), is_stateful(false), max_replica_count(false), expire_second(false) {} - bool status :1; - bool app_type :1; - bool app_name :1; - bool app_id :1; - bool partition_count :1; - bool envs :1; - bool is_stateful :1; - bool max_replica_count :1; - bool expire_second :1; +typedef struct _app_info__isset +{ + _app_info__isset() + : status(true), + app_type(false), + app_name(false), + app_id(false), + partition_count(false), + envs(false), + is_stateful(false), + max_replica_count(false), + expire_second(false), + create_second(false), + drop_second(false) + { + } + bool status : 1; + bool app_type : 1; + bool app_name : 1; + bool app_id : 1; + bool partition_count : 1; + bool envs : 1; + bool is_stateful : 1; + bool max_replica_count : 1; + bool expire_second : 1; + bool create_second : 1; + bool drop_second : 1; } _app_info__isset; -class app_info { - public: - - app_info(const app_info&); - app_info(app_info&&); - app_info& operator=(const app_info&); - app_info& operator=(app_info&&); - app_info() : status((app_status::type)0), app_type(), app_name(), app_id(0), partition_count(0), is_stateful(0), max_replica_count(0), expire_second(0) { - status = (app_status::type)0; - - } - - virtual ~app_info() throw(); - app_status::type status; - std::string app_type; - std::string app_name; - int32_t app_id; - int32_t partition_count; - std::map envs; - bool is_stateful; - int32_t max_replica_count; - int64_t expire_second; - - _app_info__isset __isset; - - void __set_status(const app_status::type val); - - void __set_app_type(const std::string& val); - - void __set_app_name(const std::string& val); - - void __set_app_id(const int32_t val); - - void __set_partition_count(const int32_t val); - - void __set_envs(const std::map & val); - - void __set_is_stateful(const bool val); - - void __set_max_replica_count(const int32_t val); - - void __set_expire_second(const int64_t val); - - bool operator == (const app_info & rhs) const - { - if (!(status == rhs.status)) - return false; - if (!(app_type == rhs.app_type)) - return false; - if (!(app_name == rhs.app_name)) - return false; - if (!(app_id == rhs.app_id)) - return false; - if (!(partition_count == rhs.partition_count)) - return false; - if (!(envs == rhs.envs)) - return false; - if (!(is_stateful == rhs.is_stateful)) - return false; - if (!(max_replica_count == rhs.max_replica_count)) - return false; - if (!(expire_second == rhs.expire_second)) - return false; - return true; - } - bool operator != (const app_info &rhs) const { - return !(*this == rhs); - } - - bool operator < (const app_info & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; +class app_info +{ +public: + app_info(const app_info &); + app_info(app_info &&); + app_info &operator=(const app_info &); + app_info &operator=(app_info &&); + app_info() + : status((app_status::type)0), + app_type(), + app_name(), + app_id(0), + partition_count(0), + is_stateful(0), + max_replica_count(0), + expire_second(0), + create_second(0), + drop_second(0) + { + status = (app_status::type)0; + } + + virtual ~app_info() throw(); + app_status::type status; + std::string app_type; + std::string app_name; + int32_t app_id; + int32_t partition_count; + std::map envs; + bool is_stateful; + int32_t max_replica_count; + int64_t expire_second; + int64_t create_second; + int64_t drop_second; + + _app_info__isset __isset; + + void __set_status(const app_status::type val); + + void __set_app_type(const std::string &val); + + void __set_app_name(const std::string &val); + + void __set_app_id(const int32_t val); + + void __set_partition_count(const int32_t val); + + void __set_envs(const std::map &val); + + void __set_is_stateful(const bool val); + + void __set_max_replica_count(const int32_t val); + + void __set_expire_second(const int64_t val); + + void __set_create_second(const int64_t val); + + void __set_drop_second(const int64_t val); + + bool operator==(const app_info &rhs) const + { + if (!(status == rhs.status)) + return false; + if (!(app_type == rhs.app_type)) + return false; + if (!(app_name == rhs.app_name)) + return false; + if (!(app_id == rhs.app_id)) + return false; + if (!(partition_count == rhs.partition_count)) + return false; + if (!(envs == rhs.envs)) + return false; + if (!(is_stateful == rhs.is_stateful)) + return false; + if (!(max_replica_count == rhs.max_replica_count)) + return false; + if (!(expire_second == rhs.expire_second)) + return false; + if (!(create_second == rhs.create_second)) + return false; + if (!(drop_second == rhs.drop_second)) + return false; + return true; + } + bool operator!=(const app_info &rhs) const { return !(*this == rhs); } + + bool operator<(const app_info &) const; + + uint32_t read(::apache::thrift::protocol::TProtocol *iprot); + uint32_t write(::apache::thrift::protocol::TProtocol *oprot) const; + + virtual void printTo(std::ostream &out) const; }; void swap(app_info &a, app_info &b); -inline std::ostream& operator<<(std::ostream& out, const app_info& obj) +inline std::ostream &operator<<(std::ostream &out, const app_info &obj) { - obj.printTo(out); - return out; + obj.printTo(out); + return out; } } // namespace diff --git a/include/dsn/dist/replication/replication_ddl_client.h b/include/dsn/dist/replication/replication_ddl_client.h index 9740011ac6..4e403b07a7 100644 --- a/include/dsn/dist/replication/replication_ddl_client.h +++ b/include/dsn/dist/replication/replication_ddl_client.h @@ -172,6 +172,12 @@ class replication_ddl_client dsn::error_code clear_app_envs(const std::string &app_name, bool clear_all, const std::string &prefix); + // print table to format columns as the same width. + // return false if column count is not the same for all rows. + bool print_table(const std::vector> &table, + std::ostream &output, + const std::string &column_delimiter = " "); + private: bool static valid_app_char(int c); diff --git a/src/core/core/dsn.layer2_types.cpp b/src/core/core/dsn.layer2_types.cpp index 3df4fae7c5..f50d65bf0f 100644 --- a/src/core/core/dsn.layer2_types.cpp +++ b/src/core/core/dsn.layer2_types.cpp @@ -13,952 +13,1013 @@ namespace dsn { -int _kapp_statusValues[] = { - app_status::AS_INVALID, - app_status::AS_AVAILABLE, - app_status::AS_CREATING, - app_status::AS_CREATE_FAILED, - app_status::AS_DROPPING, - app_status::AS_DROP_FAILED, - app_status::AS_DROPPED, - app_status::AS_RECALLING -}; -const char* _kapp_statusNames[] = { - "AS_INVALID", - "AS_AVAILABLE", - "AS_CREATING", - "AS_CREATE_FAILED", - "AS_DROPPING", - "AS_DROP_FAILED", - "AS_DROPPED", - "AS_RECALLING" -}; -const std::map _app_status_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(8, _kapp_statusValues, _kapp_statusNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); - - -partition_configuration::~partition_configuration() throw() { +int _kapp_statusValues[] = {app_status::AS_INVALID, + app_status::AS_AVAILABLE, + app_status::AS_CREATING, + app_status::AS_CREATE_FAILED, + app_status::AS_DROPPING, + app_status::AS_DROP_FAILED, + app_status::AS_DROPPED, + app_status::AS_RECALLING}; +const char *_kapp_statusNames[] = {"AS_INVALID", + "AS_AVAILABLE", + "AS_CREATING", + "AS_CREATE_FAILED", + "AS_DROPPING", + "AS_DROP_FAILED", + "AS_DROPPED", + "AS_RECALLING"}; +const std::map _app_status_VALUES_TO_NAMES( + ::apache::thrift::TEnumIterator(8, _kapp_statusValues, _kapp_statusNames), + ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +partition_configuration::~partition_configuration() throw() {} + +void partition_configuration::__set_pid(const ::dsn::gpid &val) { this->pid = val; } + +void partition_configuration::__set_ballot(const int64_t val) { this->ballot = val; } + +void partition_configuration::__set_max_replica_count(const int32_t val) +{ + this->max_replica_count = val; } +void partition_configuration::__set_primary(const ::dsn::rpc_address &val) { this->primary = val; } -void partition_configuration::__set_pid(const ::dsn::gpid& val) { - this->pid = val; +void partition_configuration::__set_secondaries(const std::vector<::dsn::rpc_address> &val) +{ + this->secondaries = val; } -void partition_configuration::__set_ballot(const int64_t val) { - this->ballot = val; +void partition_configuration::__set_last_drops(const std::vector<::dsn::rpc_address> &val) +{ + this->last_drops = val; } -void partition_configuration::__set_max_replica_count(const int32_t val) { - this->max_replica_count = val; +void partition_configuration::__set_last_committed_decree(const int64_t val) +{ + this->last_committed_decree = val; } -void partition_configuration::__set_primary(const ::dsn::rpc_address& val) { - this->primary = val; +void partition_configuration::__set_partition_flags(const int32_t val) +{ + this->partition_flags = val; } -void partition_configuration::__set_secondaries(const std::vector< ::dsn::rpc_address> & val) { - this->secondaries = val; -} +uint32_t partition_configuration::read(::apache::thrift::protocol::TProtocol *iprot) +{ -void partition_configuration::__set_last_drops(const std::vector< ::dsn::rpc_address> & val) { - this->last_drops = val; -} + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; -void partition_configuration::__set_last_committed_decree(const int64_t val) { - this->last_committed_decree = val; -} + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + while (true) { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->pid.read(iprot); + this->__isset.pid = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->ballot); + this->__isset.ballot = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->max_replica_count); + this->__isset.max_replica_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->primary.read(iprot); + this->__isset.primary = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->secondaries.clear(); + uint32_t _size0; + ::apache::thrift::protocol::TType _etype3; + xfer += iprot->readListBegin(_etype3, _size0); + this->secondaries.resize(_size0); + uint32_t _i4; + for (_i4 = 0; _i4 < _size0; ++_i4) { + xfer += this->secondaries[_i4].read(iprot); + } + xfer += iprot->readListEnd(); + } + this->__isset.secondaries = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->last_drops.clear(); + uint32_t _size5; + ::apache::thrift::protocol::TType _etype8; + xfer += iprot->readListBegin(_etype8, _size5); + this->last_drops.resize(_size5); + uint32_t _i9; + for (_i9 = 0; _i9 < _size5; ++_i9) { + xfer += this->last_drops[_i9].read(iprot); + } + xfer += iprot->readListEnd(); + } + this->__isset.last_drops = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 7: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->last_committed_decree); + this->__isset.last_committed_decree = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 8: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->partition_flags); + this->__isset.partition_flags = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } -void partition_configuration::__set_partition_flags(const int32_t val) { - this->partition_flags = val; + xfer += iprot->readStructEnd(); + + return xfer; } -uint32_t partition_configuration::read(::apache::thrift::protocol::TProtocol* iprot) { +uint32_t partition_configuration::write(::apache::thrift::protocol::TProtocol *oprot) const +{ + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("partition_configuration"); - apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; + xfer += oprot->writeFieldBegin("pid", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->pid.write(oprot); + xfer += oprot->writeFieldEnd(); - xfer += iprot->readStructBegin(fname); + xfer += oprot->writeFieldBegin("ballot", ::apache::thrift::protocol::T_I64, 2); + xfer += oprot->writeI64(this->ballot); + xfer += oprot->writeFieldEnd(); - using ::apache::thrift::protocol::TProtocolException; + xfer += oprot->writeFieldBegin("max_replica_count", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32(this->max_replica_count); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("primary", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->primary.write(oprot); + xfer += oprot->writeFieldEnd(); - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) + xfer += oprot->writeFieldBegin("secondaries", ::apache::thrift::protocol::T_LIST, 5); { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->pid.read(iprot); - this->__isset.pid = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->ballot); - this->__isset.ballot = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->max_replica_count); - this->__isset.max_replica_count = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->primary.read(iprot); - this->__isset.primary = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->secondaries.clear(); - uint32_t _size0; - ::apache::thrift::protocol::TType _etype3; - xfer += iprot->readListBegin(_etype3, _size0); - this->secondaries.resize(_size0); - uint32_t _i4; - for (_i4 = 0; _i4 < _size0; ++_i4) - { - xfer += this->secondaries[_i4].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.secondaries = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 6: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->last_drops.clear(); - uint32_t _size5; - ::apache::thrift::protocol::TType _etype8; - xfer += iprot->readListBegin(_etype8, _size5); - this->last_drops.resize(_size5); - uint32_t _i9; - for (_i9 = 0; _i9 < _size5; ++_i9) - { - xfer += this->last_drops[_i9].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.last_drops = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 7: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->last_committed_decree); - this->__isset.last_committed_decree = true; - } else { - xfer += iprot->skip(ftype); + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, + static_cast(this->secondaries.size())); + std::vector<::dsn::rpc_address>::const_iterator _iter10; + for (_iter10 = this->secondaries.begin(); _iter10 != this->secondaries.end(); ++_iter10) { + xfer += (*_iter10).write(oprot); } - break; - case 8: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->partition_flags); - this->__isset.partition_flags = true; - } else { - xfer += iprot->skip(ftype); + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("last_drops", ::apache::thrift::protocol::T_LIST, 6); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, + static_cast(this->last_drops.size())); + std::vector<::dsn::rpc_address>::const_iterator _iter11; + for (_iter11 = this->last_drops.begin(); _iter11 != this->last_drops.end(); ++_iter11) { + xfer += (*_iter11).write(oprot); } - break; - default: - xfer += iprot->skip(ftype); - break; + xfer += oprot->writeListEnd(); } - xfer += iprot->readFieldEnd(); - } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("last_committed_decree", ::apache::thrift::protocol::T_I64, 7); + xfer += oprot->writeI64(this->last_committed_decree); + xfer += oprot->writeFieldEnd(); - xfer += iprot->readStructEnd(); + xfer += oprot->writeFieldBegin("partition_flags", ::apache::thrift::protocol::T_I32, 8); + xfer += oprot->writeI32(this->partition_flags); + xfer += oprot->writeFieldEnd(); - return xfer; + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; } -uint32_t partition_configuration::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("partition_configuration"); +void swap(partition_configuration &a, partition_configuration &b) +{ + using ::std::swap; + swap(a.pid, b.pid); + swap(a.ballot, b.ballot); + swap(a.max_replica_count, b.max_replica_count); + swap(a.primary, b.primary); + swap(a.secondaries, b.secondaries); + swap(a.last_drops, b.last_drops); + swap(a.last_committed_decree, b.last_committed_decree); + swap(a.partition_flags, b.partition_flags); + swap(a.__isset, b.__isset); +} - xfer += oprot->writeFieldBegin("pid", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->pid.write(oprot); - xfer += oprot->writeFieldEnd(); +partition_configuration::partition_configuration(const partition_configuration &other12) +{ + pid = other12.pid; + ballot = other12.ballot; + max_replica_count = other12.max_replica_count; + primary = other12.primary; + secondaries = other12.secondaries; + last_drops = other12.last_drops; + last_committed_decree = other12.last_committed_decree; + partition_flags = other12.partition_flags; + __isset = other12.__isset; +} +partition_configuration::partition_configuration(partition_configuration &&other13) +{ + pid = std::move(other13.pid); + ballot = std::move(other13.ballot); + max_replica_count = std::move(other13.max_replica_count); + primary = std::move(other13.primary); + secondaries = std::move(other13.secondaries); + last_drops = std::move(other13.last_drops); + last_committed_decree = std::move(other13.last_committed_decree); + partition_flags = std::move(other13.partition_flags); + __isset = std::move(other13.__isset); +} +partition_configuration &partition_configuration::operator=(const partition_configuration &other14) +{ + pid = other14.pid; + ballot = other14.ballot; + max_replica_count = other14.max_replica_count; + primary = other14.primary; + secondaries = other14.secondaries; + last_drops = other14.last_drops; + last_committed_decree = other14.last_committed_decree; + partition_flags = other14.partition_flags; + __isset = other14.__isset; + return *this; +} +partition_configuration &partition_configuration::operator=(partition_configuration &&other15) +{ + pid = std::move(other15.pid); + ballot = std::move(other15.ballot); + max_replica_count = std::move(other15.max_replica_count); + primary = std::move(other15.primary); + secondaries = std::move(other15.secondaries); + last_drops = std::move(other15.last_drops); + last_committed_decree = std::move(other15.last_committed_decree); + partition_flags = std::move(other15.partition_flags); + __isset = std::move(other15.__isset); + return *this; +} +void partition_configuration::printTo(std::ostream &out) const +{ + using ::apache::thrift::to_string; + out << "partition_configuration("; + out << "pid=" << to_string(pid); + out << ", " + << "ballot=" << to_string(ballot); + out << ", " + << "max_replica_count=" << to_string(max_replica_count); + out << ", " + << "primary=" << to_string(primary); + out << ", " + << "secondaries=" << to_string(secondaries); + out << ", " + << "last_drops=" << to_string(last_drops); + out << ", " + << "last_committed_decree=" << to_string(last_committed_decree); + out << ", " + << "partition_flags=" << to_string(partition_flags); + out << ")"; +} - xfer += oprot->writeFieldBegin("ballot", ::apache::thrift::protocol::T_I64, 2); - xfer += oprot->writeI64(this->ballot); - xfer += oprot->writeFieldEnd(); +configuration_query_by_index_request::~configuration_query_by_index_request() throw() {} - xfer += oprot->writeFieldBegin("max_replica_count", ::apache::thrift::protocol::T_I32, 3); - xfer += oprot->writeI32(this->max_replica_count); - xfer += oprot->writeFieldEnd(); +void configuration_query_by_index_request::__set_app_name(const std::string &val) +{ + this->app_name = val; +} - xfer += oprot->writeFieldBegin("primary", ::apache::thrift::protocol::T_STRUCT, 4); - xfer += this->primary.write(oprot); - xfer += oprot->writeFieldEnd(); +void configuration_query_by_index_request::__set_partition_indices(const std::vector &val) +{ + this->partition_indices = val; +} - xfer += oprot->writeFieldBegin("secondaries", ::apache::thrift::protocol::T_LIST, 5); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->secondaries.size())); - std::vector< ::dsn::rpc_address> ::const_iterator _iter10; - for (_iter10 = this->secondaries.begin(); _iter10 != this->secondaries.end(); ++_iter10) - { - xfer += (*_iter10).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("last_drops", ::apache::thrift::protocol::T_LIST, 6); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->last_drops.size())); - std::vector< ::dsn::rpc_address> ::const_iterator _iter11; - for (_iter11 = this->last_drops.begin(); _iter11 != this->last_drops.end(); ++_iter11) - { - xfer += (*_iter11).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("last_committed_decree", ::apache::thrift::protocol::T_I64, 7); - xfer += oprot->writeI64(this->last_committed_decree); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("partition_flags", ::apache::thrift::protocol::T_I32, 8); - xfer += oprot->writeI32(this->partition_flags); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(partition_configuration &a, partition_configuration &b) { - using ::std::swap; - swap(a.pid, b.pid); - swap(a.ballot, b.ballot); - swap(a.max_replica_count, b.max_replica_count); - swap(a.primary, b.primary); - swap(a.secondaries, b.secondaries); - swap(a.last_drops, b.last_drops); - swap(a.last_committed_decree, b.last_committed_decree); - swap(a.partition_flags, b.partition_flags); - swap(a.__isset, b.__isset); -} - -partition_configuration::partition_configuration(const partition_configuration& other12) { - pid = other12.pid; - ballot = other12.ballot; - max_replica_count = other12.max_replica_count; - primary = other12.primary; - secondaries = other12.secondaries; - last_drops = other12.last_drops; - last_committed_decree = other12.last_committed_decree; - partition_flags = other12.partition_flags; - __isset = other12.__isset; -} -partition_configuration::partition_configuration( partition_configuration&& other13) { - pid = std::move(other13.pid); - ballot = std::move(other13.ballot); - max_replica_count = std::move(other13.max_replica_count); - primary = std::move(other13.primary); - secondaries = std::move(other13.secondaries); - last_drops = std::move(other13.last_drops); - last_committed_decree = std::move(other13.last_committed_decree); - partition_flags = std::move(other13.partition_flags); - __isset = std::move(other13.__isset); -} -partition_configuration& partition_configuration::operator=(const partition_configuration& other14) { - pid = other14.pid; - ballot = other14.ballot; - max_replica_count = other14.max_replica_count; - primary = other14.primary; - secondaries = other14.secondaries; - last_drops = other14.last_drops; - last_committed_decree = other14.last_committed_decree; - partition_flags = other14.partition_flags; - __isset = other14.__isset; - return *this; -} -partition_configuration& partition_configuration::operator=(partition_configuration&& other15) { - pid = std::move(other15.pid); - ballot = std::move(other15.ballot); - max_replica_count = std::move(other15.max_replica_count); - primary = std::move(other15.primary); - secondaries = std::move(other15.secondaries); - last_drops = std::move(other15.last_drops); - last_committed_decree = std::move(other15.last_committed_decree); - partition_flags = std::move(other15.partition_flags); - __isset = std::move(other15.__isset); - return *this; -} -void partition_configuration::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "partition_configuration("; - out << "pid=" << to_string(pid); - out << ", " << "ballot=" << to_string(ballot); - out << ", " << "max_replica_count=" << to_string(max_replica_count); - out << ", " << "primary=" << to_string(primary); - out << ", " << "secondaries=" << to_string(secondaries); - out << ", " << "last_drops=" << to_string(last_drops); - out << ", " << "last_committed_decree=" << to_string(last_committed_decree); - out << ", " << "partition_flags=" << to_string(partition_flags); - out << ")"; -} - - -configuration_query_by_index_request::~configuration_query_by_index_request() throw() { -} - - -void configuration_query_by_index_request::__set_app_name(const std::string& val) { - this->app_name = val; -} - -void configuration_query_by_index_request::__set_partition_indices(const std::vector & val) { - this->partition_indices = val; -} - -uint32_t configuration_query_by_index_request::read(::apache::thrift::protocol::TProtocol* iprot) { - - apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->app_name); - this->__isset.app_name = true; - } else { - xfer += iprot->skip(ftype); +uint32_t configuration_query_by_index_request::read(::apache::thrift::protocol::TProtocol *iprot) +{ + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + while (true) { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->partition_indices.clear(); - uint32_t _size16; - ::apache::thrift::protocol::TType _etype19; - xfer += iprot->readListBegin(_etype19, _size16); - this->partition_indices.resize(_size16); - uint32_t _i20; - for (_i20 = 0; _i20 < _size16; ++_i20) - { - xfer += iprot->readI32(this->partition_indices[_i20]); + switch (fid) { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->app_name); + this->__isset.app_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->partition_indices.clear(); + uint32_t _size16; + ::apache::thrift::protocol::TType _etype19; + xfer += iprot->readListBegin(_etype19, _size16); + this->partition_indices.resize(_size16); + uint32_t _i20; + for (_i20 = 0; _i20 < _size16; ++_i20) { + xfer += iprot->readI32(this->partition_indices[_i20]); + } + xfer += iprot->readListEnd(); + } + this->__isset.partition_indices = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readListEnd(); - } - this->__isset.partition_indices = true; - } else { - xfer += iprot->skip(ftype); + break; + default: + xfer += iprot->skip(ftype); + break; } - break; - default: - xfer += iprot->skip(ftype); - break; + xfer += iprot->readFieldEnd(); } - xfer += iprot->readFieldEnd(); - } - xfer += iprot->readStructEnd(); + xfer += iprot->readStructEnd(); - return xfer; + return xfer; } -uint32_t configuration_query_by_index_request::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("configuration_query_by_index_request"); +uint32_t +configuration_query_by_index_request::write(::apache::thrift::protocol::TProtocol *oprot) const +{ + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("configuration_query_by_index_request"); - xfer += oprot->writeFieldBegin("app_name", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->app_name); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("app_name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->app_name); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("partition_indices", ::apache::thrift::protocol::T_LIST, 2); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast(this->partition_indices.size())); - std::vector ::const_iterator _iter21; - for (_iter21 = this->partition_indices.begin(); _iter21 != this->partition_indices.end(); ++_iter21) + xfer += oprot->writeFieldBegin("partition_indices", ::apache::thrift::protocol::T_LIST, 2); { - xfer += oprot->writeI32((*_iter21)); + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, + static_cast(this->partition_indices.size())); + std::vector::const_iterator _iter21; + for (_iter21 = this->partition_indices.begin(); _iter21 != this->partition_indices.end(); + ++_iter21) { + xfer += oprot->writeI32((*_iter21)); + } + xfer += oprot->writeListEnd(); } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; } -void swap(configuration_query_by_index_request &a, configuration_query_by_index_request &b) { - using ::std::swap; - swap(a.app_name, b.app_name); - swap(a.partition_indices, b.partition_indices); - swap(a.__isset, b.__isset); +void swap(configuration_query_by_index_request &a, configuration_query_by_index_request &b) +{ + using ::std::swap; + swap(a.app_name, b.app_name); + swap(a.partition_indices, b.partition_indices); + swap(a.__isset, b.__isset); } -configuration_query_by_index_request::configuration_query_by_index_request(const configuration_query_by_index_request& other22) { - app_name = other22.app_name; - partition_indices = other22.partition_indices; - __isset = other22.__isset; +configuration_query_by_index_request::configuration_query_by_index_request( + const configuration_query_by_index_request &other22) +{ + app_name = other22.app_name; + partition_indices = other22.partition_indices; + __isset = other22.__isset; } -configuration_query_by_index_request::configuration_query_by_index_request( configuration_query_by_index_request&& other23) { - app_name = std::move(other23.app_name); - partition_indices = std::move(other23.partition_indices); - __isset = std::move(other23.__isset); +configuration_query_by_index_request::configuration_query_by_index_request( + configuration_query_by_index_request &&other23) +{ + app_name = std::move(other23.app_name); + partition_indices = std::move(other23.partition_indices); + __isset = std::move(other23.__isset); } -configuration_query_by_index_request& configuration_query_by_index_request::operator=(const configuration_query_by_index_request& other24) { - app_name = other24.app_name; - partition_indices = other24.partition_indices; - __isset = other24.__isset; - return *this; +configuration_query_by_index_request &configuration_query_by_index_request:: +operator=(const configuration_query_by_index_request &other24) +{ + app_name = other24.app_name; + partition_indices = other24.partition_indices; + __isset = other24.__isset; + return *this; } -configuration_query_by_index_request& configuration_query_by_index_request::operator=(configuration_query_by_index_request&& other25) { - app_name = std::move(other25.app_name); - partition_indices = std::move(other25.partition_indices); - __isset = std::move(other25.__isset); - return *this; +configuration_query_by_index_request &configuration_query_by_index_request:: +operator=(configuration_query_by_index_request &&other25) +{ + app_name = std::move(other25.app_name); + partition_indices = std::move(other25.partition_indices); + __isset = std::move(other25.__isset); + return *this; } -void configuration_query_by_index_request::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "configuration_query_by_index_request("; - out << "app_name=" << to_string(app_name); - out << ", " << "partition_indices=" << to_string(partition_indices); - out << ")"; +void configuration_query_by_index_request::printTo(std::ostream &out) const +{ + using ::apache::thrift::to_string; + out << "configuration_query_by_index_request("; + out << "app_name=" << to_string(app_name); + out << ", " + << "partition_indices=" << to_string(partition_indices); + out << ")"; } +configuration_query_by_index_response::~configuration_query_by_index_response() throw() {} -configuration_query_by_index_response::~configuration_query_by_index_response() throw() { +void configuration_query_by_index_response::__set_err(const ::dsn::error_code &val) +{ + this->err = val; } +void configuration_query_by_index_response::__set_app_id(const int32_t val) { this->app_id = val; } -void configuration_query_by_index_response::__set_err(const ::dsn::error_code& val) { - this->err = val; -} - -void configuration_query_by_index_response::__set_app_id(const int32_t val) { - this->app_id = val; -} - -void configuration_query_by_index_response::__set_partition_count(const int32_t val) { - this->partition_count = val; +void configuration_query_by_index_response::__set_partition_count(const int32_t val) +{ + this->partition_count = val; } -void configuration_query_by_index_response::__set_is_stateful(const bool val) { - this->is_stateful = val; +void configuration_query_by_index_response::__set_is_stateful(const bool val) +{ + this->is_stateful = val; } -void configuration_query_by_index_response::__set_partitions(const std::vector & val) { - this->partitions = val; +void configuration_query_by_index_response::__set_partitions( + const std::vector &val) +{ + this->partitions = val; } -uint32_t configuration_query_by_index_response::read(::apache::thrift::protocol::TProtocol* iprot) { +uint32_t configuration_query_by_index_response::read(::apache::thrift::protocol::TProtocol *iprot) +{ - apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; - xfer += iprot->readStructBegin(fname); + xfer += iprot->readStructBegin(fname); - using ::apache::thrift::protocol::TProtocolException; + using ::apache::thrift::protocol::TProtocolException; - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->err.read(iprot); - this->__isset.err = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->app_id); - this->__isset.app_id = true; - } else { - xfer += iprot->skip(ftype); + while (true) { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->partition_count); - this->__isset.partition_count = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool(this->is_stateful); - this->__isset.is_stateful = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->partitions.clear(); - uint32_t _size26; - ::apache::thrift::protocol::TType _etype29; - xfer += iprot->readListBegin(_etype29, _size26); - this->partitions.resize(_size26); - uint32_t _i30; - for (_i30 = 0; _i30 < _size26; ++_i30) - { - xfer += this->partitions[_i30].read(iprot); + switch (fid) { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->err.read(iprot); + this->__isset.err = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->app_id); + this->__isset.app_id = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readListEnd(); - } - this->__isset.partitions = true; - } else { - xfer += iprot->skip(ftype); + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->partition_count); + this->__isset.partition_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->is_stateful); + this->__isset.is_stateful = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->partitions.clear(); + uint32_t _size26; + ::apache::thrift::protocol::TType _etype29; + xfer += iprot->readListBegin(_etype29, _size26); + this->partitions.resize(_size26); + uint32_t _i30; + for (_i30 = 0; _i30 < _size26; ++_i30) { + xfer += this->partitions[_i30].read(iprot); + } + xfer += iprot->readListEnd(); + } + this->__isset.partitions = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; } - break; - default: - xfer += iprot->skip(ftype); - break; + xfer += iprot->readFieldEnd(); } - xfer += iprot->readFieldEnd(); - } - xfer += iprot->readStructEnd(); + xfer += iprot->readStructEnd(); - return xfer; + return xfer; } -uint32_t configuration_query_by_index_response::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("configuration_query_by_index_response"); +uint32_t +configuration_query_by_index_response::write(::apache::thrift::protocol::TProtocol *oprot) const +{ + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("configuration_query_by_index_response"); - xfer += oprot->writeFieldBegin("err", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->err.write(oprot); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("err", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->err.write(oprot); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("app_id", ::apache::thrift::protocol::T_I32, 2); - xfer += oprot->writeI32(this->app_id); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("app_id", ::apache::thrift::protocol::T_I32, 2); + xfer += oprot->writeI32(this->app_id); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("partition_count", ::apache::thrift::protocol::T_I32, 3); - xfer += oprot->writeI32(this->partition_count); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("partition_count", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32(this->partition_count); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("is_stateful", ::apache::thrift::protocol::T_BOOL, 4); - xfer += oprot->writeBool(this->is_stateful); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("is_stateful", ::apache::thrift::protocol::T_BOOL, 4); + xfer += oprot->writeBool(this->is_stateful); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("partitions", ::apache::thrift::protocol::T_LIST, 5); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->partitions.size())); - std::vector ::const_iterator _iter31; - for (_iter31 = this->partitions.begin(); _iter31 != this->partitions.end(); ++_iter31) + xfer += oprot->writeFieldBegin("partitions", ::apache::thrift::protocol::T_LIST, 5); { - xfer += (*_iter31).write(oprot); + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, + static_cast(this->partitions.size())); + std::vector::const_iterator _iter31; + for (_iter31 = this->partitions.begin(); _iter31 != this->partitions.end(); ++_iter31) { + xfer += (*_iter31).write(oprot); + } + xfer += oprot->writeListEnd(); } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; } -void swap(configuration_query_by_index_response &a, configuration_query_by_index_response &b) { - using ::std::swap; - swap(a.err, b.err); - swap(a.app_id, b.app_id); - swap(a.partition_count, b.partition_count); - swap(a.is_stateful, b.is_stateful); - swap(a.partitions, b.partitions); - swap(a.__isset, b.__isset); +void swap(configuration_query_by_index_response &a, configuration_query_by_index_response &b) +{ + using ::std::swap; + swap(a.err, b.err); + swap(a.app_id, b.app_id); + swap(a.partition_count, b.partition_count); + swap(a.is_stateful, b.is_stateful); + swap(a.partitions, b.partitions); + swap(a.__isset, b.__isset); } -configuration_query_by_index_response::configuration_query_by_index_response(const configuration_query_by_index_response& other32) { - err = other32.err; - app_id = other32.app_id; - partition_count = other32.partition_count; - is_stateful = other32.is_stateful; - partitions = other32.partitions; - __isset = other32.__isset; +configuration_query_by_index_response::configuration_query_by_index_response( + const configuration_query_by_index_response &other32) +{ + err = other32.err; + app_id = other32.app_id; + partition_count = other32.partition_count; + is_stateful = other32.is_stateful; + partitions = other32.partitions; + __isset = other32.__isset; } -configuration_query_by_index_response::configuration_query_by_index_response( configuration_query_by_index_response&& other33) { - err = std::move(other33.err); - app_id = std::move(other33.app_id); - partition_count = std::move(other33.partition_count); - is_stateful = std::move(other33.is_stateful); - partitions = std::move(other33.partitions); - __isset = std::move(other33.__isset); +configuration_query_by_index_response::configuration_query_by_index_response( + configuration_query_by_index_response &&other33) +{ + err = std::move(other33.err); + app_id = std::move(other33.app_id); + partition_count = std::move(other33.partition_count); + is_stateful = std::move(other33.is_stateful); + partitions = std::move(other33.partitions); + __isset = std::move(other33.__isset); } -configuration_query_by_index_response& configuration_query_by_index_response::operator=(const configuration_query_by_index_response& other34) { - err = other34.err; - app_id = other34.app_id; - partition_count = other34.partition_count; - is_stateful = other34.is_stateful; - partitions = other34.partitions; - __isset = other34.__isset; - return *this; +configuration_query_by_index_response &configuration_query_by_index_response:: +operator=(const configuration_query_by_index_response &other34) +{ + err = other34.err; + app_id = other34.app_id; + partition_count = other34.partition_count; + is_stateful = other34.is_stateful; + partitions = other34.partitions; + __isset = other34.__isset; + return *this; } -configuration_query_by_index_response& configuration_query_by_index_response::operator=(configuration_query_by_index_response&& other35) { - err = std::move(other35.err); - app_id = std::move(other35.app_id); - partition_count = std::move(other35.partition_count); - is_stateful = std::move(other35.is_stateful); - partitions = std::move(other35.partitions); - __isset = std::move(other35.__isset); - return *this; +configuration_query_by_index_response &configuration_query_by_index_response:: +operator=(configuration_query_by_index_response &&other35) +{ + err = std::move(other35.err); + app_id = std::move(other35.app_id); + partition_count = std::move(other35.partition_count); + is_stateful = std::move(other35.is_stateful); + partitions = std::move(other35.partitions); + __isset = std::move(other35.__isset); + return *this; } -void configuration_query_by_index_response::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "configuration_query_by_index_response("; - out << "err=" << to_string(err); - out << ", " << "app_id=" << to_string(app_id); - out << ", " << "partition_count=" << to_string(partition_count); - out << ", " << "is_stateful=" << to_string(is_stateful); - out << ", " << "partitions=" << to_string(partitions); - out << ")"; +void configuration_query_by_index_response::printTo(std::ostream &out) const +{ + using ::apache::thrift::to_string; + out << "configuration_query_by_index_response("; + out << "err=" << to_string(err); + out << ", " + << "app_id=" << to_string(app_id); + out << ", " + << "partition_count=" << to_string(partition_count); + out << ", " + << "is_stateful=" << to_string(is_stateful); + out << ", " + << "partitions=" << to_string(partitions); + out << ")"; } +app_info::~app_info() throw() {} -app_info::~app_info() throw() { -} - +void app_info::__set_status(const app_status::type val) { this->status = val; } -void app_info::__set_status(const app_status::type val) { - this->status = val; -} +void app_info::__set_app_type(const std::string &val) { this->app_type = val; } -void app_info::__set_app_type(const std::string& val) { - this->app_type = val; -} +void app_info::__set_app_name(const std::string &val) { this->app_name = val; } -void app_info::__set_app_name(const std::string& val) { - this->app_name = val; -} +void app_info::__set_app_id(const int32_t val) { this->app_id = val; } -void app_info::__set_app_id(const int32_t val) { - this->app_id = val; -} +void app_info::__set_partition_count(const int32_t val) { this->partition_count = val; } -void app_info::__set_partition_count(const int32_t val) { - this->partition_count = val; -} +void app_info::__set_envs(const std::map &val) { this->envs = val; } -void app_info::__set_envs(const std::map & val) { - this->envs = val; -} +void app_info::__set_is_stateful(const bool val) { this->is_stateful = val; } -void app_info::__set_is_stateful(const bool val) { - this->is_stateful = val; -} +void app_info::__set_max_replica_count(const int32_t val) { this->max_replica_count = val; } -void app_info::__set_max_replica_count(const int32_t val) { - this->max_replica_count = val; -} +void app_info::__set_expire_second(const int64_t val) { this->expire_second = val; } -void app_info::__set_expire_second(const int64_t val) { - this->expire_second = val; -} +void app_info::__set_create_second(const int64_t val) { this->create_second = val; } -uint32_t app_info::read(::apache::thrift::protocol::TProtocol* iprot) { +void app_info::__set_drop_second(const int64_t val) { this->drop_second = val; } - apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; +uint32_t app_info::read(::apache::thrift::protocol::TProtocol *iprot) +{ - xfer += iprot->readStructBegin(fname); + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; - using ::apache::thrift::protocol::TProtocolException; + xfer += iprot->readStructBegin(fname); + using ::apache::thrift::protocol::TProtocolException; - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast36; - xfer += iprot->readI32(ecast36); - this->status = (app_status::type)ecast36; - this->__isset.status = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->app_type); - this->__isset.app_type = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->app_name); - this->__isset.app_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->app_id); - this->__isset.app_id = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->partition_count); - this->__isset.partition_count = true; - } else { - xfer += iprot->skip(ftype); + while (true) { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; } - break; - case 6: - if (ftype == ::apache::thrift::protocol::T_MAP) { - { - this->envs.clear(); - uint32_t _size37; - ::apache::thrift::protocol::TType _ktype38; - ::apache::thrift::protocol::TType _vtype39; - xfer += iprot->readMapBegin(_ktype38, _vtype39, _size37); - uint32_t _i41; - for (_i41 = 0; _i41 < _size37; ++_i41) - { - std::string _key42; - xfer += iprot->readString(_key42); - std::string& _val43 = this->envs[_key42]; - xfer += iprot->readString(_val43); + switch (fid) { + case 1: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast36; + xfer += iprot->readI32(ecast36); + this->status = (app_status::type)ecast36; + this->__isset.status = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readMapEnd(); - } - this->__isset.envs = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 7: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool(this->is_stateful); - this->__isset.is_stateful = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 8: - if (ftype == ::apache::thrift::protocol::T_I32) { - xfer += iprot->readI32(this->max_replica_count); - this->__isset.max_replica_count = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 9: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->expire_second); - this->__isset.expire_second = true; - } else { - xfer += iprot->skip(ftype); + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->app_type); + this->__isset.app_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->app_name); + this->__isset.app_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->app_id); + this->__isset.app_id = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->partition_count); + this->__isset.partition_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_MAP) { + { + this->envs.clear(); + uint32_t _size37; + ::apache::thrift::protocol::TType _ktype38; + ::apache::thrift::protocol::TType _vtype39; + xfer += iprot->readMapBegin(_ktype38, _vtype39, _size37); + uint32_t _i41; + for (_i41 = 0; _i41 < _size37; ++_i41) { + std::string _key42; + xfer += iprot->readString(_key42); + std::string &_val43 = this->envs[_key42]; + xfer += iprot->readString(_val43); + } + xfer += iprot->readMapEnd(); + } + this->__isset.envs = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 7: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->is_stateful); + this->__isset.is_stateful = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 8: + if (ftype == ::apache::thrift::protocol::T_I32) { + xfer += iprot->readI32(this->max_replica_count); + this->__isset.max_replica_count = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 9: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->expire_second); + this->__isset.expire_second = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 10: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->create_second); + this->__isset.create_second = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 11: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->drop_second); + this->__isset.drop_second = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; } - break; - default: - xfer += iprot->skip(ftype); - break; + xfer += iprot->readFieldEnd(); } - xfer += iprot->readFieldEnd(); - } - xfer += iprot->readStructEnd(); + xfer += iprot->readStructEnd(); - return xfer; + return xfer; } -uint32_t app_info::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("app_info"); +uint32_t app_info::write(::apache::thrift::protocol::TProtocol *oprot) const +{ + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("app_info"); - xfer += oprot->writeFieldBegin("status", ::apache::thrift::protocol::T_I32, 1); - xfer += oprot->writeI32((int32_t)this->status); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("status", ::apache::thrift::protocol::T_I32, 1); + xfer += oprot->writeI32((int32_t)this->status); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("app_type", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->app_type); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("app_type", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->app_type); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("app_name", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->app_name); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("app_name", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->app_name); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("app_id", ::apache::thrift::protocol::T_I32, 4); - xfer += oprot->writeI32(this->app_id); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("app_id", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeI32(this->app_id); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("partition_count", ::apache::thrift::protocol::T_I32, 5); - xfer += oprot->writeI32(this->partition_count); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("partition_count", ::apache::thrift::protocol::T_I32, 5); + xfer += oprot->writeI32(this->partition_count); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin("envs", ::apache::thrift::protocol::T_MAP, 6); - { - xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->envs.size())); - std::map ::const_iterator _iter44; - for (_iter44 = this->envs.begin(); _iter44 != this->envs.end(); ++_iter44) + xfer += oprot->writeFieldBegin("envs", ::apache::thrift::protocol::T_MAP, 6); { - xfer += oprot->writeString(_iter44->first); - xfer += oprot->writeString(_iter44->second); + xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, + ::apache::thrift::protocol::T_STRING, + static_cast(this->envs.size())); + std::map::const_iterator _iter44; + for (_iter44 = this->envs.begin(); _iter44 != this->envs.end(); ++_iter44) { + xfer += oprot->writeString(_iter44->first); + xfer += oprot->writeString(_iter44->second); + } + xfer += oprot->writeMapEnd(); } - xfer += oprot->writeMapEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("is_stateful", ::apache::thrift::protocol::T_BOOL, 7); - xfer += oprot->writeBool(this->is_stateful); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("max_replica_count", ::apache::thrift::protocol::T_I32, 8); - xfer += oprot->writeI32(this->max_replica_count); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("expire_second", ::apache::thrift::protocol::T_I64, 9); - xfer += oprot->writeI64(this->expire_second); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(app_info &a, app_info &b) { - using ::std::swap; - swap(a.status, b.status); - swap(a.app_type, b.app_type); - swap(a.app_name, b.app_name); - swap(a.app_id, b.app_id); - swap(a.partition_count, b.partition_count); - swap(a.envs, b.envs); - swap(a.is_stateful, b.is_stateful); - swap(a.max_replica_count, b.max_replica_count); - swap(a.expire_second, b.expire_second); - swap(a.__isset, b.__isset); -} - -app_info::app_info(const app_info& other45) { - status = other45.status; - app_type = other45.app_type; - app_name = other45.app_name; - app_id = other45.app_id; - partition_count = other45.partition_count; - envs = other45.envs; - is_stateful = other45.is_stateful; - max_replica_count = other45.max_replica_count; - expire_second = other45.expire_second; - __isset = other45.__isset; -} -app_info::app_info( app_info&& other46) { - status = std::move(other46.status); - app_type = std::move(other46.app_type); - app_name = std::move(other46.app_name); - app_id = std::move(other46.app_id); - partition_count = std::move(other46.partition_count); - envs = std::move(other46.envs); - is_stateful = std::move(other46.is_stateful); - max_replica_count = std::move(other46.max_replica_count); - expire_second = std::move(other46.expire_second); - __isset = std::move(other46.__isset); -} -app_info& app_info::operator=(const app_info& other47) { - status = other47.status; - app_type = other47.app_type; - app_name = other47.app_name; - app_id = other47.app_id; - partition_count = other47.partition_count; - envs = other47.envs; - is_stateful = other47.is_stateful; - max_replica_count = other47.max_replica_count; - expire_second = other47.expire_second; - __isset = other47.__isset; - return *this; -} -app_info& app_info::operator=(app_info&& other48) { - status = std::move(other48.status); - app_type = std::move(other48.app_type); - app_name = std::move(other48.app_name); - app_id = std::move(other48.app_id); - partition_count = std::move(other48.partition_count); - envs = std::move(other48.envs); - is_stateful = std::move(other48.is_stateful); - max_replica_count = std::move(other48.max_replica_count); - expire_second = std::move(other48.expire_second); - __isset = std::move(other48.__isset); - return *this; -} -void app_info::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "app_info("; - out << "status=" << to_string(status); - out << ", " << "app_type=" << to_string(app_type); - out << ", " << "app_name=" << to_string(app_name); - out << ", " << "app_id=" << to_string(app_id); - out << ", " << "partition_count=" << to_string(partition_count); - out << ", " << "envs=" << to_string(envs); - out << ", " << "is_stateful=" << to_string(is_stateful); - out << ", " << "max_replica_count=" << to_string(max_replica_count); - out << ", " << "expire_second=" << to_string(expire_second); - out << ")"; + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("is_stateful", ::apache::thrift::protocol::T_BOOL, 7); + xfer += oprot->writeBool(this->is_stateful); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("max_replica_count", ::apache::thrift::protocol::T_I32, 8); + xfer += oprot->writeI32(this->max_replica_count); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("expire_second", ::apache::thrift::protocol::T_I64, 9); + xfer += oprot->writeI64(this->expire_second); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("create_second", ::apache::thrift::protocol::T_I64, 10); + xfer += oprot->writeI64(this->create_second); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("drop_second", ::apache::thrift::protocol::T_I64, 11); + xfer += oprot->writeI64(this->drop_second); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(app_info &a, app_info &b) +{ + using ::std::swap; + swap(a.status, b.status); + swap(a.app_type, b.app_type); + swap(a.app_name, b.app_name); + swap(a.app_id, b.app_id); + swap(a.partition_count, b.partition_count); + swap(a.envs, b.envs); + swap(a.is_stateful, b.is_stateful); + swap(a.max_replica_count, b.max_replica_count); + swap(a.expire_second, b.expire_second); + swap(a.create_second, b.create_second); + swap(a.drop_second, b.drop_second); + swap(a.__isset, b.__isset); +} + +app_info::app_info(const app_info &other45) +{ + status = other45.status; + app_type = other45.app_type; + app_name = other45.app_name; + app_id = other45.app_id; + partition_count = other45.partition_count; + envs = other45.envs; + is_stateful = other45.is_stateful; + max_replica_count = other45.max_replica_count; + expire_second = other45.expire_second; + create_second = other45.create_second; + drop_second = other45.drop_second; + __isset = other45.__isset; +} +app_info::app_info(app_info &&other46) +{ + status = std::move(other46.status); + app_type = std::move(other46.app_type); + app_name = std::move(other46.app_name); + app_id = std::move(other46.app_id); + partition_count = std::move(other46.partition_count); + envs = std::move(other46.envs); + is_stateful = std::move(other46.is_stateful); + max_replica_count = std::move(other46.max_replica_count); + expire_second = std::move(other46.expire_second); + create_second = std::move(other46.create_second); + drop_second = std::move(other46.drop_second); + __isset = std::move(other46.__isset); +} +app_info &app_info::operator=(const app_info &other47) +{ + status = other47.status; + app_type = other47.app_type; + app_name = other47.app_name; + app_id = other47.app_id; + partition_count = other47.partition_count; + envs = other47.envs; + is_stateful = other47.is_stateful; + max_replica_count = other47.max_replica_count; + expire_second = other47.expire_second; + create_second = other47.create_second; + drop_second = other47.drop_second; + __isset = other47.__isset; + return *this; +} +app_info &app_info::operator=(app_info &&other48) +{ + status = std::move(other48.status); + app_type = std::move(other48.app_type); + app_name = std::move(other48.app_name); + app_id = std::move(other48.app_id); + partition_count = std::move(other48.partition_count); + envs = std::move(other48.envs); + is_stateful = std::move(other48.is_stateful); + max_replica_count = std::move(other48.max_replica_count); + expire_second = std::move(other48.expire_second); + create_second = std::move(other48.create_second); + drop_second = std::move(other48.drop_second); + __isset = std::move(other48.__isset); + return *this; +} +void app_info::printTo(std::ostream &out) const +{ + using ::apache::thrift::to_string; + out << "app_info("; + out << "status=" << to_string(status); + out << ", " + << "app_type=" << to_string(app_type); + out << ", " + << "app_name=" << to_string(app_name); + out << ", " + << "app_id=" << to_string(app_id); + out << ", " + << "partition_count=" << to_string(partition_count); + out << ", " + << "envs=" << to_string(envs); + out << ", " + << "is_stateful=" << to_string(is_stateful); + out << ", " + << "max_replica_count=" << to_string(max_replica_count); + out << ", " + << "expire_second=" << to_string(expire_second); + out << ", " + << "create_second=" << to_string(create_second); + out << ", " + << "drop_second=" << to_string(drop_second); + out << ")"; } } // namespace diff --git a/src/dist/nfs/nfs.types.h b/src/dist/nfs/nfs.types.h index 21fb849f65..9c2a263e96 100644 --- a/src/dist/nfs/nfs.types.h +++ b/src/dist/nfs/nfs.types.h @@ -11,4 +11,4 @@ GENERATED_TYPE_SERIALIZATION(copy_response, THRIFT) GENERATED_TYPE_SERIALIZATION(get_file_size_request, THRIFT) GENERATED_TYPE_SERIALIZATION(get_file_size_response, THRIFT) } -} +} \ No newline at end of file diff --git a/src/dist/replication/ddl_lib/replication_ddl_client.cpp b/src/dist/replication/ddl_lib/replication_ddl_client.cpp index ccc8eca22f..fcf34041d4 100644 --- a/src/dist/replication/ddl_lib/replication_ddl_client.cpp +++ b/src/dist/replication/ddl_lib/replication_ddl_client.cpp @@ -41,8 +41,6 @@ #include #include -#include - #include #include #include @@ -104,8 +102,7 @@ std::string replication_ddl_client::hostname(const rpc_address &address) if (address.type() != HOST_TYPE_IPV4) { return std::string("invalid"); } - return hostname_from_ip(htonl(address.ip())) + ":" + - boost::lexical_cast(address.port()); + return hostname_from_ip(htonl(address.ip())) + ":" + std::to_string(address.port()); } std::string replication_ddl_client::list_hostname_from_ip(const char *ip_list) @@ -383,12 +380,19 @@ dsn::error_code replication_ddl_client::list_apps(const dsn::app_status::type st max_app_name_size = std::max(max_app_name_size, info.app_name.size() + 2); } - out << std::setw(10) << std::left << "app_id" << std::setw(20) << std::left << "status" - << std::setw(max_app_name_size) << std::left << "app_name" << std::setw(20) << std::left - << "app_type" << std::setw(20) << std::left << "partition_count" << std::setw(20) - << std::left << "replica_count" << std::setw(20) << std::left << "is_stateful" - << std::setw(20) << std::left << "drop_expire_time" << std::setw(20) << std::left - << "envs_count" << std::endl; + std::vector> table; + std::vector head{"app_id", + "status", + "app_name", + "app_type", + "partition_count", + "replica_count", + "is_stateful", + "create_time", + "drop_time", + "drop_expire", + "envs_count"}; + table.emplace_back(std::move(head)); int available_app_count = 0; for (int i = 0; i < apps.size(); i++) { dsn::app_info info = apps[i]; @@ -397,30 +401,56 @@ dsn::error_code replication_ddl_client::list_apps(const dsn::app_status::type st } std::string status_str = enum_to_string(info.status); status_str = status_str.substr(status_str.find("AS_") + 3); + std::string create_time = "-"; + if (info.create_second > 0) { + char buf[20]; + dsn::utils::time_ms_to_date_time((uint64_t)info.create_second * 1000, buf, 20); + create_time = buf; + } + std::string drop_time = "-"; std::string drop_expire_time = "-"; if (info.status == app_status::AS_AVAILABLE) { available_app_count++; } else if (info.status == app_status::AS_DROPPED && info.expire_second > 0) { - char buf[20]; - dsn::utils::time_ms_to_date_time((uint64_t)info.expire_second * 1000, buf, 20); - drop_expire_time = buf; + if (info.drop_second > 0) { + char buf[20]; + dsn::utils::time_ms_to_date_time((uint64_t)info.drop_second * 1000, buf, 20); + drop_time = buf; + } + if (info.expire_second > 0) { + char buf[20]; + dsn::utils::time_ms_to_date_time((uint64_t)info.expire_second * 1000, buf, 20); + drop_expire_time = buf; + } } - out << std::setw(10) << std::left << info.app_id << std::setw(20) << std::left << status_str - << std::setw(max_app_name_size) << std::left << info.app_name << std::setw(20) - << std::left << info.app_type << std::setw(20) << std::left << info.partition_count - << std::setw(20) << std::left << info.max_replica_count << std::setw(20) << std::left - << (info.is_stateful ? "true" : "false") << std::setw(20) << std::left - << drop_expire_time << std::setw(20) << std::left << info.envs.size() << std::endl; - } - out << std::endl << std::flush; + std::vector row; + row.push_back(std::to_string(info.app_id)); + row.push_back(status_str); + row.push_back(info.app_name); + row.push_back(info.app_type); + row.push_back(std::to_string(info.partition_count)); + row.push_back(std::to_string(info.max_replica_count)); + row.push_back(info.is_stateful ? "true" : "false"); + row.push_back(create_time); + row.push_back(drop_time); + row.push_back(drop_expire_time); + row.push_back(std::to_string(info.envs.size())); + table.emplace_back(std::move(row)); + } + bool pr = print_table(table, out); + dassert(pr, "bad table format"); + out << std::endl; if (detailed && available_app_count > 0) { - out << "[App Healthy Info]" << std::endl; - out << std::setw(10) << std::left << "app_id" << std::setw(max_app_name_size) << std::left - << "app_name" << std::setw(20) << std::left << "partition_count" << std::setw(20) - << std::left << "fully_healthy" << std::setw(20) << std::left << "unhealthy" - << std::setw(20) << std::left << "write_unhealthy" << std::setw(20) << std::left - << "read_unhealthy" << std::endl; + std::vector> detail_table; + std::vector detail_head{"app_id", + "app_name", + "partition_count", + "fully_healthy", + "unhealthy", + "write_unhealthy", + "read_unhealthy"}; + detail_table.emplace_back(std::move(detail_head)); for (auto &info : apps) { if (info.status != app_status::AS_AVAILABLE) { continue; @@ -458,13 +488,20 @@ dsn::error_code replication_ddl_client::list_apps(const dsn::app_status::type st read_unhealthy++; } } - out << std::setw(10) << std::left << info.app_id << std::setw(max_app_name_size) - << std::left << info.app_name << std::setw(20) << std::left << info.partition_count - << std::setw(20) << std::left << fully_healthy << std::setw(20) << std::left - << (info.partition_count - fully_healthy) << std::setw(20) << std::left - << write_unhealthy << std::setw(20) << std::left << read_unhealthy << std::endl; + std::vector row; + row.push_back(std::to_string(info.app_id)); + row.push_back(info.app_name); + row.push_back(std::to_string(info.partition_count)); + row.push_back(std::to_string(fully_healthy)); + row.push_back(std::to_string(info.partition_count - fully_healthy)); + row.push_back(std::to_string(write_unhealthy)); + row.push_back(std::to_string(read_unhealthy)); + detail_table.emplace_back(std::move(row)); } - out << std::endl << std::flush; + out << "[App Healthy Info]" << std::endl; + pr = print_table(detail_table, out); + dassert(pr, "bad table format"); + out << std::endl; } return dsn::ERR_OK; @@ -1481,5 +1518,42 @@ ::dsn::error_code replication_ddl_client::clear_app_envs(const std::string &app_ } return ERR_OK; } + +bool replication_ddl_client::print_table(const std::vector> &table, + std::ostream &output, + const std::string &column_delimiter) +{ + if (table.empty()) + return true; + + int row_count = table.size(); + int column_count = table[0].size(); + std::vector column_widths(column_count); + for (int r = 0; r < row_count; ++r) { + const std::vector &row = table[r]; + if ((int)row.size() != column_count) + return false; + for (int c = 0; c < column_count; ++c) { + int w = row[c].size(); + if (w > column_widths[c]) + column_widths[c] = w; + } + } + + for (int r = 0; r < row_count; ++r) { + const std::vector &row = table[r]; + for (int c = 0; c < column_count; ++c) { + if (c == 0) { + output << std::setw(column_widths[c]) << std::left << row[c]; + } else { + output << column_delimiter; + output << std::setw(column_widths[c]) << std::left << row[c]; + } + } + output << std::endl; + } + + return true; +} } } // namespace diff --git a/src/dist/replication/meta_server/server_state.cpp b/src/dist/replication/meta_server/server_state.cpp index 154f001c4c..0dbb3b2ca3 100644 --- a/src/dist/replication/meta_server/server_state.cpp +++ b/src/dist/replication/meta_server/server_state.cpp @@ -443,6 +443,7 @@ error_code server_state::initialize_default_apps() dsn_config_get_value_bool(s, "stateful", true, "whether this is a stateful app"); default_app.max_replica_count = (int)dsn_config_get_value_uint64( s, "max_replica_count", 3, "max replica count in app"); + default_app.create_second = dsn_now_ms() / 1000; std::string envs_str = dsn_config_get_value_string(s, "envs", "", "app envs"); bool parse = dsn::utils::parse_kv_map(envs_str.c_str(), default_app.envs, ',', '='); @@ -1087,6 +1088,7 @@ void server_state::create_app(dsn::message_ex *msg) info.max_replica_count = request.options.replica_count; info.partition_count = request.options.partition_count; info.status = app_status::AS_CREATING; + info.create_second = dsn_now_ms() / 1000; app = app_state::create(info); app->helpers->pending_response = msg; @@ -1151,11 +1153,12 @@ void server_state::drop_app(dsn::message_ex *msg) case app_status::AS_AVAILABLE: do_dropping = true; app->status = app_status::AS_DROPPING; + app->drop_second = dsn_now_ms() / 1000; if (request.options.__isset.reserve_seconds && request.options.reserve_seconds > 0) { - app->expire_second = dsn_now_ms() / 1000 + request.options.reserve_seconds; + app->expire_second = app->drop_second + request.options.reserve_seconds; } else { - app->expire_second = dsn_now_ms() / 1000 + + app->expire_second = app->drop_second + _meta_svc->get_meta_options().hold_seconds_for_dropped_app; } app->helpers->pending_response = msg; diff --git a/src/dsn.layer2.thrift b/src/dsn.layer2.thrift index a22080238d..5043cf80ae 100644 --- a/src/dsn.layer2.thrift +++ b/src/dsn.layer2.thrift @@ -54,4 +54,8 @@ struct app_info 7:bool is_stateful; 8:i32 max_replica_count; 9:i64 expire_second; + + // new fields added from v1.11.0 + 10:i64 create_second; + 11:i64 drop_second; }