be/src/service/http/action/http_stream.h
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 | | #pragma once |
19 | | |
20 | | #include <gen_cpp/PlanNodes_types.h> |
21 | | |
22 | | #include <functional> |
23 | | |
24 | | #include "load/message_body_sink.h" |
25 | | #include "service/http/http_handler.h" |
26 | | #include "util/client_cache.h" |
27 | | |
28 | | namespace doris { |
29 | | |
30 | | class ExecEnv; |
31 | | class Status; |
32 | | class StreamLoadContext; |
33 | | |
34 | | class HttpStreamAction : public HttpHandler { |
35 | | public: |
36 | | HttpStreamAction(ExecEnv* exec_env); |
37 | | ~HttpStreamAction() override; |
38 | | |
39 | | void handle(HttpRequest* req) override; |
40 | | |
41 | 134 | bool request_will_be_read_progressively() override { return true; } |
42 | | |
43 | | int on_header(HttpRequest* req) override; |
44 | | |
45 | | void on_chunk_data(HttpRequest* req) override; |
46 | | void free_handler_ctx(std::shared_ptr<void> ctx) override; |
47 | | Status process_put(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx); |
48 | | |
49 | | private: |
50 | | Status _on_header(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx); |
51 | | Status _handle(HttpRequest* req, std::shared_ptr<StreamLoadContext> ctx); |
52 | | void _save_stream_load_record(std::shared_ptr<StreamLoadContext> ctx, const std::string& str); |
53 | | Status _handle_group_commit(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx); |
54 | | |
55 | | private: |
56 | | ExecEnv* _exec_env; |
57 | | std::shared_ptr<MetricEntity> _http_stream_entity; |
58 | | IntCounter* http_stream_requests_total; |
59 | | IntCounter* http_stream_duration_ms; |
60 | | IntGauge* http_stream_current_processing; |
61 | | }; |
62 | | |
63 | | } // namespace doris |