• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_CLOUD_SYNC_EVENT_H
17 #define OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_CLOUD_SYNC_EVENT_H
18 #include "cloud/cloud_event.h"
19 #include "store/general_value.h"
20 #include "visibility.h"
21 namespace OHOS::DistributedData {
22 class API_EXPORT SyncEvent : public CloudEvent {
23 public:
24     class EventInfo {
25     public:
26         API_EXPORT EventInfo(int32_t mode, int32_t wait, bool retry, std::shared_ptr<GenQuery> query, GenAsync async);
27         API_EXPORT EventInfo(EventInfo &&info) noexcept;
28         EventInfo(const EventInfo &info) = default;
29         API_EXPORT EventInfo &operator=(EventInfo &&info) noexcept;
30         EventInfo &operator=(const EventInfo &info) = default;
31     private:
32         friend SyncEvent;
33         bool retry_ = false;
34         int32_t mode_ = -1;
35         int32_t wait_ = 0;
36         std::shared_ptr<GenQuery> query_;
37         GenAsync asyncDetail_;
38     };
39     SyncEvent(StoreInfo storeInfo, EventInfo info);
40     ~SyncEvent() override = default;
41     int32_t GetMode() const;
42     int32_t GetWait() const;
43     bool AutoRetry() const;
44     std::shared_ptr<GenQuery> GetQuery() const;
45     GenAsync GetAsyncDetail() const;
46 
47 protected:
48     SyncEvent(int32_t evtId, StoreInfo storeInfo, EventInfo info);
49 
50 private:
51     EventInfo info_;
52 };
53 } // namespace OHOS::DistributedData
54 #endif // OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_CLOUD_SYNC_EVENT_H
55