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 OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_COMMON_EVENT_DATA_SYNC_EVENT_H 17 #define OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_COMMON_EVENT_DATA_SYNC_EVENT_H 18 19 #include "cloud/cloud_event.h" 20 #include "visibility.h" 21 namespace OHOS::DistributedData { 22 class API_EXPORT DataSyncEvent : public CloudEvent { 23 public: 24 enum DataSyncStatus : int32_t { 25 START, 26 FINISH, 27 }; 28 29 DataSyncEvent(StoreInfo storeInfo, uint32_t syncMode, int32_t status, uint32_t traceId, uint32_t count = 0) 30 : CloudEvent(DATA_SYNC, std::move(storeInfo)), syncMode_(syncMode), status_(std::move(status)), 31 traceId_(traceId), count_(count) 32 { 33 } 34 35 ~DataSyncEvent() override = default; 36 GetSyncMode()37 uint32_t GetSyncMode() const 38 { 39 return syncMode_; 40 } 41 GetSyncStatus()42 int32_t GetSyncStatus() const 43 { 44 return status_; 45 } 46 GetTraceId()47 uint32_t GetTraceId() const 48 { 49 return traceId_; 50 } 51 GetCount()52 uint32_t GetCount() const 53 { 54 return count_; 55 } 56 57 private: 58 uint32_t syncMode_; 59 int32_t status_; 60 uint32_t traceId_; 61 uint32_t count_; 62 }; 63 } // OHOS::DistributedData 64 #endif // OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_COMMON_EVENT_DATA_SYNC_EVENT_H