1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FILEMANAGEMENT_FILE_API_TASK_SIGNAL_H 17 #define FILEMANAGEMENT_FILE_API_TASK_SIGNAL_H 18 19 #include <unistd.h> 20 #include <memory> 21 #include <string> 22 23 #include "task_signal_listener.h" 24 25 namespace OHOS { 26 namespace DistributedFS { 27 namespace ModuleTaskSignal { 28 class TaskSignal { 29 public: 30 TaskSignal() = default; 31 ~TaskSignal() = default; 32 int32_t Cancel(); 33 bool IsCanceled(); 34 bool CheckCancelIfNeed(const std::string &path); 35 void OnCancel(); 36 void SetTaskSignalListener(TaskSignalListener *signalListener); 37 void MarkRemoteTask(); 38 void SetFileInfoOfRemoteTask(const std::string &sessionName, const std::string &filePath); 39 void MarkDfsTask(); 40 void SetCopyTaskUri(const std::string &srcUri, const std::string &dstUri); 41 std::atomic_bool needCancel_{ false }; 42 std::atomic_bool remoteTask_{ false }; 43 std::atomic_bool dfsCopyTask_{ false }; 44 std::string sessionName_ = std::string(""); 45 std::string filePath_ = std::string(""); 46 std::string srcUri_ = std::string(""); 47 std::string dstUri_ = std::string(""); 48 private: 49 TaskSignalListener *signalListener_; 50 }; 51 } // namespace ModuleTaskSignal 52 } // namespace DistributedFS 53 } // namespace OHOS 54 #endif // FILEMANAGEMENT_FILE_API_TASK_SIGNAL_H