be/src/service/http/action/report_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/report_action.h" |
19 | | |
20 | | #include "common/status.h" |
21 | | #include "runtime/exec_env.h" |
22 | | #include "service/http/http_channel.h" |
23 | | #include "storage/storage_engine.h" |
24 | | |
25 | | namespace doris { |
26 | | |
27 | | ReportAction::ReportAction(ExecEnv* exec_env, TPrivilegeHier::type hier, TPrivilegeType::type type, |
28 | | const std::string& report_name) |
29 | 1 | : HttpHandlerWithAuth(exec_env, hier, type), _report_name(report_name) {} |
30 | | |
31 | 0 | void ReportAction::handle(HttpRequest* req) { |
32 | 0 | if (ExecEnv::GetInstance()->storage_engine().notify_listener(_report_name)) { |
33 | 0 | HttpChannel::send_reply(req, HttpStatus::OK, Status::OK().to_json()); |
34 | 0 | } else { |
35 | 0 | HttpChannel::send_reply( |
36 | 0 | req, HttpStatus::INTERNAL_SERVER_ERROR, |
37 | 0 | Status::InternalError("unknown reporter with name: " + _report_name).to_json()); |
38 | 0 | } |
39 | 0 | } |
40 | | |
41 | | } // namespace doris |