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_MEDIA_CLOUD_SYNC_I_CLOUD_MEDIA_DATA_HANDLER_H 17 #define OHOS_MEDIA_CLOUD_SYNC_I_CLOUD_MEDIA_DATA_HANDLER_H 18 19 #include <map> 20 #include <vector> 21 22 #include "cloud_check_data.h" 23 #include "cloud_meta_data.h" 24 #include "mdk_record.h" 25 #include "mdk_reference.h" 26 #include "mdk_database.h" 27 28 namespace OHOS::Media::CloudSync { 29 #define EXPORT __attribute__ ((visibility ("default"))) 30 class EXPORT ICloudMediaDataHandler { 31 public: // getter & setter 32 virtual void SetTraceId(const std::string &traceId) = 0; 33 virtual std::string GetTraceId() const = 0; 34 virtual void SetUserId(const int32_t &userId) = 0; 35 36 public: 37 virtual int32_t GetCheckRecords(const std::vector<std::string> &cloudIds, 38 std::unordered_map<std::string, CloudCheckData> &checkRecords) = 0; 39 virtual int32_t GetCreatedRecords(std::vector<MDKRecord> &records, int32_t size) = 0; 40 virtual int32_t GetMetaModifiedRecords(std::vector<MDKRecord> &records, int32_t size, int32_t dirtyType = 2) = 0; 41 virtual int32_t GetFileModifiedRecords(std::vector<MDKRecord> &records, int32_t size) = 0; 42 virtual int32_t GetDeletedRecords(std::vector<MDKRecord> &records, int32_t size) = 0; 43 virtual int32_t GetCopyRecords(std::vector<MDKRecord> &records, int32_t size) = 0; 44 virtual int32_t OnCreateRecords(const std::map<std::string, MDKRecordOperResult> &map, int32_t &failSize) = 0; 45 virtual int32_t OnMdirtyRecords(const std::map<std::string, MDKRecordOperResult> &map, int32_t &failSize) = 0; 46 virtual int32_t OnFdirtyRecords(const std::map<std::string, MDKRecordOperResult> &map, int32_t &failSize) = 0; 47 virtual int32_t OnDeleteRecords(const std::map<std::string, MDKRecordOperResult> &map, int32_t &failSize) = 0; 48 virtual int32_t OnCopyRecords(const std::map<std::string, MDKRecordOperResult> &map, int32_t &failSize) = 0; 49 virtual int32_t OnFetchRecords(const std::vector<MDKRecord> &records, std::vector<CloudMetaData> &newData, 50 std::vector<CloudMetaData> &fdirtyData, std::vector<std::string> &failedRecords, 51 std::vector<int32_t> &stats) = 0; 52 virtual int32_t OnDentryFileInsert(std::vector<MDKRecord> &records, std::vector<std::string> &failedRecords) = 0; 53 virtual int32_t GetRetryRecords(std::vector<std::string> &records) = 0; 54 virtual int32_t OnStartSync() = 0; 55 virtual int32_t OnCompleteSync() = 0; 56 virtual int32_t OnCompletePull() = 0; 57 virtual int32_t OnCompletePush() = 0; 58 virtual int32_t OnCompleteCheck() = 0; 59 }; 60 } // namespace OHOS::Media::CloudSync 61 #endif // OHOS_MEDIA_CLOUD_SYNC_I_CLOUD_MEDIA_DATA_HANDLER_H