Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
meta: extend app_info to add create_seconds/drop_seconds (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
qinzuoyan authored Aug 21, 2018
1 parent 184e7be commit 0ccfd97
Show file tree
Hide file tree
Showing 8 changed files with 1,365 additions and 1,147 deletions.
25 changes: 22 additions & 3 deletions include/dsn/cpp/json_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 { \
Expand Down Expand Up @@ -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, \
Expand All @@ -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, \
Expand Down Expand Up @@ -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)
}
}
Loading

0 comments on commit 0ccfd97

Please sign in to comment.