diff --git a/datamgr_service/services/distributeddataservice/framework/include/cloud/cloud_event.h b/datamgr_service/services/distributeddataservice/framework/include/cloud/cloud_event.h index e6cff13aa5498253250c83019e292b1d6924296f..47c873c99aba7c19eb4d9cb58c593f44bedf18fb 100644 --- a/datamgr_service/services/distributeddataservice/framework/include/cloud/cloud_event.h +++ b/datamgr_service/services/distributeddataservice/framework/include/cloud/cloud_event.h @@ -25,7 +25,7 @@ public: enum : int32_t { FEATURE_INIT = EVT_CLOUD, GET_SCHEMA, - NEED_CREATE, + DATA_CHANGE, CLOUD_BUTT }; @@ -34,6 +34,7 @@ public: std::string bundleName; std::string storeName; int32_t instanceId = 0; + int32_t user = 0; }; CloudEvent(int32_t evtId, StoreInfo storeInfo, const std::string &featureName = "relational_store"); 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 0ee41f6b35250d279127bbb674ff68f991886614..49d235a5131e64ebfa685700440a318463605240 100644 --- a/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp +++ b/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp @@ -171,7 +171,32 @@ int32_t CloudServiceImpl::Clean(const std::string &id, const std::map bool { + return appInfo.bundleName == bundleName; + }); + if (it == cloudInfo.apps.end()) { + ZLOGE("bundleName:%{public}s", bundleName.c_str()); + return INVALID_ARGUMENT; + } + if (!it->cloudSwitch) { + return CLOUD_DISABLE_SWITCH; + } + EventCenter::Defer defer; + CloudEvent::StoreInfo storeInfo; + storeInfo.bundleName = it->bundleName; + storeInfo.instanceId = it->instanceId; + storeInfo.user = cloudInfo.user; + auto evt = std::make_unique(CloudEvent::DATA_CHANGE, storeInfo); + EventCenter::GetInstance().PostEvent(std::move(evt)); + return SUCCESS; } int32_t CloudServiceImpl::OnInitialize() diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.cpp b/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.cpp index f69051cabade5c507f450aa3ba33605431bf3d96..41bf9ae2432fc1897dd05ef2a5240afb24dc0082 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.cpp +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.cpp @@ -24,6 +24,7 @@ #include "rdb_query.h" #include "rdb_syncer.h" #include "relational_store_manager.h" +#include "store/general_watcher.h" #include "value_proxy.h" namespace OHOS::DistributedRdb { using namespace DistributedData; @@ -155,11 +156,13 @@ int32_t RdbGeneralStore::Sync(const Devices &devices, int32_t mode, GenQuery &qu async(std::move(detail)); }, wait); + OnChangeMock(); return status == DistributedDB::OK ? GeneralError::E_OK : GeneralError::E_ERROR; } int32_t RdbGeneralStore::Watch(int32_t origin, Watcher &watcher) { + watcher_ = &watcher; return GeneralError::E_NOT_SUPPORT; } @@ -173,4 +176,13 @@ int32_t RdbGeneralStore::SetSchema(const SchemaMeta &schemaMeta) //SetSchema return GeneralError::E_OK; } + +void RdbGeneralStore::OnChangeMock() +{ + if (watcher_ == nullptr) { + ZLOGE("watcher is null"); + return; + } + watcher_->OnChange(GeneralWatcher::Origin::ORIGIN_CLOUD, ""); +} } // namespace OHOS::DistributedRdb diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.h b/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.h index a77e7e33bc6d4568e0a1d07838309e19a440ed80..9b92d947f4aa3755f31c6f526ec92cf9d92eb808 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.h +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_general_store.h @@ -59,6 +59,8 @@ private: RdbDelegate *delegate_ = nullptr; std::shared_ptr store_; std::shared_ptr cloudDb_; + Watcher *watcher_; + void OnChangeMock(); }; } // namespace OHOS::DistributedRdb #endif // OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_GENERAL_STORE_H diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_query.h b/datamgr_service/services/distributeddataservice/service/rdb/rdb_query.h index a8db5bf824991f51f22914f37f6b1d1c9757956d..fdeed511a8d894d913a57a87c31513b275392b7f 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_query.h +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_query.h @@ -28,7 +28,7 @@ public: bool IsEqual(uint64_t tid) override; - NativeRdb::RdbPredicates predicates_; + NativeRdb::RdbPredicates predicates_ {""}; }; } // namespace OHOS::DistributedRdb #endif // OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_QUERY_H diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp index 0a05e19d6f19133a07e72e921afd821e4f4dbae4..a93382e5d4944c4bde12c2fda7c5939b31048402 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp @@ -27,14 +27,16 @@ #include "metadata/meta_data_manager.h" #include "metadata/store_meta_data.h" #include "permission/permission_validator.h" +#include "rdb_watcher.h" #include "rdb_notifier_proxy.h" -#include "store/auto_cache.h" +#include "rdb_query.h" #include "types_export.h" #include "utils/anonymous.h" #include "utils/constant.h" #include "utils/converter.h" #include "cloud/schema_meta.h" #include "rdb_general_store.h" + using OHOS::DistributedKv::AccountDelegate; using OHOS::DistributedData::CheckerManager; using OHOS::DistributedData::MetaDataManager; @@ -88,6 +90,28 @@ RdbServiceImpl::RdbServiceImpl() : autoLaunchObserver_(this) [this](const std::string& identifier, DistributedDB::AutoLaunchParam ¶m) { return ResolveAutoLaunch(identifier, param); }); + EventCenter::GetInstance().Subscribe(CloudEvent::DATA_CHANGE, [this](const Event &event) { + auto &evt = static_cast(event); + auto storeInfo = evt.GetStoreInfo(); + StoreMetaData meta; + meta.storeId = storeInfo.storeName; + meta.bundleName = storeInfo.bundleName; + meta.user = storeInfo.user; + meta.instanceId = storeInfo.instanceId; + meta.deviceId = DmAdapter::GetInstance().GetLocalDevice().uuid; + if (!MetaDataManager::GetInstance().LoadMeta(meta.GetKey(), meta)) { + ZLOGE("meta empty, bundleName:%{public}s, storeId:%{public}s", + meta.bundleName.c_str(), meta.storeId.c_str()); + return; + } + auto store = AutoCache::GetInstance().GetStore(meta, GetWatchers(meta.tokenId, meta.storeId)); + if (store == nullptr) { + ZLOGE("store null, storeId:%{public}d", meta.storeId.c_str()); + return; + } + RdbQuery query; + store->Sync({}, {}, query, {}, {}); + }); } int32_t RdbServiceImpl::ResolveAutoLaunch(const std::string &identifier, DistributedDB::AutoLaunchParam ¶m) @@ -373,15 +397,74 @@ std::string RdbServiceImpl::GenIdentifier(const RdbSyncerParam ¶m) return TransferStringToHex(identifier); } -int32_t RdbServiceImpl::DoSubscribe(const RdbSyncerParam& param) +int32_t RdbServiceImpl::DoSubscribe(const RdbSyncerParam& param, const SubscribeOption &option) { pid_t pid = IPCSkeleton::GetCallingPid(); - auto identifier = GenIdentifier(param); - ZLOGI("%{public}s %{public}.6s %{public}d", param.storeName_.c_str(), identifier.c_str(), pid); - identifiers_.Insert(identifier, pid); + auto tokenId = IPCSkeleton::GetCallingTokenID(); + switch (option.mode) { + case SubscribeMode::REMOTE: { + auto identifier = GenIdentifier(param); + ZLOGI("%{public}s %{public}.6s %{public}d", param.storeName_.c_str(), identifier.c_str(), pid); + identifiers_.Insert(identifier, pid); + break; + } + case SubscribeMode::CLOUD: // fallthrough + case SubscribeMode::CLOUD_DETAIL: { + syncAgents_.Compute(tokenId, [this, pid, tokenId, ¶m, &option](auto &key, SyncAgent &value) { + if (pid != value.pid_) { + value.ReInit(pid, param.bundleName_); + } + auto storeName = RdbSyncer::RemoveSuffix(param.storeName_); + auto it = value.watchers_.find(storeName); + if (it == value.watchers_.end()) { + auto watcher = std::make_shared(this, tokenId, storeName); + value.watchers_[storeName] = { watcher }; + value.mode_[storeName] = option.mode; + } + return true; + }); + break; + } + default: + return RDB_ERROR; + } return RDB_OK; } +void RdbServiceImpl::OnChange(uint32_t tokenId, const std::string &storeName) +{ + pid_t pid = 0; + syncAgents_.ComputeIfPresent(tokenId, [&pid, &storeName](auto &key, SyncAgent &value) { + pid = value.pid_; + return true; + }); + notifiers_.ComputeIfPresent(pid, [&storeName](const auto& key, const sptr& value) { + value->OnChange(storeName, { storeName }); + return true; + }); +} + +AutoCache::Watchers RdbServiceImpl::GetWatchers(uint32_t tokenId, const std::string &storeName) +{ + AutoCache::Watchers watchers; + syncAgents_.ComputeIfPresent(tokenId, [&storeName, &watchers](auto, SyncAgent &agent) { + auto it = agent.watchers_.find(storeName); + if (it != agent.watchers_.end()) { + watchers = it->second; + } + return true; + }); + return watchers; +} + +void RdbServiceImpl::SyncAgent::ReInit(pid_t pid, const std::string &bundleName) +{ + pid_ = pid; + bundleName_ = bundleName; + watchers_.clear(); + mode_.clear(); +} + int32_t RdbServiceImpl::DoUnSubscribe(const RdbSyncerParam& param) { auto identifier = GenIdentifier(param); diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.h b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.h index 89fcac3c94a4e13a617e831cbf972385cdae0e23..462dac522e4af52f9e23f65058e360f5765ae1ed 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.h +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.h @@ -27,6 +27,7 @@ #include "rdb_notifier_proxy.h" #include "rdb_syncer.h" #include "store_observer.h" +#include "store/auto_cache.h" #include "visibility.h" namespace OHOS::DistributedRdb { class API_EXPORT RdbServiceImpl : public RdbServiceStub { @@ -49,6 +50,8 @@ public: void OnDataChange(pid_t pid, const DistributedDB::StoreChangedData& data); + void OnChange(uint32_t tokenId, const std::string &storeName); + int32_t CreateRDBTable( const RdbSyncerParam ¶m, const std::string &writePermission, const std::string &readPermission) override; int32_t DestroyRDBTable(const RdbSyncerParam ¶m) override; @@ -68,11 +71,22 @@ protected: int32_t DoAsync(const RdbSyncerParam& param, uint32_t seqNum, const SyncOption& option, const RdbPredicates& predicates) override; - int32_t DoSubscribe(const RdbSyncerParam& param) override; + int32_t DoSubscribe(const RdbSyncerParam& param, const SubscribeOption &option) override; int32_t DoUnSubscribe(const RdbSyncerParam& param) override; private: + using Watchers = DistributedData::AutoCache::Watchers; + struct SyncAgent { + pid_t pid_ = 0; + std::string bundleName_; + std::map mode_; + std::map watchers_; + void ReInit(pid_t pid, const std::string &bundleName); + }; + + Watchers GetWatchers(uint32_t tokenId, const std::string &storeName); + std::string GenIdentifier(const RdbSyncerParam& param); bool CheckAccess(const std::string& bundleName, const std::string& storeName); @@ -117,6 +131,7 @@ private: static constexpr int32_t MAX_SYNCER_PER_PROCESS = 10; static constexpr int32_t SYNCER_TIMEOUT = 60 * 1000; // ms std::shared_ptr executors_; + ConcurrentMap syncAgents_; }; } // namespace OHOS::DistributedRdb #endif diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_stub.cpp b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_stub.cpp index 39fd62d4eaacea188f684bbf7afbd7c11b03a34b..ccc864ae06fa7ba2a4c8af1b0fec478de2c3aa58 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_stub.cpp +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_stub.cpp @@ -134,13 +134,14 @@ int32_t RdbServiceStub::OnRemoteDoAsync(MessageParcel &data, MessageParcel &repl int32_t RdbServiceStub::OnRemoteDoSubscribe(MessageParcel &data, MessageParcel &reply) { RdbSyncerParam param; - if (!ITypesUtil::Unmarshal(data, param)) { + SubscribeOption option; + if (!ITypesUtil::Unmarshal(data, param, option)) { ZLOGE("Unmarshal bundleName_:%{public}s storeName_:%{public}s", param.bundleName_.c_str(), param.storeName_.c_str()); return IPC_STUB_INVALID_DATA_ERR; } - auto status = DoSubscribe(param); + auto status = DoSubscribe(param, option); if (!ITypesUtil::Marshal(reply, status)) { ZLOGE("Marshal status:0x%{public}x", status); return IPC_STUB_WRITE_PARCEL_ERR; diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_watcher.cpp b/datamgr_service/services/distributeddataservice/service/rdb/rdb_watcher.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1d0089f8b18c9bcc2211cbecc47c74cc6b8c7a96 --- /dev/null +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_watcher.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "RdbWatcher" + +#include "rdb_watcher.h" +#include "log_print.h" +#include "error/general_error.h" + +namespace OHOS::DistributedRdb { +using namespace DistributedData; +using Err = DistributedData::GeneralError; +RdbWatcher::RdbWatcher(RdbServiceImpl *rdbService, uint32_t tokenId, const std::string &storeName) + : tokenId_(tokenId), rdbService_(rdbService), storeName_(storeName) +{ +} + +int32_t RdbWatcher::OnChange(Origin origin, const std::string &id) +{ + if (rdbService_ == nullptr) { + return Err::E_ERROR; + } + rdbService_->OnChange(tokenId_, storeName_); + return Err::E_OK; +} + +int32_t RdbWatcher::OnChange(Origin origin, const std::string &id, const std::vector &values) +{ + return Err::E_NOT_SUPPORT; +} +} // namespace OHOS::DistributedRdb diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_watcher.h b/datamgr_service/services/distributeddataservice/service/rdb/rdb_watcher.h new file mode 100644 index 0000000000000000000000000000000000000000..5896f19d1503ef6568cf1392d2248db7b4b8eaa5 --- /dev/null +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_watcher.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_GENERAL_WATCHER_H +#define OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_GENERAL_WATCHER_H +#include "rdb_service_impl.h" +#include "store/general_value.h" +#include "store/general_watcher.h" + +namespace OHOS::DistributedRdb { +class RdbServiceImpl; +class RdbWatcher : public DistributedData::GeneralWatcher { +public: + explicit RdbWatcher(RdbServiceImpl *rdbService, uint32_t tokenId, const std::string &storeName); + int32_t OnChange(Origin origin, const std::string &id) override; + int32_t OnChange(Origin origin, const std::string &id, + const std::vector &values) override; + +private: + uint32_t tokenId_ = 0; + std::string storeName_ {}; + RdbServiceImpl* rdbService_ {}; +}; +} // namespace OHOS::DistributedRdb +#endif // OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_GENERAL_WATCHER_H diff --git a/relational_store/frameworks/native/rdb/include/rdb_service_proxy.h b/relational_store/frameworks/native/rdb/include/rdb_service_proxy.h index 6c7bc59d1e5061ea1c95f3a7ac1e622512e21730..552760e2b821f435690e019d1aa91bc9fcb3414e 100644 --- a/relational_store/frameworks/native/rdb/include/rdb_service_proxy.h +++ b/relational_store/frameworks/native/rdb/include/rdb_service_proxy.h @@ -65,7 +65,7 @@ protected: int32_t DoAsync(const RdbSyncerParam& param, uint32_t seqNum, const SyncOption& option, const RdbPredicates& predicates) override; - int32_t DoSubscribe(const RdbSyncerParam& param) override; + int32_t DoSubscribe(const RdbSyncerParam& param, const SubscribeOption &option) override; int32_t DoUnSubscribe(const RdbSyncerParam& param) override; diff --git a/relational_store/frameworks/native/rdb/include/rdb_types_util.h b/relational_store/frameworks/native/rdb/include/rdb_types_util.h index 019b9ce416de9588ff3ba2e116983431c38e649f..9b1bfd2760373ac671b397c787a761aff51c565d 100644 --- a/relational_store/frameworks/native/rdb/include/rdb_types_util.h +++ b/relational_store/frameworks/native/rdb/include/rdb_types_util.h @@ -21,6 +21,7 @@ #include "values_bucket.h" #include "rdb_visibility.h" namespace OHOS::ITypesUtil { +using SubOption = DistributedRdb::SubscribeOption; using SyncerParam = DistributedRdb::RdbSyncerParam; using SyncOption = DistributedRdb::SyncOption; using RdbPredicates = DistributedRdb::RdbPredicates; @@ -29,6 +30,10 @@ using ValueObject = NativeRdb::ValueObject; using ValuesBucket = NativeRdb::ValuesBucket; using Asset = NativeRdb::AssetValue; template<> +API_EXPORT bool Marshalling(const SubOption &input, MessageParcel &data); +template<> +API_EXPORT bool Unmarshalling(SubOption &output, MessageParcel &data); +template<> API_EXPORT bool Marshalling(const SyncerParam &input, MessageParcel &data); template<> API_EXPORT bool Unmarshalling(SyncerParam &output, MessageParcel &data); diff --git a/relational_store/frameworks/native/rdb/src/rdb_service_proxy.cpp b/relational_store/frameworks/native/rdb/src/rdb_service_proxy.cpp index fa87c474e0b2cc045f10be994dd4d1d08e47873f..4752b4b0c53fe43499296dcca475a481a1c0edb1 100644 --- a/relational_store/frameworks/native/rdb/src/rdb_service_proxy.cpp +++ b/relational_store/frameworks/native/rdb/src/rdb_service_proxy.cpp @@ -225,7 +225,11 @@ int32_t RdbServiceProxy::Subscribe(const RdbSyncerParam ¶m, const SubscribeO ZLOGE("subscribe mode invalid"); return RDB_ERROR; } - if (DoSubscribe(param) != RDB_OK) { + if (DoSubscribe(param, option) != RDB_OK) { + ZLOGI("communicate to server failed"); + return RDB_ERROR; + } + if (DoSubscribe(param, {SubscribeMode::CLOUD}) != RDB_OK) { ZLOGI("communicate to server failed"); return RDB_ERROR; } @@ -244,10 +248,10 @@ int32_t RdbServiceProxy::Subscribe(const RdbSyncerParam ¶m, const SubscribeO return RDB_OK; } -int32_t RdbServiceProxy::DoSubscribe(const RdbSyncerParam ¶m) +int32_t RdbServiceProxy::DoSubscribe(const RdbSyncerParam ¶m, const SubscribeOption &option) { MessageParcel reply; - int32_t status = IPC_SEND(RDB_SERVICE_CMD_SUBSCRIBE, reply, param); + int32_t status = IPC_SEND(RDB_SERVICE_CMD_SUBSCRIBE, reply, param, option); if (status != RDB_OK) { ZLOGE("status:%{public}d, bundleName:%{public}s, storeName:%{public}s", status, param.bundleName_.c_str(), param.storeName_.c_str()); diff --git a/relational_store/frameworks/native/rdb/src/rdb_types_util.cpp b/relational_store/frameworks/native/rdb/src/rdb_types_util.cpp index 444ba037956af7a223bee4851ea976dd2e895204..efae8c112db0eda2166abc4076a23587a4a7c727 100644 --- a/relational_store/frameworks/native/rdb/src/rdb_types_util.cpp +++ b/relational_store/frameworks/native/rdb/src/rdb_types_util.cpp @@ -21,6 +21,7 @@ bool Marshalling(const SyncerParam &input, MessageParcel &data) return ITypesUtil::Marshal(data, input.bundleName_, input.hapName_, input.storeName_, input.area_, input.level_, input.type_, input.isAutoSync_, input.isEncrypt_, input.password_); } + template<> bool Unmarshalling(SyncerParam &output, MessageParcel &data) { @@ -28,6 +29,21 @@ bool Unmarshalling(SyncerParam &output, MessageParcel &data) output.level_, output.type_, output.isAutoSync_, output.isEncrypt_, output.password_); } +template<> +bool Marshalling(const SubOption &input, MessageParcel &data) +{ + return ITypesUtil::Marshal(data, static_cast(input.mode)); +} + +template<> +bool Unmarshalling(SubOption &output, MessageParcel &data) +{ + int32_t mode = static_cast(output.mode); + auto ret = ITypesUtil::Unmarshal(data); + output.mode = static_cast(mode); + return ret; +} + template<> bool Marshalling(const SyncOption &input, MessageParcel &data) { diff --git a/relational_store/interfaces/inner_api/cloud_data/include/cloud_service.h b/relational_store/interfaces/inner_api/cloud_data/include/cloud_service.h index 0e69ebba99192c3321b0adabb47b216b38ccb6d1..3915683ef2d8a23854bb739176507d313529037d 100644 --- a/relational_store/interfaces/inner_api/cloud_data/include/cloud_service.h +++ b/relational_store/interfaces/inner_api/cloud_data/include/cloud_service.h @@ -46,6 +46,8 @@ public: ERROR, INVALID_ARGUMENT, SERVER_UNAVAILABLE, + CLOUD_DISABLE, + CLOUD_DISABLE_SWITCH, IPC_ERROR, IPC_PARCEL_ERROR }; diff --git a/relational_store/interfaces/inner_api/rdb/include/rdb_service.h b/relational_store/interfaces/inner_api/rdb/include/rdb_service.h index fc8f6ed33cf6cf6f69a2517a2a1eeb5e739dce6e..bca3349a7c29fd786372456d5d070507a48a2909 100644 --- a/relational_store/interfaces/inner_api/rdb/include/rdb_service.h +++ b/relational_store/interfaces/inner_api/rdb/include/rdb_service.h @@ -73,7 +73,7 @@ protected: virtual int32_t DoAsync(const RdbSyncerParam ¶m, uint32_t seqNum, const SyncOption &option, const RdbPredicates &predicates) = 0; - virtual int32_t DoSubscribe(const RdbSyncerParam ¶m) = 0; + virtual int32_t DoSubscribe(const RdbSyncerParam ¶m, const SubscribeOption &option) = 0; virtual int32_t DoUnSubscribe(const RdbSyncerParam ¶m) = 0; }; diff --git a/relational_store/interfaces/inner_api/rdb/include/rdb_types.h b/relational_store/interfaces/inner_api/rdb/include/rdb_types.h index ed0d372f80ffefc4b76f7981122d4220007fc16e..37111d400e8233dd16528b1ef9ec0a1d112ccde7 100644 --- a/relational_store/interfaces/inner_api/rdb/include/rdb_types.h +++ b/relational_store/interfaces/inner_api/rdb/include/rdb_types.h @@ -100,6 +100,7 @@ struct RdbPredicates { enum SubscribeMode { REMOTE, CLOUD, + CLOUD_DETAIL, SUBSCRIBE_MODE_MAX };