1 /* 2 * Copyright (c) 2023 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 PROCESS_NOTIFIER_H 17 #define PROCESS_NOTIFIER_H 18 #include "icloud_syncer.h" 19 namespace DistributedDB { 20 class ProcessNotifier { 21 public: 22 explicit ProcessNotifier(ICloudSyncer *syncer); 23 ~ProcessNotifier(); 24 25 void Init(const std::vector<std::string> &tableName, const std::vector<std::string> &devices); 26 27 void UpdateProcess(const ICloudSyncer::InnerProcessInfo &process); 28 29 void NotifyProcess(const ICloudSyncer::CloudTaskInfo &taskInfo, const ICloudSyncer::InnerProcessInfo &process, 30 bool notifyWhenError = false); 31 32 std::vector<std::string> GetDevices() const; 33 protected: 34 std::mutex processMutex_; 35 SyncProcess syncProcess_; 36 std::vector<std::string> devices_; 37 ICloudSyncer *syncer_; 38 }; 39 } 40 #endif // PROCESS_NOTIFIER_H 41