diff --git a/frameworks/libs/distributeddb/common/include/cloud/cloud_db_types.h b/frameworks/libs/distributeddb/common/include/cloud/cloud_db_types.h index 51fc651ccfbce666b4aa5494d6532d71be7a550c..7958787c2ceb8287e6028b872eefcc2595f439ad 100644 --- a/frameworks/libs/distributeddb/common/include/cloud/cloud_db_types.h +++ b/frameworks/libs/distributeddb/common/include/cloud/cloud_db_types.h @@ -24,6 +24,8 @@ struct CloudSyncBatch { std::vector record; std::vector extend; std::vector rowid; + std::vector timestamp; + std::vector assets; }; struct CloudSyncData { diff --git a/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h b/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h index 977819964534cf1850a8d422ca2aab9269ea01e4..b06ff6875b47b8bc1e7e3487028ed660c60f7660 100644 --- a/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h +++ b/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h @@ -39,7 +39,7 @@ enum ClearMode { enum class AssetOpType { NO_CHANGE = 0, - INSERT, + INSERT = 3, DELETE, UPDATE }; @@ -47,7 +47,10 @@ enum class AssetOpType { enum class AssetStatus { NORMAL = 0, DOWNLOADING, - FAILURE + FAILURE, + INSERT = 3, // INSERT/DELETE/UPDATE are for client use + DELETE, + UPDATE }; struct Asset { diff --git a/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h b/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h index 86f6ee674c5ac17e6094b430754f0dbe109597aa..f1ff857747d3ffd024a9d8bb84c5e98c6a835402 100644 --- a/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h +++ b/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h @@ -159,7 +159,9 @@ public: int CleanCloudData(ClearMode mode, const std::vector &tableNameList, std::vector &assets) override; - int FillCloudAsset(const std::string &tableName, VBucket &asset, bool isFullReplace) override; + int FillCloudAssetForDownload(const std::string &tableName, VBucket &asset, bool isFullReplace) override; + + int FillCloudAssetForUpload(const CloudSyncData &data) override; private: SQLiteSingleVerRelationalStorageExecutor *GetHandle(bool isWrite, int &errCode, diff --git a/frameworks/libs/distributeddb/storage/include/cloud/cloud_storage_utils.h b/frameworks/libs/distributeddb/storage/include/cloud/cloud_storage_utils.h index 9d61c05d7bad2ae7a5c54ef3ceb5e2cc59bc599e..3bb1227bb2af8a4dec9fb421f5c208a3dba14445 100644 --- a/frameworks/libs/distributeddb/storage/include/cloud/cloud_storage_utils.h +++ b/frameworks/libs/distributeddb/storage/include/cloud/cloud_storage_utils.h @@ -45,10 +45,11 @@ public: static std::map GetCloudPrimaryKeyFieldMap(const TableSchema &tableSchema); static bool IsContainsPrimaryKey(const TableSchema &tableSchema); static std::vector GetCloudAsset(const TableSchema &tableSchema); - static void UpdateAssetByFlag(Asset &asset); - static void UpdateAssetsByFlag(Assets &assets); + static int RebuildFillAsset(Asset &asset); + static void RebuildFillAssets(Assets &assets); static int CheckAssetFromSchema(const TableSchema &tableSchema, VBucket &vBucket, std::vector &fields); + static int ObtainAssetFromVBucket(const VBucket &vBucket, VBucket &asset); template static int GetValueFromOneField(Type &cloudValue, T &outVal) diff --git a/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h b/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h index c0cf6e4a38a5164b9e42a9a25cce5a85b4efedc6..e7cc3b4367105bc52a68b17c75d611ee776c805c 100644 --- a/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h +++ b/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h @@ -85,7 +85,9 @@ public: virtual void TriggerObserverAction(const std::string &deviceName, ChangedData &&changedData, bool isChangedData) = 0; - virtual int FillCloudAsset(const std::string &tableName, VBucket &asset, bool isFullReplace) = 0; + virtual int FillCloudAssetForDownload(const std::string &tableName, VBucket &asset, bool isFullReplace) = 0; + + virtual int FillCloudAssetForUpload(const CloudSyncData &data) = 0; }; } diff --git a/frameworks/libs/distributeddb/storage/include/storage_proxy.h b/frameworks/libs/distributeddb/storage/include/storage_proxy.h index e32227afc7d11ed662d5eefcec9ea6dcc543c620..b87bf3ee8958a002ec0d2d1e9982a99dc59f1010 100644 --- a/frameworks/libs/distributeddb/storage/include/storage_proxy.h +++ b/frameworks/libs/distributeddb/storage/include/storage_proxy.h @@ -79,7 +79,9 @@ public: int ReleaseContinueToken(ContinueToken &continueStmtToken); - int FillCloudAsset(const std::string &tableName, VBucket &asset, bool isFullReplace); + int FillCloudAssetForDownload(const std::string &tableName, VBucket &asset, bool isFullReplace); + + int FillCloudAssetForUpload(const CloudSyncData &data); protected: void Init(); diff --git a/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp b/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp index c85bd7b5470513a721595fdd126dc170effa3910..3133eb241e19caff61e5256af4f789ca584f9f02 100644 --- a/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp +++ b/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp @@ -153,15 +153,17 @@ int CloudStorageUtils::BindAsset(int index, const VBucket &vBucket, const Field if (!(IsFieldValid(field, errCode))) { goto ERROR; } - UpdateAssetByFlag(asset); - RuntimeContext::GetInstance()->AssetToBlob(asset, val); + errCode = RebuildFillAsset(asset); + if (errCode == E_OK) { + RuntimeContext::GetInstance()->AssetToBlob(asset, val); + } } else { Assets assets; errCode = GetValueFromVBucket(field.colName, vBucket, assets); if (!(IsFieldValid(field, errCode))) { goto ERROR; } - UpdateAssetsByFlag(assets); + RebuildFillAssets(assets); RuntimeContext::GetInstance()->AssetsToBlob(assets, val); } if (errCode == -E_NOT_FOUND) { @@ -292,24 +294,43 @@ std::map CloudStorageUtils::GetCloudPrimaryKeyFieldMap(const return pkMap; } -void CloudStorageUtils::UpdateAssetByFlag(Asset &asset) +int CloudStorageUtils::RebuildFillAsset(Asset &asset) { - if (static_cast(asset.flag) == AssetOpType::INSERT && - static_cast(asset.status) != AssetStatus::NORMAL) { - Asset insAsset; - insAsset.name = asset.name; - insAsset.status = asset.status; - insAsset.timestamp = asset.timestamp; - asset = insAsset; + AssetOpType flag = static_cast(asset.flag); + AssetStatus status = static_cast(asset.status); + switch (status) { + case AssetStatus::FAILURE: + case AssetStatus::DOWNLOADING: { + if (flag == AssetOpType::INSERT) { + Asset insAsset; + insAsset.name = asset.name; + insAsset.status = asset.status; + insAsset.timestamp = asset.timestamp; + asset = insAsset; + } + break; + } + case AssetStatus::INSERT: + case AssetStatus::UPDATE: { + asset.status = static_cast(AssetStatus::NORMAL); + break; + } + case AssetStatus::DELETE: { + return -E_NOT_FOUND; + } + default: + break; } + return E_OK; } -void CloudStorageUtils::UpdateAssetsByFlag(Assets &assets) +void CloudStorageUtils::RebuildFillAssets(Assets &assets) { for (auto asset = assets.begin(); asset != assets.end();) { - UpdateAssetByFlag(*asset); - if (static_cast(asset->flag) == AssetOpType::DELETE - && static_cast(asset->status) == AssetStatus::NORMAL) { + RebuildFillAsset(*asset); + AssetOpType flag = static_cast(asset->flag); + AssetStatus status = static_cast(asset->status); + if (flag == AssetOpType::DELETE && status == AssetStatus::NORMAL || status == AssetStatus::DELETE) { asset = assets.erase(asset); } else { asset++; @@ -353,4 +374,17 @@ bool CloudStorageUtils::IsContainsPrimaryKey(const TableSchema &tableSchema) } return false; } + +int CloudStorageUtils::ObtainAssetFromVBucket(const VBucket &vBucket, VBucket &asset) +{ + for (const auto &item: vBucket) { + if (item.second.index() == TYPE_INDEX) { + Asset data = std::get(item.second); + asset.insert_or_assign(item.first, data); + } else if (item.second.index() == TYPE_INDEX) { + Assets data = std::get(item.second); + asset.insert_or_assign(item.first, data); + } + } +} } diff --git a/frameworks/libs/distributeddb/storage/src/relational_sync_able_storage.cpp b/frameworks/libs/distributeddb/storage/src/relational_sync_able_storage.cpp index dfb9c1f41248c35f8e2d265e40013b9ec94e4359..2dd04d64bb3a4f4f79e42679d78df90d7361e279 100644 --- a/frameworks/libs/distributeddb/storage/src/relational_sync_able_storage.cpp +++ b/frameworks/libs/distributeddb/storage/src/relational_sync_able_storage.cpp @@ -1124,7 +1124,7 @@ int RelationalSyncAbleStorage::GetCloudTableSchema(const TableName &tableName, T return schemaMgr_.GetCloudTableSchema(tableName, tableSchema); } -int RelationalSyncAbleStorage::FillCloudAsset(const std::string &tableName, VBucket &asset, bool isFullReplace) +int RelationalSyncAbleStorage::FillCloudAssetForDownload(const std::string &tableName, VBucket &asset, bool isFullReplace) { if (storageEngine_ == nullptr) { return -E_INVALID_DB; @@ -1156,5 +1156,32 @@ int RelationalSyncAbleStorage::FillCloudAsset(const std::string &tableName, VBuc ReleaseHandle(writeHandle); return errCode; } + +int RelationalSyncAbleStorage::FillCloudAssetForUpload(const CloudSyncData &data) +{ + if (storageEngine_ == nullptr) { + return -E_INVALID_DB; + } + int errCode = E_OK; + auto writeHandle = static_cast( + storageEngine_->FindExecutor(true, OperatePerm::NORMAL_PERM, errCode, 0)); + if (writeHandle == nullptr) { + return errCode; + } + errCode = writeHandle->StartTransaction(TransactType::IMMEDIATE); + if (errCode != E_OK) { + ReleaseHandle(writeHandle); + return errCode; + } + errCode = writeHandle->FillCloudAssetForUpload(data); + if (errCode != E_OK) { + writeHandle->Rollback(); + ReleaseHandle(writeHandle); + return errCode; + } + errCode = writeHandle->Commit(); + ReleaseHandle(writeHandle); + return errCode; +} } #endif \ No newline at end of file diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.cpp b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.cpp index caf6a9ea0507aec7fccb2328e3b56898dd20e4ff..844bcd4d7f46e33e27cbdd72be78c53d919a286b 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.cpp +++ b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.cpp @@ -33,6 +33,7 @@ namespace DistributedDB { namespace { static constexpr const char* ROWID = "ROWID"; +static constexpr const char* TIMESTAMP = "TIMESTAMP"; static constexpr const char* FLAG = "FLAG"; static constexpr const char* DATAKEY = "DATA_KEY"; static constexpr const char* DEVICE_FIELD = "DEVICE"; @@ -515,7 +516,9 @@ void GetCloudLog(sqlite3_stmt *logStatement, VBucket &logInfo, uint32_t &totalSi void GetCloudExtraLog(sqlite3_stmt *logStatement, VBucket &flags) { flags.insert_or_assign(ROWID, - static_cast(sqlite3_column_int64(logStatement, 0))); // 0 means hash_key index + static_cast(sqlite3_column_int64(logStatement, 0))); // 0 means data_key index + flags.insert_or_assign(TIMESTAMP, + static_cast(sqlite3_column_int64(logStatement, 3))); // 3 means timestamp index flags.insert_or_assign(FLAG, static_cast(sqlite3_column_int64(logStatement, 5))); // 5 means flag index } @@ -524,7 +527,8 @@ int IdentifyCloudType(CloudSyncData &cloudSyncData, VBucket &data, VBucket &log, { int64_t *rowid = std::get_if(&flags[ROWID]); int64_t *flag = std::get_if(&flags[FLAG]); - if (rowid == nullptr || flag == nullptr) { + int64_t *timeStamp = std::get_if(&flags[TIMESTAMP]); + if (rowid == nullptr || flag == nullptr || timeStamp == nullptr) { return -E_INVALID_DATA; } if ((static_cast(*flag) & DataItem::DELETE_FLAG) != 0) { @@ -539,6 +543,13 @@ int IdentifyCloudType(CloudSyncData &cloudSyncData, VBucket &data, VBucket &log, } else { if (!data.empty()) { cloudSyncData.updData.record.push_back(data); + VBucket asset; + CloudStorageUtils::ObtainAssetFromVBucket(data, asset); + if (!asset.empty()) { + cloudSyncData.updData.rowid.push_back(*rowid); + cloudSyncData.updData.timestamp.push_back(*timeStamp); + cloudSyncData.updData.assets.push_back(asset); + } } cloudSyncData.updData.extend.push_back(log); } diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.h b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.h index 13cb7fadb42ffd72b09689cf38967a2c83fedd0e..b969f9762808c993d8c5f927dfec44312e1b9fd2 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.h +++ b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_executor.h @@ -109,6 +109,8 @@ public: int DoCleanInner(ClearMode mode, const std::vector &tableNameList, const std::vector &tableSchemaList, std::vector &assets); + int FillCloudAssetForUpload(const CloudSyncData &data); + private: int DoCleanLogs(const std::vector &tableNameList); @@ -187,8 +189,10 @@ private: int GetQueryLogRowid(const std::string &tableName, const VBucket &vBucket, int64_t &rowId); - int GetFillAssetStatement(const std::string &tableName, const VBucket &vBucket, const std::vector &fields, - bool isFullReplace, sqlite3_stmt *&statement); + int GetFillDownloadAssetStatement(const std::string &tableName, const VBucket &vBucket, + const std::vector &fields, bool isFullReplace, sqlite3_stmt *&statement); + + int GetFillUploadAssetStatement(const std::string &tableName, const VBucket &vBucket, sqlite3_stmt *&statement); int CalculateHashKeyForOneField(const Field &field, const VBucket &vBucket, std::vector &hashValue); diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_extend_executor.cpp b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_extend_executor.cpp index 195a33632ce92c2ea2c30dc48860b24f653319f6..76e9317a1ebdfdffa603ef2085766c16f38b7b33 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_extend_executor.cpp +++ b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_single_ver_relational_storage_extend_executor.cpp @@ -91,7 +91,7 @@ int SQLiteSingleVerRelationalStorageExecutor::GetQueryLogRowid(const std::string return errCode; } -int SQLiteSingleVerRelationalStorageExecutor::GetFillAssetStatement(const std::string &tableName, +int SQLiteSingleVerRelationalStorageExecutor::GetFillDownloadAssetStatement(const std::string &tableName, const VBucket &vBucket, const std::vector &fields, bool isFullReplace, sqlite3_stmt *&statement) { std::string sql = "UPDATE " + tableName + " SET "; @@ -141,7 +141,7 @@ int SQLiteSingleVerRelationalStorageExecutor::FillCloudAsset(const TableSchema & if (errCode != E_OK) { goto END; } - errCode = GetFillAssetStatement(tableSchema.name, vBucket, assetsField, isFullReplace, stmt); + errCode = GetFillDownloadAssetStatement(tableSchema.name, vBucket, assetsField, isFullReplace, stmt); if (errCode != E_OK) { goto END; } @@ -165,5 +165,71 @@ END: } return errCode; } + +int SQLiteSingleVerRelationalStorageExecutor::FillCloudAssetForUpload(const CloudSyncData &data) +{ + if (data.updData.assets.empty() || data.updData.rowid.empty() || data.updData.timestamp.empty()) { + return -E_INVALID_ARGS; + } + if (data.updData.assets.size() != data.updData.rowid.size() || + data.updData.assets.size() != data.updData.timestamp.size()) { + return -E_INVALID_ARGS; + } + sqlite3_stmt *stmt = nullptr; + int errCode = E_OK; + for (size_t i = 0; i < data.updData.assets.size(); ++i) { + errCode = GetFillUploadAssetStatement(data.tableName, data.updData.assets[i], stmt); + if (errCode != E_OK) { + return errCode; + } + int64_t rowid = data.updData.rowid[i]; + errCode = SQLiteUtils::BindInt64ToStatement(stmt, data.updData.assets[i].size() + 1, rowid); + if (errCode != E_OK) { + break; + } + int64_t timeStamp = data.updData.timestamp[i]; + errCode = SQLiteUtils::BindInt64ToStatement(stmt, data.updData.assets[i].size() + 2, timeStamp); // timeStamp + if (errCode != E_OK) { + break; + } + errCode = SQLiteUtils::StepWithRetry(stmt, false); + if (errCode == SQLiteUtils::MapSQLiteErrno(SQLITE_DONE)) { + errCode = E_OK; + SQLiteUtils::ResetStatement(stmt, false, errCode); + } else { + LOGE("Fill upload asset failed:%d", errCode); + break; + } + } + SQLiteUtils::ResetStatement(stmt, true, errCode); + return E_OK; +} + +int SQLiteSingleVerRelationalStorageExecutor::GetFillUploadAssetStatement(const std::string &tableName, + const VBucket &vBucket, sqlite3_stmt *&statement) +{ + std::string sql = "UPDATE " + DBCommon::GetLogTableName(tableName) + " SET "; + for (const auto &item: vBucket) { + sql += item.first + " = ?,"; + } + sql.pop_back(); + sql += " WHERE rowid = ? and timestamp = ?;"; + int errCode = SQLiteUtils::GetStatement(dbHandle_, sql, statement); + if (errCode != E_OK) { + return errCode; + } + int index = 1; + for (const auto &item: vBucket) { + Field field = { + .colName = item.first, .type = static_cast(item.second.index()) + }; + errCode = bindCloudFieldFuncMap_[item.second.index()](index++, vBucket, field, statement); + if (errCode != E_OK) { + SQLiteUtils::ResetStatement(statement, true, errCode); + return errCode; + } + } + return errCode; +} } // namespace DistributedDB #endif \ No newline at end of file diff --git a/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp b/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp index f9c01a16d80bfba2d7493ce1605f627de319680a..4e5d7e4b7e102e2a7dbb406f81f5c10a7f8a863a 100644 --- a/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp +++ b/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp @@ -311,12 +311,21 @@ int StorageProxy::NotifyChangedData(const std::string deviceName, ChangedData && return E_OK; } -int StorageProxy::FillCloudAsset(const std::string &tableName, VBucket &asset, bool isFullReplace) +int StorageProxy::FillCloudAssetForDownload(const std::string &tableName, VBucket &asset, bool isFullReplace) { std::shared_lock readLock(storeMutex_); if (store_ == nullptr) { return -E_INVALID_DB; } - return store_->FillCloudAsset(tableName, asset, isFullReplace); + return store_->FillCloudAssetForDownload(tableName, asset, isFullReplace); +} + +int StorageProxy::FillCloudAssetForUpload(const CloudSyncData &data) +{ + std::shared_lock readLock(storeMutex_); + if (store_ == nullptr) { + return -E_INVALID_DB; + } + return store_->FillCloudAssetForUpload(data); } } diff --git a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp index b8ad74804918eea159bbe8a0539ed5a86a4c96bf..a00fd1222aaaf666f8ffded8e8d0feb2ffdd81a0 100644 --- a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp +++ b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp @@ -627,13 +627,13 @@ int CloudSyncer::FillCloudAssets( { int ret = E_OK; if (!normalAssets.empty() && normalAssets.size() > 1) { - ret = storageProxy_->FillCloudAsset(tableName, normalAssets, true); + ret = storageProxy_->FillCloudAssetForDownload(tableName, normalAssets, true); if (ret != E_OK) { return ret; } } if (!failedAssets.empty() && failedAssets.size() > 1) { - ret = storageProxy_->FillCloudAsset(tableName, failedAssets, false); + ret = storageProxy_->FillCloudAssetForDownload(tableName, failedAssets, false); if (ret != E_OK) { return ret; } diff --git a/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_cloud_syncable_storage_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_cloud_syncable_storage_test.cpp index 224fd2622ed45cece4ae47ca42478243d9830acd..f8f1f2015172d30df49d9abf764ea86a88351be0 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_cloud_syncable_storage_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_cloud_syncable_storage_test.cpp @@ -254,7 +254,7 @@ void fillCloudAssetTest(int64_t count, AssetStatus statusType, bool isFullReplac vBucket["assert"] = asset; vBucket["asserts"] = assets; ASSERT_EQ(g_storageProxy->StartTransaction(), E_OK); - ASSERT_EQ(g_storageProxy->FillCloudAsset(g_tableName, vBucket, isFullReplace), E_OK); + ASSERT_EQ(g_storageProxy->FillCloudAssetForDownload(g_tableName, vBucket, isFullReplace), E_OK); ASSERT_EQ(g_storageProxy->Rollback(), E_OK); } } diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h index 1e2858b02db94711584fac8399753db1baa4bd7b..aed113e826d2bcc1a5258dfb4867f5abdde0a00a 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h @@ -38,9 +38,10 @@ public: MOCK_METHOD4(GetInfoByPrimaryKeyOrGid, int(const std::string &, const VBucket &, DataInfoWithLog &, VBucket &)); MOCK_METHOD2(PutCloudSyncData, int(const std::string &, DownloadData &)); MOCK_METHOD3(TriggerObserverAction, void(const std::string &, ChangedData &&, bool)); - MOCK_METHOD3(FillCloudAsset, int(const std::string &, VBucket &, bool)); MOCK_METHOD3(CleanCloudData, int(ClearMode mode, const std::vector &tableNameList, std::vector &assets)); + MOCK_METHOD3(FillCloudAssetForDownload, int(const std::string &, VBucket &, bool)); + MOCK_METHOD1(FillCloudAssetForUpload, int(const CloudSyncData &)); }; }