5 #include <nlohmann/json.hpp>
22 nlohmann::json resp =
cdbclient->createGlobalTag(tagname);
23 int iret = resp[
"code"];
24 nlohmann::json msgcont = resp[
"msg"];
25 std::cout << msgcont << std::endl;
31 nlohmann::json resp =
cdbclient->deleteGlobalTag(tagname);
32 int iret = resp[
"code"];
33 nlohmann::json msgcont = resp[
"msg"];
34 std::cout << msgcont << std::endl;
41 int iret = resp[
"code"];
42 nlohmann::json msgcont = resp[
"msg"];
43 std::cout << msgcont << std::endl;
50 int iret = resp[
"code"];
51 nlohmann::json msgcont = resp[
"msg"];
52 std::cout <<
"message: " << msgcont << std::endl;
58 nlohmann::json resp =
cdbclient->clearCache();
59 std::cout << resp[
"msg"] << std::endl;
77 if (resp[
"code"] != 0)
79 std::cout << resp[
"msg"] << std::endl;
82 nlohmann::json payload_iovs = resp[
"msg"];
83 for (
auto &[
pt, val] : payload_iovs.items())
85 std::cout <<
pt <<
": " << val[
"payload_url"]
86 <<
", begin ts: " << val[
"minor_iov_start"]
87 <<
", end ts: " << val[
"minor_iov_end"]
95 nlohmann::json resp =
cdbclient->getGlobalTags();
96 nlohmann::json msgcont = resp[
"msg"];
97 std::set<std::string> gtset;
98 for (
auto &
it : msgcont.items())
101 gtset.insert(exist_gt);
103 if (gtset.find(source) == gtset.end())
105 std::cout <<
"source tag " << source <<
" does not exist" << std::endl;
108 if (gtset.find(target) != gtset.end())
110 std::cout <<
"Target tag " << target <<
" exists, delete it first" << std::endl;
113 resp =
cdbclient->cloneGlobalTag(source, target);
114 int iret = resp[
"code"];
115 std::cout << resp[
"msg"] << std::endl;
121 nlohmann::json resp =
cdbclient->getGlobalTags();
122 nlohmann::json msgcont = resp[
"msg"];
123 for (
auto &
it : msgcont.items())
126 std::cout <<
"global tag: " << exist_gt << std::endl;
133 nlohmann::json resp =
cdbclient->getPayloadTypes();
134 nlohmann::json msgcont = resp[
"msg"];
135 for (
auto &
it : msgcont.items())
138 std::cout <<
"payload type: " << exist_pl << std::endl;
147 std::cout <<
"No Global Tag set" << std::endl;
151 int iret = resp[
"code"];
154 std::cout <<
"Error inserting payload " << file_url <<
", msg: " << resp[
"msg"] << std::endl;
158 std::cout << resp[
"msg"] << std::endl;
167 std::cout <<
"No Global Tag set" << std::endl;
171 int iret = resp[
"code"];
174 std::cout <<
"Error inserting payload " << file_url <<
", msg: " << resp[
"msg"] << std::endl;
178 std::cout << resp[
"msg"] << std::endl;
186 int iret = resp[
"code"];
187 std::cout <<
"message: " << resp[
"msg"] << std::endl;
208 int iret = resp[
"code"];
211 std::cout <<
"Error deleting payload iov, type " << pl_type
212 <<
", iov_start: " << iov_start
213 <<
", msg: " << resp[
"msg"] << std::endl;
217 std::cout << resp[
"msg"] << std::endl;
225 int iret = resp[
"code"];
228 std::cout <<
"Error deleting payload iov, type " << pl_type
229 <<
", iov_start: " << iov_start
230 <<
", iov_end: " << iov_end
231 <<
", msg: " << resp[
"msg"] << std::endl;
235 std::cout << resp[
"msg"] << std::endl;