be/src/service/http/action/dictionary_status_action.cpp
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #include "service/http/action/dictionary_status_action.h" |
19 | | |
20 | | #include <sstream> |
21 | | |
22 | | #include "exprs/function/dictionary_factory.h" |
23 | | #include "runtime/exec_env.h" |
24 | | #include "runtime/fragment_mgr.h" |
25 | | #include "service/http/http_channel.h" |
26 | | #include "service/http/http_headers.h" |
27 | | #include "service/http/http_request.h" |
28 | | #include "service/http/http_status.h" |
29 | | |
30 | | namespace doris { |
31 | | |
32 | 0 | void DictionaryStatusAction::handle(HttpRequest* req) { |
33 | 0 | req->add_output_header(HttpHeaders::CONTENT_TYPE, "text/plain; version=0.0.4"); |
34 | |
|
35 | 0 | std::vector<TDictionaryStatus> result; |
36 | 0 | std::vector<int64_t> dict_ids {}; |
37 | 0 | ExecEnv::GetInstance()->dict_factory()->get_dictionary_status(result, dict_ids); |
38 | 0 | std::stringstream ss; |
39 | 0 | for (auto& status : result) { |
40 | 0 | ss << "Dictionary ID: " << status.dictionary_id << ", Version ID: " << status.version_id |
41 | 0 | << ", Memory Size: " << status.dictionary_memory_size << std::endl; |
42 | 0 | } |
43 | 0 | HttpChannel::send_reply(req, HttpStatus::OK, ss.str()); |
44 | 0 | } |
45 | | } // end namespace doris |