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 DISTRIBUTEDDATAMGR_OBJECT_SNAPSHOT_H 17#define DISTRIBUTEDDATAMGR_OBJECT_SNAPSHOT_H 18 19#include "object_asset_machine.h" 20#include "snapshot/snapshot.h" 21#include "store/general_value.h" 22namespace OHOS { 23namespace DistributedObject { 24using namespace DistributedData; 25class ObjectSnapshot : public Snapshot { 26public: 27 ObjectSnapshot(); 28 ~ObjectSnapshot() override; 29 30 int32_t Upload(Asset& asset) override; 31 int32_t Download(Asset& asset) override; 32 TransferStatus GetAssetStatus(Asset& asset) override; 33 int32_t Uploaded(Asset& asset) override; 34 int32_t Downloaded(Asset& asset) override; 35 int32_t Transferred(Asset& asset) override; 36 int32_t OnDataChanged(Asset& asset, const std::string& deviceId) override; 37 int32_t BindAsset(const Asset& asset, const DistributedData::AssetBindInfo& bindInfo, 38 const StoreInfo& storeInfo) override; 39 bool IsBoundAsset(const Asset& asset) override; 40 41private: 42 std::map<std::string, ChangedAssetInfo> changedAssets_; 43 std::shared_ptr<ObjectAssetMachine> assetMachine_; 44}; 45} // namespace DistributedObject 46} // namespace OHOS 47#endif // DISTRIBUTEDDATAMGR_OBJECT_SNAPSHOT_H 48