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