diff --git a/datamgr_service/services/distributeddataservice/framework/cloud/schema_meta.cpp b/datamgr_service/services/distributeddataservice/framework/cloud/schema_meta.cpp index d54543613e739a653e2c316a7261c8af6776a758..0188a94b691496eeb2510f83f102011e6658b821 100644 --- a/datamgr_service/services/distributeddataservice/framework/cloud/schema_meta.cpp +++ b/datamgr_service/services/distributeddataservice/framework/cloud/schema_meta.cpp @@ -18,6 +18,7 @@ namespace OHOS::DistributedData { bool SchemaMeta::Marshal(Serializable::json &node) const { SetValue(node[GET_NAME(version)], version); + SetValue(node[GET_NAME(bundleName)], bundleName); SetValue(node[GET_NAME(databases)], databases); return true; } @@ -25,6 +26,7 @@ bool SchemaMeta::Marshal(Serializable::json &node) const bool SchemaMeta::Unmarshal(const Serializable::json &node) { GetValue(node, GET_NAME(version), version); + GetValue(node, GET_NAME(bundleName), bundleName); GetValue(node, GET_NAME(databases), databases); return true; } diff --git a/datamgr_service/services/distributeddataservice/framework/include/cloud/schema_meta.h b/datamgr_service/services/distributeddataservice/framework/include/cloud/schema_meta.h index d2064961e61f75bbfc85a7ed5d7fc61035702ef2..b05c6916e79797451db80b7b95a6e068cdcb71c5 100644 --- a/datamgr_service/services/distributeddataservice/framework/include/cloud/schema_meta.h +++ b/datamgr_service/services/distributeddataservice/framework/include/cloud/schema_meta.h @@ -55,6 +55,7 @@ public: static constexpr const char *MODIFY_FIELD = "#_modifyTime"; static constexpr const char *CURSOR_FIELD = "#_cursor"; int32_t version = 0; + std::string bundleName = ""; std::vector databases; bool Marshal(json &node) const override; diff --git a/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp b/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp index 265d1afae42e6ad0310c454afc4501f20c4456e2..eccac1597b1511ad7237dec409da22913d4dcdee 100644 --- a/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp +++ b/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp @@ -241,6 +241,10 @@ int32_t CloudServiceImpl::GetCloudInfoFromServer(CloudInfo &cloudInfo) return NOT_SUPPORT; } cloudInfo = instance->GetServerInfo(cloudInfo.user); + if (!cloudInfo.IsValid()) { + ZLOGE("cloud is empty, user%{public}d", cloudInfo.user); + return ERROR; + } return SUCCESS; } diff --git a/kv_store/frameworks/libs/distributeddb/interfaces/include/store_types.h b/kv_store/frameworks/libs/distributeddb/interfaces/include/store_types.h index fa6652193a82c376d177e79574ce378113ba9427..d4b3678c0dc28e61045331b3842be3dbf284770e 100644 --- a/kv_store/frameworks/libs/distributeddb/interfaces/include/store_types.h +++ b/kv_store/frameworks/libs/distributeddb/interfaces/include/store_types.h @@ -112,6 +112,9 @@ enum SyncMode { SYNC_MODE_PUSH_ONLY, SYNC_MODE_PULL_ONLY, SYNC_MODE_PUSH_PULL, + SYNC_MODE_CLOUD_MERGE = 4, + SYNC_MODE_CLOUD_FORCE_PUSH, + SYNC_MODE_CLOUD_FORCE_PULL, }; enum ConflictResolvePolicy {