/root/doris/be/src/pipeline/revokable_task.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 <memory> | 
| 21 |  | #include <string> | 
| 22 |  |  | 
| 23 |  | #include "common/status.h" | 
| 24 |  | #include "pipeline/dependency.h" | 
| 25 |  | #include "pipeline/exec/operator.h" | 
| 26 |  | #include "pipeline/exec/spill_utils.h" | 
| 27 |  | #include "pipeline/pipeline.h" | 
| 28 |  | #include "pipeline/pipeline_task.h" | 
| 29 |  | #include "pipeline_task.h" | 
| 30 |  |  | 
| 31 |  | namespace doris { | 
| 32 |  | class RuntimeState; | 
| 33 |  |  | 
| 34 |  | namespace pipeline { | 
| 35 |  | class PipelineFragmentContext; | 
| 36 |  |  | 
| 37 |  | class RevokableTask : public PipelineTask { | 
| 38 |  | public: | 
| 39 |  |     RevokableTask(PipelineTaskSPtr task, std::shared_ptr<SpillContext> spill_context) | 
| 40 | 0 |             : _task(std::move(task)), _spill_context(std::move(spill_context)) {} | 
| 41 |  |  | 
| 42 | 0 |     ~RevokableTask() override = default; | 
| 43 |  |  | 
| 44 | 0 |     RuntimeState* runtime_state() const override { return _task->runtime_state(); } | 
| 45 |  |  | 
| 46 | 0 |     Status close(Status exec_status, bool close_sink) override { | 
| 47 | 0 |         return _task->close(exec_status, close_sink); | 
| 48 | 0 |     } | 
| 49 |  |  | 
| 50 | 0 |     Status finalize() override { return _task->finalize(); } | 
| 51 |  |  | 
| 52 | 0 |     bool set_running(bool running) override { return _task->set_running(running); } | 
| 53 |  |  | 
| 54 | 0 |     bool is_finalized() const override { return _task->is_finalized(); } | 
| 55 |  |  | 
| 56 | 0 |     std::weak_ptr<PipelineFragmentContext>& fragment_context() override { | 
| 57 | 0 |         return _task->fragment_context(); | 
| 58 | 0 |     } | 
| 59 |  |  | 
| 60 | 0 |     PipelineTask& set_thread_id(int thread_id) override { return _task->set_thread_id(thread_id); } | 
| 61 |  |  | 
| 62 | 0 |     PipelineId pipeline_id() const override { return _task->pipeline_id(); } | 
| 63 |  |  | 
| 64 | 0 |     std::string task_name() const override { return _task->task_name(); } | 
| 65 |  |  | 
| 66 | 0 |     Status execute(bool* done) override { return _task->do_revoke_memory(_spill_context); } | 
| 67 |  |  | 
| 68 | 0 |     bool is_blockable() const override { return true; } | 
| 69 |  |  | 
| 70 |  | private: | 
| 71 |  |     PipelineTaskSPtr _task; | 
| 72 |  |     std::shared_ptr<SpillContext> _spill_context; | 
| 73 |  | }; | 
| 74 |  |  | 
| 75 |  | } // namespace pipeline | 
| 76 |  | } // namespace doris |