From 29f67fd34b9f2d4cdf4c73977e2645ee73415034 Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Fri, 26 May 2023 16:53:09 +0800 Subject: [PATCH 1/2] update Signed-off-by: zuojiangjiang --- .../service/cloud/cloud_service_impl.cpp | 4 ++++ .../libs/distributeddb/interfaces/include/store_types.h | 3 +++ 2 files changed, 7 insertions(+) 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 265d1afa..eccac159 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 fa665219..d4b3678c 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 { -- Gitee From 4f040bb26359d3a928d364ef232785de094b3e79 Mon Sep 17 00:00:00 2001 From: zuojiangjiang Date: Fri, 26 May 2023 17:06:55 +0800 Subject: [PATCH 2/2] update Signed-off-by: zuojiangjiang --- .../distributeddataservice/framework/cloud/schema_meta.cpp | 2 ++ .../framework/include/cloud/schema_meta.h | 1 + 2 files changed, 3 insertions(+) diff --git a/datamgr_service/services/distributeddataservice/framework/cloud/schema_meta.cpp b/datamgr_service/services/distributeddataservice/framework/cloud/schema_meta.cpp index d5454361..0188a94b 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 d2064961..b05c6916 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; -- Gitee