• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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_MEDIALIBRARY_SYNC_TABLE_H
17 #define OHOS_MEDIALIBRARY_SYNC_TABLE_H
18 
19 #include <string>
20 #include "abs_rdb_predicates.h"
21 #include "data_ability_predicates.h"
22 #include "device_manager.h"
23 #include "device_manager_callback.h"
24 #include "distributed_kv_data_manager.h"
25 #include "media_data_ability_const.h"
26 #include "medialibrary_device.h"
27 #include "media_log.h"
28 #include "rdb_errno.h"
29 #include "rdb_helper.h"
30 #include "rdb_store.h"
31 #include "rdb_store_config.h"
32 #include "rdb_types.h"
33 
34 namespace OHOS {
35 namespace Media {
36 using namespace OHOS::NativeRdb;
37 
38 class MediaLibrarySyncTable {
39 public:
40     MediaLibrarySyncTable();
41     ~MediaLibrarySyncTable();
42 
43     bool SyncPullAllTable(const shared_ptr<RdbStore> &rdbStore, const std::string &bundleName);
44     bool SyncPullAllTableByDeviceId(const shared_ptr<RdbStore> &rdbStore,
45                                     const std::string &bundleName, std::vector<std::string> &devices);
46     bool SyncPullTable(const shared_ptr<RdbStore> &rdbStore, const std::string &bundleName,
47                        const std::string &tableName, std::vector<std::string> &devices, bool isLast = false);
48     bool SyncPushTable(const shared_ptr<RdbStore> &rdbStore, const std::string &bundleName,
49                        const std::string &tableName, std::vector<std::string> &devices, bool isBlock = false);
50 
51 private:
52     static constexpr int RETRY_COUNT = 3;
53 };
54 } // namespace Media
55 } // namespace OHOS
56 #endif // OHOS_MEDIALIBRARY_SYNC_TABLE_H