diff --git a/bundle.json b/bundle.json index 2873bcfdffcf72416d4c5550224e216355849c91..fff2827940076849fcebbf4b6d1f215bb193b693 100644 --- a/bundle.json +++ b/bundle.json @@ -102,7 +102,6 @@ "kvstore_death_recipient.h", "kvstore_observer.h", "kvstore_result_set.h", - "kvstore_snapshot.h", "kvstore_sync_callback.h", "single_kvstore.h", "types.h", diff --git a/frameworks/common/log_print.h b/frameworks/common/log_print.h new file mode 100644 index 0000000000000000000000000000000000000000..ccaa6c91ef5acbeba3b5baccc2d8810a30a23534 --- /dev/null +++ b/frameworks/common/log_print.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2021 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 DISTRIBUTEDDATA_LOG_PRINT_H +#define DISTRIBUTEDDATA_LOG_PRINT_H + +#define OS_OHOS +#if defined OS_OHOS // log for OHOS + +#include "hilog/log.h" +namespace OHOS { +namespace DistributedKv { +static inline OHOS::HiviewDFX::HiLogLabel LogLabel() +{ + return { LOG_CORE, 0xD001610, "ZDDS" }; +} +} // end namespace DistributesdKv + +namespace DistributedData { +static inline OHOS::HiviewDFX::HiLogLabel LogLabel() +{ + return { LOG_CORE, 0xD001611, "ZDD" }; +} +} // end namespace DistributedData + +namespace AppDistributedKv { +static inline OHOS::HiviewDFX::HiLogLabel LogLabel() +{ + return { LOG_CORE, 0xD001620, "ZDDC" }; +} +} // namespace AppDistributedKv + +namespace DistributedRdb { +static inline OHOS::HiviewDFX::HiLogLabel LogLabel() +{ + return { LOG_CORE, 0xD001655, "DRDB" }; +} +} // end namespace DistributedRdb +} // end namespace OHOS + +#define ZLOGD(fmt, ...) \ + OHOS::HiviewDFX::HiLog::Debug(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__) + +#define ZLOGI(fmt, ...) \ + OHOS::HiviewDFX::HiLog::Info(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__) + +#define ZLOGW(fmt, ...) \ + OHOS::HiviewDFX::HiLog::Warn(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__) + +#define ZLOGE(fmt, ...) \ + OHOS::HiviewDFX::HiLog::Error(LogLabel(), LOG_TAG "::%{public}s: " fmt, __FUNCTION__, ##__VA_ARGS__) + +#else + #error // unknown system +#endif + +#endif // DISTRIBUTEDDATA_LOG_PRINT_H diff --git a/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h b/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h index fee31eaf40a1f6432ab5625abd9e1ef4b3a65744..c51e3b19852100ce6259a49a2acd257d7b81ec8e 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h +++ b/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_data_service.h @@ -116,6 +116,7 @@ private: int32_t GetSingleKvStoreOnRemote(MessageParcel &data, MessageParcel &reply); int32_t GetRdbServiceOnRemote(MessageParcel& data, MessageParcel& reply); int32_t GetKVdbServiceOnRemote(MessageParcel& data, MessageParcel& reply); + static Options FromBuffer(const OptionsIpc &optionsIpc); using RequestHandler = int32_t(KvStoreDataServiceStub::*)(MessageParcel&, MessageParcel&); static constexpr RequestHandler HANDLERS[SERVICE_CMD_LAST] = { @@ -166,6 +167,7 @@ public: virtual sptr GetRdbService(); virtual sptr GetKVdbService(); private: + static OptionsIpc ToBuffer(const Options &options); static inline BrokerDelegator delegator_; }; } // namespace OHOS::DistributedKv diff --git a/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_observer.h b/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_observer.h index cf05a666816af0aa045b538b2dab6f8fbfab56e5..30a8e9f313f584bbeea4c55583261c7d994d03bf 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_observer.h +++ b/frameworks/innerkitsimpl/distributeddatafwk/include/ikvstore_observer.h @@ -19,7 +19,6 @@ #include "change_notification.h" #include "iremote_broker.h" #include "ikvstore_observer.h" -#include "ikvstore_snapshot.h" #include "iremote_proxy.h" #include "iremote_stub.h" @@ -28,7 +27,7 @@ namespace DistributedKv { class IKvStoreObserver : public IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedKv.IKvStoreObserver"); - virtual void OnChange(const ChangeNotification &changeNotification, sptr snapshot) = 0; + virtual void OnChange(const ChangeNotification &changeNotification) = 0; }; class KvStoreObserverStub : public IRemoteStub { @@ -41,7 +40,7 @@ class KvStoreObserverProxy : public IRemoteProxy { public: explicit KvStoreObserverProxy(const sptr &impl); ~KvStoreObserverProxy() = default; - void OnChange(const ChangeNotification &changeNotification, sptr snapshot) override; + void OnChange(const ChangeNotification &changeNotification) override; private: static inline BrokerDelegator delegator_; }; diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp index 620f36ab29bcd78cc13e43ee89d88ded583d8ae1..6324799ae836fce3b6304601690beee4bc73e7e1 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp @@ -37,7 +37,7 @@ KvStoreDataServiceProxy::KvStoreDataServiceProxy(const sptr &impl Status KvStoreDataServiceProxy::GetSingleKvStore(const Options &options, const AppId &appId, const StoreId &storeId, std::function)> callback) { - ZLOGI("%s %s", appId.appId.c_str(), storeId.storeId.c_str()); + ZLOGI("%{public}s %{public}s", appId.appId.c_str(), storeId.storeId.c_str()); MessageParcel data; MessageParcel reply; if (!data.WriteInterfaceToken(KvStoreDataServiceProxy::GetDescriptor())) { @@ -49,17 +49,7 @@ Status KvStoreDataServiceProxy::GetSingleKvStore(const Options &options, const A return Status::IPC_ERROR; } // Passing a struct with an std::string field is a potential security exploit. - OptionsIpc optionsIpc; - optionsIpc.createIfMissing = options.createIfMissing; - optionsIpc.encrypt = options.encrypt; - optionsIpc.persistent = options.persistent; - optionsIpc.backup = options.backup; - optionsIpc.autoSync = options.autoSync; - optionsIpc.securityLevel = options.securityLevel; - optionsIpc.syncPolicy = options.syncPolicy; - optionsIpc.kvStoreType = options.kvStoreType; - optionsIpc.syncable = options.syncable; - optionsIpc.dataOwnership = true; // set default value + OptionsIpc optionsIpc = ToBuffer(options); std::string schemaString = options.schema; if (!data.WriteBuffer(&optionsIpc, sizeof(OptionsIpc)) || @@ -88,6 +78,22 @@ Status KvStoreDataServiceProxy::GetSingleKvStore(const Options &options, const A return status; } +OptionsIpc KvStoreDataServiceProxy::ToBuffer(const Options &options) +{ + OptionsIpc optionsIpc; + optionsIpc.createIfMissing = options.createIfMissing; + optionsIpc.encrypt = options.encrypt; + optionsIpc.persistent = options.persistent; + optionsIpc.backup = options.backup; + optionsIpc.autoSync = options.autoSync; + optionsIpc.securityLevel = options.securityLevel; + optionsIpc.syncPolicy = options.syncPolicy; + optionsIpc.kvStoreType = options.kvStoreType; + optionsIpc.syncable = options.syncable; + optionsIpc.dataOwnership = true; // set default value + return optionsIpc; +} + void KvStoreDataServiceProxy::GetAllKvStoreId(const AppId &appId, std::function &)> callback) { @@ -412,6 +418,7 @@ int32_t KvStoreDataServiceStub::GetAllKvStoreIdOnRemote(MessageParcel &data, Mes } return 0; } + int32_t KvStoreDataServiceStub::GetRemoteDevicesOnRemote(MessageParcel &data, MessageParcel &reply) { std::vector infos; @@ -433,6 +440,7 @@ int32_t KvStoreDataServiceStub::GetRemoteDevicesOnRemote(MessageParcel &data, Me } return 0; } + int32_t KvStoreDataServiceStub::StartWatchDeviceChangeOnRemote(MessageParcel &data, MessageParcel &reply) { DeviceFilterStrategy strategy = static_cast(data.ReadInt32()); @@ -451,6 +459,7 @@ int32_t KvStoreDataServiceStub::StartWatchDeviceChangeOnRemote(MessageParcel &da } return 0; } + int32_t KvStoreDataServiceStub::StopWatchDeviceChangeOnRemote(MessageParcel &data, MessageParcel &reply) { sptr remote = data.ReadRemoteObject(); @@ -468,6 +477,7 @@ int32_t KvStoreDataServiceStub::StopWatchDeviceChangeOnRemote(MessageParcel &dat } return 0; } + int32_t KvStoreDataServiceStub::GetSingleKvStoreOnRemote(MessageParcel &data, MessageParcel &reply) { const OptionsIpc *optionIpcPtr = reinterpret_cast(data.ReadBuffer(sizeof(OptionsIpc))); @@ -481,17 +491,7 @@ int32_t KvStoreDataServiceStub::GetSingleKvStoreOnRemote(MessageParcel &data, Me OptionsIpc optionsIpc = *optionIpcPtr; AppId appId = { Constant::TrimCopy(data.ReadString())}; StoreId storeId = { Constant::TrimCopy(data.ReadString())}; - Options options; - options.createIfMissing = optionsIpc.createIfMissing; - options.encrypt = optionsIpc.encrypt; - options.persistent = optionsIpc.persistent; - options.backup = optionsIpc.backup; - options.autoSync = optionsIpc.autoSync; - options.securityLevel = optionsIpc.securityLevel; - options.syncPolicy = optionsIpc.syncPolicy; - options.kvStoreType = optionsIpc.kvStoreType; - options.syncable = optionsIpc.syncable; - options.dataOwnership = optionsIpc.dataOwnership; + Options options = FromBuffer(optionsIpc); options.schema = data.ReadString(); sptr proxyTmp; Status status = GetSingleKvStore(options, appId, storeId, @@ -507,6 +507,22 @@ int32_t KvStoreDataServiceStub::GetSingleKvStoreOnRemote(MessageParcel &data, Me return 0; } +Options KvStoreDataServiceStub::FromBuffer(const OptionsIpc &optionsIpc) +{ + Options options; + options.createIfMissing = optionsIpc.createIfMissing; + options.encrypt = optionsIpc.encrypt; + options.persistent = optionsIpc.persistent; + options.backup = optionsIpc.backup; + options.autoSync = optionsIpc.autoSync; + options.securityLevel = optionsIpc.securityLevel; + options.syncPolicy = optionsIpc.syncPolicy; + options.kvStoreType = optionsIpc.kvStoreType; + options.syncable = optionsIpc.syncable; + options.dataOwnership = optionsIpc.dataOwnership; + return options; +} + int32_t KvStoreDataServiceStub::CloseKvStoreOnRemote(MessageParcel &data, MessageParcel &reply) { AppId appId = { Constant::TrimCopy(data.ReadString())}; diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_observer.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_observer.cpp index 107bd3c56e0b4a40d6d84b1fc64fa394c8e61e3b..d297d760bac172c67a0db2a7aa6986af6bd64fb3 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_observer.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_observer.cpp @@ -84,7 +84,7 @@ bool WriteListToParcelByBuf(MessageParcel &data, const int64_t &bufferSize, cons return true; } -void KvStoreObserverProxy::OnChange(const ChangeNotification &changeNotification, sptr snapshot) +void KvStoreObserverProxy::OnChange(const ChangeNotification &changeNotification) { MessageParcel data; MessageParcel reply; @@ -118,11 +118,6 @@ void KvStoreObserverProxy::OnChange(const ChangeNotification &changeNotification } } - if (snapshot != nullptr && !data.WriteRemoteObject(snapshot->AsObject().GetRefPtr())) { - ZLOGE("write strong parcel failed."); - return; - } - MessageOption mo { MessageOption::TF_WAIT_TIME }; int error = Remote()->SendRequest(ONCHANGE, data, reply, mo); if (error != 0) { @@ -189,13 +184,7 @@ int32_t KvStoreObserverStub::OnRemoteRequest(uint32_t code, MessageParcel &data, ZLOGE("changeNotification is nullptr"); return errorResult; } - sptr remote = data.ReadRemoteObject(); - if (remote != nullptr) { - sptr kvStoreSnapshotProxy = iface_cast(remote); - OnChange(*changeNotification, std::move(kvStoreSnapshotProxy)); - } else { - OnChange(*changeNotification, nullptr); - } + OnChange(*changeNotification); } else { std::vector insertEntries; bool result = ReadListFromBuf(data, insertEntries); @@ -222,14 +211,7 @@ int32_t KvStoreObserverStub::OnRemoteRequest(uint32_t code, MessageParcel &data, bool isClear = data.ReadBool(); ChangeNotification change(std::move(insertEntries), std::move(updateEntries), std::move(deleteEntries), deviceId, isClear); - sptr remote = data.ReadRemoteObject(); - if (remote != nullptr) { - sptr kvStoreSnapshotProxy = iface_cast(remote); - OnChange(change, std::move(kvStoreSnapshotProxy)); - } else { - ZLOGD("read kvstoreSnapshot is nullptr."); - OnChange(change, nullptr); - } + OnChange(change); } return 0; } diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.cpp index 201e612abc1e4590529a82ee3a6f8ea79562a8c4..5dbb60864e79770848881c69ba607227df87da58 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.cpp @@ -16,7 +16,6 @@ #define LOG_TAG "KvStoreObserverClient" #include "kvstore_observer_client.h" -#include "kvstore_snapshot_client.h" #include "log_print.h" namespace OHOS { @@ -33,17 +32,13 @@ KvStoreObserverClient::~KvStoreObserverClient() ZLOGI("end"); } -void KvStoreObserverClient::OnChange(const ChangeNotification &changeNotification, sptr snapshot) +void KvStoreObserverClient::OnChange(const ChangeNotification &changeNotification) { ZLOGI("start"); if (kvStoreObserver_ != nullptr) { if (type_ == KvStoreType::SINGLE_VERSION) { ZLOGI("SINGLE_VERSION start"); kvStoreObserver_->OnChange(changeNotification); - } else { - ZLOGI("MULTI_VERSION start"); - kvStoreObserver_->OnChange(changeNotification, - std::make_unique(std::move(snapshot))); } } } diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.h b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.h index 1ba2a076712a27baabf14569989a5010687d535c..addcd074a2b5dfeb81661019e5d468b01754f8f9 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.h +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.h @@ -19,7 +19,6 @@ #include #include "change_notification.h" #include "ikvstore_observer.h" -#include "ikvstore_snapshot.h" #include "kvstore_observer.h" #include "refbase.h" @@ -32,7 +31,7 @@ public: ~KvStoreObserverClient(); - void OnChange(const ChangeNotification &changeNotification, sptr snapshot) override; + void OnChange(const ChangeNotification &changeNotification) override; const StoreId &GetStoreId() const; diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp index 5402033d6383e05b0854cc7af064d66211b7242c..59e15a42e1243585615a0c42eb0abe356faea14e 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp @@ -38,8 +38,8 @@ void KvStoreSyncCallbackClient::SyncCompleted(const std::map callback, - uint64_t sequenceId) +void KvStoreSyncCallbackClient::AddSyncCallback( + const std::shared_ptr callback, uint64_t sequenceId) { if (callback == nullptr) { ZLOGE("callback is nullptr"); diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.h b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.h index c738b58bb4b1249d8a073551a91687e90d284f73..301dda0a575945bf830f1367a6e33220d6eb7da6 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.h +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.h @@ -30,8 +30,7 @@ public: void SyncCompleted(const std::map &results, uint64_t sequenceId) override; - void AddSyncCallback(const std::shared_ptr callback, - uint64_t sequenceId); + void AddSyncCallback(const std::shared_ptr callback, uint64_t sequenceId); void DeleteSyncCallback(uint64_t sequenceId); private: diff --git a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/distributed_kv_data_manager_test.cpp b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/distributed_kv_data_manager_test.cpp index 69d55662ef387e04347a432e2feaafd8dba5bc90..76551654c8257891e33c6dc616bcf3944fed8524 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/distributed_kv_data_manager_test.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/distributed_kv_data_manager_test.cpp @@ -714,37 +714,3 @@ HWTEST_F(DistributedKvDataManagerTest, UnRegisterKvStoreServiceDeathRecipient001 std::shared_ptr kvStoreDeathRecipientPtr = std::make_shared(); manager.UnRegisterKvStoreServiceDeathRecipient(kvStoreDeathRecipientPtr); } - -class DeviceListenerImpl : public DeviceStatusChangeListener { -public: - void OnDeviceChanged(const DeviceInfo &info, const DeviceChangeType &type) const override - { - } - DeviceFilterStrategy GetFilterStrategy() const override - { - return DeviceFilterStrategy::NO_FILTER; - } -}; -/** -* @tc.name: GetDevice001 -* @tc.desc: Get device id. -* @tc.type: FUNC -* @tc.require: SR000DOH1R AR000DPSGU -* @tc.author: hongbo -*/ -HWTEST_F(DistributedKvDataManagerTest, GetDevice001, TestSize.Level1) -{ - ZLOGI("GetDevice001 begin."); - DeviceInfo info; - Status status = manager.GetLocalDevice(info); - EXPECT_EQ(Status::SUCCESS, status) << "expected getLocalDevice true"; - EXPECT_TRUE(info.deviceId.size() > 0) << "expected deviceId exist"; - - std::vector infos; - status = manager.GetDeviceList(infos, DeviceFilterStrategy::FILTER); - auto listener = std::make_shared(); - status = manager.StartWatchDeviceChange(listener); - EXPECT_EQ(Status::SUCCESS, status) << "expected StartWatchDeviceChange true"; - status = manager.StopWatchDeviceChange(listener); - EXPECT_EQ(Status::SUCCESS, status) << "expected StopWatchDeviceChange true"; -} diff --git a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/local_subscribe_store_test.cpp b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/local_subscribe_store_test.cpp index 8dd8fa6efe561daee4788eefd7be3fd035556a55..9804c2ad854ccaa94c42625885940837e1f45b25 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/local_subscribe_store_test.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/local_subscribe_store_test.cpp @@ -99,9 +99,6 @@ public: KvStoreObserverUnitTest(KvStoreObserverUnitTest &&) = delete; KvStoreObserverUnitTest &operator=(KvStoreObserverUnitTest &&) = delete; - // callback function will be called when the db data is changed. - void OnChange(const ChangeNotification &changeNotification, std::shared_ptr snapshot); - void OnChange(const ChangeNotification &changeNotification); // reset the callCount_ to zero. @@ -122,8 +119,7 @@ KvStoreObserverUnitTest::KvStoreObserverUnitTest() isClear_ = false; } -void KvStoreObserverUnitTest::OnChange(const ChangeNotification &changeNotification, - std::shared_ptr snapshot) +void KvStoreObserverUnitTest::OnChange(const ChangeNotification &changeNotification) { ZLOGD("begin."); callCount_++; @@ -134,11 +130,6 @@ void KvStoreObserverUnitTest::OnChange(const ChangeNotification &changeNotificat isClear_ = changeNotification.IsClear(); } -void KvStoreObserverUnitTest::OnChange(const ChangeNotification &changeNotification) -{ - OnChange(changeNotification, nullptr); -} - void KvStoreObserverUnitTest::ResetToZero() { callCount_ = 0; diff --git a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/single_kvstore_client_test.cpp b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/single_kvstore_client_test.cpp index 641e45ce340395ff199491e4bf4ecf3e668040e4..e8bb85013c8e3e07af479ea3260f97032ad0cfc3 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/single_kvstore_client_test.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/single_kvstore_client_test.cpp @@ -88,9 +88,6 @@ public: KvStoreObserverTestImpl(KvStoreObserverTestImpl &&) = delete; KvStoreObserverTestImpl &operator=(KvStoreObserverTestImpl &&) = delete; - // callback function will be called when the db data is changed. - void OnChange(const ChangeNotification &changeNotification, std::shared_ptr snapshot); - void OnChange(const ChangeNotification &changeNotification); // reset the callCount_ to zero. @@ -126,11 +123,6 @@ void KvStoreObserverTestImpl::OnChange(const ChangeNotification &changeNotificat isClear_ = changeNotification.IsClear(); } -void KvStoreObserverTestImpl::OnChange(const ChangeNotification &changeNotification, - std::shared_ptr snapshot) -{} - - KvStoreObserverTestImpl::KvStoreObserverTestImpl() { callCount_ = 0; diff --git a/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h b/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h index 9560698ada1f321e454124ac11b52f797ae0beed..dc5a4851900f49afef4321da9d36dce7bd36c741 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h @@ -62,8 +62,6 @@ private: public: DataObserver(std::shared_ptr uvQueue, napi_value callback) : JSObserver(uvQueue, callback) {}; virtual ~DataObserver() = default; - void OnChange(const DistributedKv::ChangeNotification& notification, - std::shared_ptr snapshot) override; void OnChange(const DistributedKv::ChangeNotification& notification) override; }; diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp index 2762606e842229ae7b6fb536e89fc19e17575822..13bc8d7be0393faf12556d159f76729a874005b1 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp @@ -612,14 +612,6 @@ void JsKVStore::SetUvQueue(std::shared_ptr uvQueue) uvQueue_ = uvQueue; } -void JsKVStore::DataObserver::OnChange(const ChangeNotification ¬ification, - std::shared_ptr snapshot) -{ - ZLOGD("data change insert:%{public}zu, update:%{public}zu, delete:%{public}zu", - notification.GetInsertEntries().size(), notification.GetUpdateEntries().size(), - notification.GetDeleteEntries().size()); -} - void JsKVStore::DataObserver::OnChange(const ChangeNotification& notification) { ZLOGD("data change insert:%{public}zu, update:%{public}zu, delete:%{public}zu", diff --git a/interfaces/innerkits/distributeddata/BUILD.gn b/interfaces/innerkits/distributeddata/BUILD.gn index ff9467439d9c29a1bed05b9637ec3f480338ef9a..1e93611e35e9cf5123e494184bff96abb7393a69 100755 --- a/interfaces/innerkits/distributeddata/BUILD.gn +++ b/interfaces/innerkits/distributeddata/BUILD.gn @@ -57,14 +57,12 @@ ohos_shared_library("distributeddata_inner") { "../../../frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_observer.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp", - "../../../frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_snapshot.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_sync_callback.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/itypes_util.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_client_death_observer.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_observer_client.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_resultset_client.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_service_death_notifier.cpp", - "../../../frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_snapshot_client.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp", "../../../frameworks/innerkitsimpl/distributeddatafwk/src/sync_observer.cpp", diff --git a/interfaces/innerkits/distributeddata/include/distributed_kv_data_manager.h b/interfaces/innerkits/distributeddata/include/distributed_kv_data_manager.h index d2456a4628e97b66c0e6a3fe4a34c275e57c5396..3b505ed2d0d897743086b9a68e0e551266edf551 100644 --- a/interfaces/innerkits/distributeddata/include/distributed_kv_data_manager.h +++ b/interfaces/innerkits/distributeddata/include/distributed_kv_data_manager.h @@ -106,6 +106,7 @@ public: // observer: callback for device status change event. // Return: // Status of this subscribe operation. + [[deprecated]] API_EXPORT Status StartWatchDeviceChange(std::shared_ptr observer); // Unsubscribe device status change, like online or offline. @@ -115,6 +116,7 @@ public: // observer: callback for device status change event. // Return: // Status of this unsubscribe operation. + [[deprecated]] API_EXPORT Status StopWatchDeviceChange(std::shared_ptr observer); // Get all connected devices. @@ -124,6 +126,7 @@ public: // deviceInfoList: list of all connected device will be returned by this parameter. // Return: // Status of this get device list operation. + [[deprecated]] API_EXPORT Status GetDeviceList(std::vector &deviceInfoList, DeviceFilterStrategy strategy); // Get device. @@ -132,6 +135,7 @@ public: // localDevice: DeviceInfo will be returned by this parameter. // Return: // Status of this get device operation. + [[deprecated]] API_EXPORT Status GetLocalDevice(DeviceInfo &localDevice); }; } // namespace DistributedKv diff --git a/interfaces/innerkits/distributeddata/include/kvstore.h b/interfaces/innerkits/distributeddata/include/kvstore.h index e138eec4feada04666b9a276492b6ad3e6994f03..52c854e3459059008f4d5540c52d2c06fec1d88f 100644 --- a/interfaces/innerkits/distributeddata/include/kvstore.h +++ b/interfaces/innerkits/distributeddata/include/kvstore.h @@ -17,7 +17,6 @@ #define KVSTORE_H #include "kvstore_observer.h" -#include "kvstore_snapshot.h" #include "types.h" namespace OHOS { diff --git a/interfaces/innerkits/distributeddata/include/kvstore_observer.h b/interfaces/innerkits/distributeddata/include/kvstore_observer.h index a0013e06394de14199f39b78c8aeff754d648a9e..8be7f0e12c87b22e72bac1897963d0acdb650938 100644 --- a/interfaces/innerkits/distributeddata/include/kvstore_observer.h +++ b/interfaces/innerkits/distributeddata/include/kvstore_observer.h @@ -18,7 +18,6 @@ #include #include "change_notification.h" -#include "kvstore_snapshot.h" namespace OHOS { namespace DistributedKv { @@ -29,9 +28,6 @@ public: API_EXPORT virtual ~KvStoreObserver() {} - // client override this function to receive change notification. - virtual void OnChange(const ChangeNotification &changeNotification, std::shared_ptr snapshot) = 0; - // client override this function to receive change notification. API_EXPORT virtual void OnChange(const ChangeNotification &changeNotification) {} }; diff --git a/interfaces/jskits/distributeddata/BUILD.gn b/interfaces/jskits/distributeddata/BUILD.gn index fa53fdfe9f9a14fd1ddd7f0f2f8942e605894352..c6a79a8e6421ef7cf368a90ba22d60a08220d4ff 100644 --- a/interfaces/jskits/distributeddata/BUILD.gn +++ b/interfaces/jskits/distributeddata/BUILD.gn @@ -38,9 +38,9 @@ ohos_shared_library("distributeddata") { "//third_party/libuv/include", "//third_party/node/src", "//utils/native/base/include", - "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata/include", + "//foundation/distributeddatamgr/distributeddatamgr/frameworks/common", "//foundation/distributeddatamgr/distributeddatamgr/frameworks/jskitsimpl/distributeddata/include", - "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/log", + "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata/include", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/autils", ] diff --git a/services/distributeddataservice/adapter/account/src/account_delegate_normal_impl.cpp b/services/distributeddataservice/adapter/account/src/account_delegate_normal_impl.cpp deleted file mode 100644 index d32ce2b45bf87262895455675a5bad531b4409f5..0000000000000000000000000000000000000000 --- a/services/distributeddataservice/adapter/account/src/account_delegate_normal_impl.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2022 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 "AccountDelegateNormalImpl" - -#include "account_delegate_normal_impl.h" -#include -#include -#include -#include -#include -#include -#include "log_print.h" -#include "ohos_account_kits.h" -#include "os_account_manager.h" -#include "utils/crypto.h" - -namespace OHOS { -namespace DistributedKv { -using namespace OHOS::EventFwk; -using namespace OHOS::AAFwk; -using namespace OHOS::DistributedData; -AccountDelegate::BaseInstance AccountDelegate::getInstance_ = AccountDelegateNormalImpl::GetBaseInstance; - -AccountDelegateNormalImpl *AccountDelegateNormalImpl::GetInstance() -{ - static AccountDelegateNormalImpl accountDelegate; - return &accountDelegate; -} - -AccountDelegate *AccountDelegateNormalImpl::GetBaseInstance() -{ - return AccountDelegateNormalImpl::GetInstance(); -} - -std::string AccountDelegateNormalImpl::GetCurrentAccountId() const -{ - ZLOGD("start"); - auto ohosAccountInfo = AccountSA::OhosAccountKits::GetInstance().QueryOhosAccountInfo(); - if (!ohosAccountInfo.first) { - ZLOGE("get ohosAccountInfo from OhosAccountKits is null, return default"); - return AccountSA::DEFAULT_OHOS_ACCOUNT_UID; - } - if (ohosAccountInfo.second.uid_.empty()) { - ZLOGE("get ohosAccountInfo from OhosAccountKits is null, return default"); - return AccountSA::DEFAULT_OHOS_ACCOUNT_UID; - } - - return Sha256AccountId(ohosAccountInfo.second.uid_); -} - -std::string AccountDelegateNormalImpl::GetDeviceAccountIdByUID(int32_t uid) const -{ - int userId = 0; - auto ret = AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(uid, userId); - if (ret != 0) { - ZLOGE("failed get os account local id from uid, ret:%{public}d", ret); - return {}; - } - return std::to_string(userId); -} - -bool AccountDelegateNormalImpl::QueryUsers(std::vector &users) -{ - users = {0}; // default user - return AccountSA::OsAccountManager::QueryActiveOsAccountIds(users) == 0; -} - -void AccountDelegateNormalImpl::SubscribeAccountEvent() -{ - ZLOGI("Subscribe account event listener start."); - MatchingSkills matchingSkills; - matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_USER_REMOVED); - matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_USER_SWITCHED); - CommonEventSubscribeInfo info(matchingSkills); - eventSubscriber_ = std::make_shared(info); - eventSubscriber_->SetEventCallback([&](AccountEventInfo &account) { - account.harmonyAccountId = GetCurrentAccountId(); - NotifyAccountChanged(account); - }); - - std::thread th = std::thread([eventSubscriber = eventSubscriber_]() { - int tryTimes = 0; - constexpr int MAX_RETRY_TIME = 300; - constexpr int RETRY_WAIT_TIME_S = 1; - - // we use this method to make sure register success - while (tryTimes < MAX_RETRY_TIME) { - auto result = CommonEventManager::SubscribeCommonEvent(eventSubscriber); - if (result) { - break; - } - - ZLOGE("EventManager: Fail to register subscriber, error:%d", result); - sleep(RETRY_WAIT_TIME_S); - tryTimes++; - } - if (tryTimes == MAX_RETRY_TIME) { - ZLOGE("EventManager: Fail to register subscriber!"); - } - ZLOGI("EventManager: Success to register subscriber."); - }); - th.detach(); -} - -AccountDelegateNormalImpl::~AccountDelegateNormalImpl() -{ - ZLOGD("destruct"); - const auto result = CommonEventManager::UnSubscribeCommonEvent(eventSubscriber_); - if (!result) { - ZLOGE("Fail to unregister account event listener!"); - } - observerMap_.Clear(); -} - -std::string AccountDelegateNormalImpl::Sha256AccountId(const std::string &plainText) const -{ - std::regex pattern("^[0-9]+$"); - if (!std::regex_match(plainText, pattern)) { - return plainText; - } - - int64_t plain; - std::string::size_type int64MaxLen(std::to_string(INT64_MAX).size()); - // plain text length must be less than INT64_MAX string. - plain = atoll(plainText.c_str()); - if (plain == 0) { - return plainText; - } - if (plain == INT64_MAX) { - plain = atoll(plainText.substr(plainText.size() - int64MaxLen + 1, int64MaxLen - 1).c_str()); - } - - auto plainVal = htobe64(plain); - return Crypto::Sha256(static_cast(&plainVal), sizeof(plainVal), true); -} -} // namespace DistributedKv -} // namespace OHOS \ No newline at end of file diff --git a/services/distributeddataservice/adapter/account/test/BUILD.gn b/services/distributeddataservice/adapter/account/test/BUILD.gn index d19e880f9a1fb4e889f420396329a1335177b57a..d24e8bb4f51363951f630c6a6e9a73f9e5389d74 100755 --- a/services/distributeddataservice/adapter/account/test/BUILD.gn +++ b/services/distributeddataservice/adapter/account/test/BUILD.gn @@ -23,7 +23,6 @@ ohos_unittest("DistributeddataAccountTest") { "//utils/native/base/include", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/account", "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata/include", - "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/log", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/autils", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/utils", "//foundation/distributeddatamgr/distributeddatamgr/frameworks/common", diff --git a/services/distributeddataservice/adapter/broadcaster/BUILD.gn b/services/distributeddataservice/adapter/broadcaster/BUILD.gn index 7a1ba02d66b5b722fe3037e11cd5be76df1e7785..b72dc92a18b0102e6e884d89c21cccfd2c1d42bc 100755 --- a/services/distributeddataservice/adapter/broadcaster/BUILD.gn +++ b/services/distributeddataservice/adapter/broadcaster/BUILD.gn @@ -33,7 +33,6 @@ ohos_static_library("distributeddata_broadcaster_static") { external_deps = [ # "ces:libcommonevent", - "ability_base:base", "ability_base:want", "bundle_framework:appexecfwk_base", "common_event_service:cesfwk_innerkits", diff --git a/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp b/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp index 8dd3d8450c6493623b8f560700444af51f1d376e..4c65a23467ff36fd55269155baa8a1c7f7f053fb 100644 --- a/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp +++ b/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp @@ -19,7 +19,7 @@ #include "common_event_manager.h" #include "common_event_support.h" #include "log_print.h" -#include "string_wrapper.h" +#include "ohos/aafwk/base/string_wrapper.h" namespace OHOS::DistributedKv { using namespace OHOS::EventFwk; diff --git a/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp b/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp index 5b3712e7cb0a0555008b38200ddb94ab3785744f..e8b78e1167d5a99ae14c82296ad11fe3aafe85c7 100644 --- a/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp +++ b/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp @@ -228,11 +228,12 @@ DBStatus ProcessCommunicatorImpl::CheckAndGetDataHeadInfo( ZLOGE("failed to get header handler"); return DBStatus::DB_ERROR; } - auto ret = handler->ParseHeadData(data, dataLen, headLen, users); + auto ret = handler->ParseHeadData(data, dataLen, headLen); if (!ret) { ZLOGD("illegal head format"); return DBStatus::INVALID_FORMAT; } + users = handler->GetUser(); if (users.empty()) { ZLOGW("no valid user"); return DBStatus::NO_PERMISSION; diff --git a/services/distributeddataservice/adapter/communicator/test/BUILD.gn b/services/distributeddataservice/adapter/communicator/test/BUILD.gn index c65c8e87cc5e774e7f51e5ed339aebc6b9032165..e531ca7fa15e4f6e1602450de4a6835bb6ca564c 100755 --- a/services/distributeddataservice/adapter/communicator/test/BUILD.gn +++ b/services/distributeddataservice/adapter/communicator/test/BUILD.gn @@ -21,7 +21,7 @@ ohos_unittest("CommunicationProviderTest") { sources = [ "./unittest/communication_provider_impl_test.cpp" ] include_dirs = [ "//utils/native/base/include", - "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/log", + "//foundation/distributeddatamgr/distributeddatamgr/framework/common", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/autils", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/communicator", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/dfx", @@ -50,7 +50,6 @@ config("module_comm_config") { "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata/include", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/communicator", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/dfx", - "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/log", "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter/include/autils", ] } diff --git a/services/distributeddataservice/adapter/include/communicator/route_head_handler.h b/services/distributeddataservice/adapter/include/communicator/route_head_handler.h index f31eea2db267e3d48b87bed4d392c7cc38bb9408..c2b0a5910be908bac6e7135709d44a4be1329ab8 100644 --- a/services/distributeddataservice/adapter/include/communicator/route_head_handler.h +++ b/services/distributeddataservice/adapter/include/communicator/route_head_handler.h @@ -25,8 +25,8 @@ public: using ExtendInfo = DistributedDB::ExtendInfo; using DBStatus = DistributedDB::DBStatus; - virtual bool ParseHeadData( - const uint8_t *data, uint32_t totalLen, uint32_t &headSize, std::vector &users) = 0; + virtual bool ParseHeadData(const uint8_t *data, uint32_t totalLen, uint32_t &headSize) = 0; + virtual std::vector GetUser() = 0; }; } // namespace OHOS::DistributedData #endif // DISTRIBUTEDDATAMGR_EXTEND_HEAD_HANDLER_H diff --git a/services/distributeddataservice/adapter/permission/src/bundle_checker.cpp b/services/distributeddataservice/adapter/permission/src/bundle_checker.cpp index 4a1080f465d740aca6ad6b38dca7c9f3310ed7e7..cc4187884db314ad3294e30d26b6ee7723dfa644 100644 --- a/services/distributeddataservice/adapter/permission/src/bundle_checker.cpp +++ b/services/distributeddataservice/adapter/permission/src/bundle_checker.cpp @@ -18,7 +18,7 @@ #include #include "accesstoken_kit.h" #include "hap_token_info.h" -#include "log/log_print.h" +#include "log_print.h" #include "utils/crypto.h" namespace OHOS { namespace DistributedData { diff --git a/services/distributeddataservice/adapter/permission/src/media_lib_checker.cpp b/services/distributeddataservice/adapter/permission/src/media_lib_checker.cpp index bbd1b897c7bafa4db587591477e1a4dfa8f8ba4e..758fb76a802c829808d3a8c665df6c9a2476b672 100644 --- a/services/distributeddataservice/adapter/permission/src/media_lib_checker.cpp +++ b/services/distributeddataservice/adapter/permission/src/media_lib_checker.cpp @@ -19,7 +19,7 @@ #include "accesstoken_kit.h" #include "bundlemgr/bundle_mgr_client.h" #include "hap_token_info.h" -#include "log/log_print.h" +#include "log_print.h" #include "utils/crypto.h" namespace OHOS { namespace DistributedData { diff --git a/services/distributeddataservice/adapter/permission/src/system_checker.cpp b/services/distributeddataservice/adapter/permission/src/system_checker.cpp index 7e23910c2af2ea2a3fd1beaf2a3e659e2ff404d2..b05dff97e416c6ed6488a43c0aa68d29ac6bdeaa 100644 --- a/services/distributeddataservice/adapter/permission/src/system_checker.cpp +++ b/services/distributeddataservice/adapter/permission/src/system_checker.cpp @@ -15,7 +15,7 @@ #define LOG_TAG "SystemChecker" #include "system_checker.h" #include "accesstoken_kit.h" -#include "log/log_print.h" +#include "log_print.h" namespace OHOS { namespace DistributedData { using namespace Security::AccessToken; diff --git a/services/distributeddataservice/app/BUILD.gn b/services/distributeddataservice/app/BUILD.gn index f66cbe4857ca64015be2b39a1d1e12588de05165..165850e184777f37836d52e42a3c1d2283150167 100644 --- a/services/distributeddataservice/app/BUILD.gn +++ b/services/distributeddataservice/app/BUILD.gn @@ -88,7 +88,6 @@ ohos_shared_library("distributeddataservice") { "src/kvstore_meta_manager.cpp", "src/kvstore_observer_impl.cpp", "src/kvstore_resultset_impl.cpp", - "src/kvstore_snapshot_impl.cpp", "src/kvstore_sync_manager.cpp", "src/kvstore_user_manager.cpp", "src/query_helper.cpp", diff --git a/services/distributeddataservice/app/src/device_kvstore_observer_impl.cpp b/services/distributeddataservice/app/src/device_kvstore_observer_impl.cpp index efd61259b1d98dee9150d453b970f25d5d13d7af..aa718a099491bde31a42304e00e45ee4dcd43432 100644 --- a/services/distributeddataservice/app/src/device_kvstore_observer_impl.cpp +++ b/services/distributeddataservice/app/src/device_kvstore_observer_impl.cpp @@ -46,7 +46,7 @@ void DeviceKvStoreObserverImpl::OnChange(const DistributedDB::KvStoreChangedData } ChangeNotification change(std::move(inserts), std::move(updates), std::move(deleteds), deviceId, false); if (observerProxy_ != nullptr) { - observerProxy_->OnChange(change, nullptr); + observerProxy_->OnChange(change); } } diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 978953627f3955b3e40e2ebf526da53412099333..f1a9350ebf363988b0aa66b8bc88d5b8f3d38aea 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -696,11 +696,12 @@ void KvStoreDataService::OnStart() } ZLOGE("GetLocalDeviceId failed, retry count:%{public}d", static_cast(retry)); } - Initialize(); + ZLOGI("Bootstrap configs and plugins."); Bootstrap::GetInstance().LoadComponents(); Bootstrap::GetInstance().LoadDirectory(); Bootstrap::GetInstance().LoadCheckers(); Bootstrap::GetInstance().LoadNetworks(); + Initialize(); auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (samgr != nullptr) { ZLOGI("samgr exist."); diff --git a/services/distributeddataservice/app/src/kvstore_observer_impl.cpp b/services/distributeddataservice/app/src/kvstore_observer_impl.cpp index a1b0cf1af809033e82bc658cbeaf3aa2171bb106..a8bba4d019a96948d4a6286fee636e41a7b5909d 100644 --- a/services/distributeddataservice/app/src/kvstore_observer_impl.cpp +++ b/services/distributeddataservice/app/src/kvstore_observer_impl.cpp @@ -80,7 +80,7 @@ void KvStoreObserverImpl::OnChange(const DistributedDB::KvStoreChangedData &data ChangeNotification change(std::move(inserts), std::move(updates), std::move(deleteds), std::string(), false); ZLOGI("call proxy OnChange"); - observerProxy_->OnChange(change, nullptr); + observerProxy_->OnChange(change); } SubscribeType KvStoreObserverImpl::GetSubscribeType() const diff --git a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp index a328ba109d38aceacbc7fb0f31802abdb9c43eb5..e83286318f0703acba6e16527492c1da01e4e527 100644 --- a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp +++ b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp @@ -84,7 +84,8 @@ DistributedDB::DBStatus RouteHeadHandlerImpl::GetHeadDataSize(uint32_t &headSize return DistributedDB::DB_ERROR; } size_t expectSize = sizeof(RouteHead) + sizeof(SessionDevicePair) + sizeof(SessionUserPair) - + session_.targetUserIds.size() * sizeof(int) + sizeof(SessionAppId) + session_.appId.size(); + + session_.targetUserIds.size() * sizeof(int) + sizeof(SessionAppId) + session_.appId.size() + + sizeof(SessionStoreId) + session_.storeId.size(); // align message uint width headSize = GET_ALIGNED_SIZE(expectSize, ALIGN_WIDTH); @@ -164,18 +165,33 @@ bool RouteHeadHandlerImpl::PackDataBody(uint8_t *data, uint32_t totalLen) SessionAppId *appPair = reinterpret_cast(ptr); ptr += sizeof(SessionAppId); - uint32_t appLen = data + totalLen - ptr; - appPair->len = HostToNet(appLen); // left size - ret = strcpy_s(appPair->appId, appLen, session_.appId.c_str()); + uint32_t appLen = session_.appId.size(); + appPair->len = HostToNet(appLen); + ZLOGE("appLen:%{public}u, appId:%{public}s", appLen, session_.appId.c_str()); + ret = memcpy_s(appPair->appId, appLen, session_.appId.c_str(), appLen); if (ret != 0) { - ZLOGE("strcpy for app id failed"); + ZLOGE("strcpy for app id failed, ret:%{public}d", ret); return false; } + ptr += appLen; + return WriteStoreId(ptr); +} + +bool RouteHeadHandlerImpl::WriteStoreId(uint8_t *&ptr) const +{ + auto *storeId = reinterpret_cast(ptr); + uint32_t storeLen = session_.storeId.size(); + storeId->len = HostToNet(storeLen); + auto ret = memcpy_s(storeId->storeId, storeLen, session_.storeId.c_str(), storeLen); + if (ret != 0) { + ZLOGE("strcpy for store id failed, ret:%{public}d,store:%{public}s", ret, session_.storeId.c_str()); + return false; + } + ptr += (sizeof(SessionStoreId) + storeLen); return true; } -bool RouteHeadHandlerImpl::ParseHeadData( - const uint8_t *data, uint32_t len, uint32_t &headSize, std::vector &users) +bool RouteHeadHandlerImpl::ParseHeadData(const uint8_t *data, uint32_t len, uint32_t &headSize) { auto ret = UnPackData(data, len, headSize); if (!ret) { @@ -183,10 +199,22 @@ bool RouteHeadHandlerImpl::ParseHeadData( ZLOGE("unpack data head failed"); return false; } + headSize_ = headSize; ZLOGI("unpacked size:%{public}u", headSize); + return true; +} + +std::vector RouteHeadHandlerImpl::GetUser() +{ + std::vector users; // flip the local and peer ends SessionPoint local { .deviceId = session_.targetDeviceId, .appId = session_.appId }; - SessionPoint peer { .deviceId = session_.sourceDeviceId, .userId = session_.sourceUserId, .appId = session_.appId }; + SessionPoint peer { + .deviceId = session_.sourceDeviceId, + .userId = session_.sourceUserId, + .appId = session_.appId, + .storeId = session_.storeId + }; ZLOGI("validSession:%{public}s", Serializable::Marshall(session_).c_str()); for (const auto &item : session_.targetUserIds) { local.userId = item; @@ -194,7 +222,7 @@ bool RouteHeadHandlerImpl::ParseHeadData( users.emplace_back(std::to_string(item)); } } - return true; + return users; } bool RouteHeadHandlerImpl::UnPackData(const uint8_t *data, uint32_t totalLen, uint32_t &unpackedSize) @@ -282,6 +310,26 @@ bool RouteHeadHandlerImpl::UnPackDataBody(const uint8_t *data, uint32_t totalLen return false; } session_.appId.append(appId->appId, appIdLen); + auto appIdSize = sizeof(SessionAppId) + appIdLen; + ptr += appIdSize; + leftSize -= appIdSize; + + ReadStoreId(ptr, leftSize); return true; } + +bool RouteHeadHandlerImpl::ReadStoreId(const uint8_t *&ptr, uint32_t &leftSize) +{ + if (leftSize >= sizeof(SessionStoreId)) { + const auto *storeId = reinterpret_cast(ptr); + auto storeIdLen = NetToHost(storeId->len); + if (leftSize - sizeof(SessionStoreId) >= storeIdLen) { + session_.storeId.append(storeId->storeId, storeIdLen); + ptr += (sizeof(SessionStoreId) + storeIdLen); + leftSize -= (sizeof(SessionStoreId) + storeIdLen); + return true; + } + } + return false; +} } // namespace OHOS::DistributedData \ No newline at end of file diff --git a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h index 5c85f93a52e29b489699ec84abd9e1aa3ebdd9ae..cc3e676a22dc317bfc82532b4771ab5b26823dcc 100644 --- a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h +++ b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h @@ -21,9 +21,9 @@ #include "session_manager.h" namespace OHOS::DistributedData { -template constexpr T GET_ALIGNED_SIZE(T x, int alignWidth) +inline size_t GET_ALIGNED_SIZE(size_t size, int alignWidth) { - return (x + (alignWidth - 1)) & ~(alignWidth - 1); + return (size + (alignWidth - 1)) & ~(alignWidth - 1); } #pragma pack(1) @@ -53,6 +53,11 @@ struct SessionAppId { uint32_t len; char appId[0]; }; + +struct SessionStoreId { + uint32_t len; + char storeId[0]; +}; #pragma pack() class RouteHeadHandlerImpl : public DistributedData::RouteHeadHandler { @@ -61,7 +66,8 @@ public: explicit RouteHeadHandlerImpl(const ExtendInfo &info); DBStatus GetHeadDataSize(uint32_t &headSize) override; DBStatus FillHeadData(uint8_t *data, uint32_t headSize, uint32_t totalLen) override; - bool ParseHeadData(const uint8_t *data, uint32_t len, uint32_t &headSize, std::vector &users) override; + bool ParseHeadData(const uint8_t *data, uint32_t len, uint32_t &headSize) override; + std::vector GetUser() override; private: void Init(); @@ -71,6 +77,8 @@ private: bool UnPackData(const uint8_t *data, uint32_t totalLen, uint32_t &unpackedSize); bool UnPackDataHead(const uint8_t *data, uint32_t totalLen, RouteHead &routeHead); bool UnPackDataBody(const uint8_t *data, uint32_t totalLen); + bool WriteStoreId(uint8_t *&ptr) const; + bool ReadStoreId(const uint8_t *&ptr, uint32_t &leftSize); std::string userId_; std::string appId_; diff --git a/services/distributeddataservice/app/src/session_manager/session_manager.cpp b/services/distributeddataservice/app/src/session_manager/session_manager.cpp index a9cc0900c97eed22ae97877f0d0e832d7ebcda2d..500604023bf2884b588b33622a49c88516b8852b 100644 --- a/services/distributeddataservice/app/src/session_manager/session_manager.cpp +++ b/services/distributeddataservice/app/src/session_manager/session_manager.cpp @@ -21,7 +21,7 @@ #include "auth_delegate.h" #include "checker/checker_manager.h" -#include "log/log_print.h" +#include "log_print.h" #include "metadata/meta_data_manager.h" #include "metadata/store_meta_data.h" #include "user_delegate.h" @@ -44,6 +44,7 @@ Session SessionManager::GetSession(const SessionPoint &from, const std::string & session.sourceUserId = from.userId; session.sourceDeviceId = from.deviceId; session.targetDeviceId = targetDeviceId; + session.storeId = from.storeId; auto users = UserDelegate::GetInstance().GetRemoteUserStatus(targetDeviceId); // system service if (from.userId == UserDelegate::SYSTEM_USER) { @@ -85,6 +86,7 @@ bool Session::Marshal(json &node) const ret = SetValue(node[GET_NAME(sourceUserId)], sourceUserId) && ret; ret = SetValue(node[GET_NAME(targetUserIds)], targetUserIds) && ret; ret = SetValue(node[GET_NAME(appId)], appId) && ret; + ret = SetValue(node[GET_NAME(storeId)], storeId) && ret; return ret; } @@ -96,6 +98,7 @@ bool Session::Unmarshal(const json &node) ret = GetValue(node, GET_NAME(sourceUserId), sourceUserId) && ret; ret = GetValue(node, GET_NAME(targetUserIds), targetUserIds) && ret; ret = GetValue(node, GET_NAME(appId), appId) && ret; + ret = GetValue(node, GET_NAME(storeId), storeId) && ret; return ret; } } // namespace OHOS::DistributedData diff --git a/services/distributeddataservice/app/src/session_manager/session_manager.h b/services/distributeddataservice/app/src/session_manager/session_manager.h index bad2b8e2f6cad8b3d461d4aa722de72ec415d532..318f555eb1a8437124d6c1c8c5827b160d9cf5a1 100644 --- a/services/distributeddataservice/app/src/session_manager/session_manager.h +++ b/services/distributeddataservice/app/src/session_manager/session_manager.h @@ -36,6 +36,7 @@ public: uint32_t sourceUserId; std::vector targetUserIds; std::string appId; + std::string storeId; bool Marshal(json &node) const override; bool Unmarshal(const json &node) override; inline bool IsValid() diff --git a/services/distributeddataservice/app/src/single_kvstore_impl.cpp b/services/distributeddataservice/app/src/single_kvstore_impl.cpp index d8aaf12eee8bd1af0dfd4a5ed77efd4e640a9d05..0b691049ea3706abf3866cc7b41dfa571985751a 100644 --- a/services/distributeddataservice/app/src/single_kvstore_impl.cpp +++ b/services/distributeddataservice/app/src/single_kvstore_impl.cpp @@ -1071,150 +1071,6 @@ Status SingleKvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvSt return Status::ERROR; } -Status SingleKvStoreImpl::MigrateKvStore(const std::string &harmonyAccountId, - const std::string &kvStoreDataDir, - DistributedDB::KvStoreDelegateManager *oldDelegateMgr, - DistributedDB::KvStoreDelegateManager *&newDelegateMgr) -{ - ZLOGI("begin."); - std::unique_lock lock(storeNbDelegateMutex_); - if (oldDelegateMgr == nullptr) { - ZLOGW("kvStore delegate manager is nullptr."); - return Status::INVALID_ARGUMENT; - } - - ZLOGI("create new KvStore."); - std::vector secretKey; // expected get secret key from meta kvstore successful when encrypt flag is true. - std::unique_ptr, void(*)(std::vector*)> cleanGuard( - &secretKey, [](std::vector *ptr) { ptr->assign(ptr->size(), 0); }); - bool outdated = false; // ignore outdated flag during rebuild kvstore. - auto metaSecretKey = KvStoreMetaManager::GetMetaKey(deviceAccountId_, "default", bundleName_, storeId_, - "SINGLE_KEY"); - if (options_.encrypt) { - KvStoreMetaManager::GetInstance().GetSecretKeyFromMeta(metaSecretKey, secretKey, outdated); - if (secretKey.empty()) { - ZLOGE("Get secret key from meta kvstore failed."); - return Status::CRYPT_ERROR; - } - } - - DistributedDB::DBStatus dbStatus; - DistributedDB::KvStoreNbDelegate::Option dbOption; - Status status = KvStoreAppManager::InitNbDbOption(options_, secretKey, dbOption); - if (status != Status::SUCCESS) { - ZLOGE("InitNbDbOption failed."); - return status; - } - - if (newDelegateMgr == nullptr) { - if (appId_.empty()) { - ZLOGE("Get appId by bundle name failed."); - return Status::MIGRATION_KVSTORE_FAILED; - } - newDelegateMgr = new (std::nothrow) DistributedDB::KvStoreDelegateManager(appId_, harmonyAccountId); - if (newDelegateMgr == nullptr) { - ZLOGE("new KvStoreDelegateManager failed."); - return Status::MIGRATION_KVSTORE_FAILED; - } - DistributedDB::KvStoreConfig kvStoreConfig; - kvStoreConfig.dataDir = kvStoreDataDir; - newDelegateMgr->SetKvStoreConfig(kvStoreConfig); - } - DistributedDB::KvStoreNbDelegate *kvStoreNbDelegate = nullptr; // new KvStoreNbDelegate get from distributed DB. - newDelegateMgr->GetKvStore( - storeId_, dbOption, - [&](DistributedDB::DBStatus status, DistributedDB::KvStoreNbDelegate *delegate) { - kvStoreNbDelegate = delegate; - dbStatus = status; - }); - if (kvStoreNbDelegate == nullptr) { - ZLOGE("storeDelegate is nullptr, dbStatusTmp: %d", static_cast(dbStatus)); - return Status::DB_ERROR; - } - - if (options_.autoSync) { - bool autoSync = true; - auto data = static_cast(&autoSync); - auto pragmaStatus = kvStoreNbDelegate->Pragma(DistributedDB::PragmaCmd::AUTO_SYNC, data); - if (pragmaStatus != DistributedDB::DBStatus::OK) { - ZLOGE("pragmaStatus: %d", static_cast(pragmaStatus)); - } - } - - status = RebuildKvStoreObserver(kvStoreNbDelegate); - if (status != Status::SUCCESS) { - ZLOGI("rebuild KvStore observer failed, errCode %d.", static_cast(status)); - // skip this failed, continue to do other rebuild process. - } - - status = RebuildKvStoreResultSet(); - if (status != Status::SUCCESS) { - ZLOGI("rebuild KvStore resultset failed, errCode %d.", static_cast(status)); - // skip this failed, continue to do close kvstore process. - } - - ZLOGI("close old KvStore."); - dbStatus = oldDelegateMgr->CloseKvStore(kvStoreNbDelegate_); - if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGI("rebuild KvStore failed during close KvStore, errCode %d.", static_cast(status)); - newDelegateMgr->CloseKvStore(kvStoreNbDelegate); - return Status::DB_ERROR; - } - - ZLOGI("update kvstore delegate."); - kvStoreNbDelegate_ = kvStoreNbDelegate; - return Status::SUCCESS; -} - -Status SingleKvStoreImpl::RebuildKvStoreObserver(DistributedDB::KvStoreNbDelegate *kvStoreNbDelegate) -{ - ZLOGI("rebuild observer."); - if (kvStoreNbDelegate_ == nullptr || kvStoreNbDelegate == nullptr) { - ZLOGI("RebuildKvStoreObserver illlegal."); - return Status::ILLEGAL_STATE; - } - std::lock_guard observerMapLockGuard(observerMapMutex_); - Status status = Status::SUCCESS; - DistributedDB::DBStatus dbStatus; - DistributedDB::Key emptyKey; - for (const auto &observerPair : observerMap_) { - dbStatus = kvStoreNbDelegate_->UnRegisterObserver(observerPair.second); - if (dbStatus != DistributedDB::OK) { - status = Status::DB_ERROR; - ZLOGW("rebuild observer failed during UnRegisterObserver, status %d.", static_cast(dbStatus)); - continue; - } - dbStatus = kvStoreNbDelegate->RegisterObserver(emptyKey, - static_cast(ConvertToDbObserverMode(observerPair.second->GetSubscribeType())), - observerPair.second); - if (dbStatus != DistributedDB::OK) { - status = Status::DB_ERROR; - ZLOGW("rebuild observer failed during RegisterObserver, status %d.", static_cast(dbStatus)); - continue; - } - } - return status; -} - -Status SingleKvStoreImpl::RebuildKvStoreResultSet() -{ - if (kvStoreNbDelegate_ == nullptr) { - return Status::INVALID_ARGUMENT; - } - ZLOGI("rebuild resultset"); - std::lock_guard lg(storeResultSetMutex_); - Status retStatus = Status::SUCCESS; - for (const auto &resultSetPair : storeResultSetMap_) { - Status status = (resultSetPair.second)->MigrateKvStore(kvStoreNbDelegate_); - if (status != Status::SUCCESS) { - retStatus = status; - ZLOGW("rebuild resultset failed, errCode %d", static_cast(status)); - continue; - } - } - return retStatus; -} - Status SingleKvStoreImpl::ReKey(const std::vector &key) { DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); diff --git a/services/distributeddataservice/app/src/single_kvstore_impl.h b/services/distributeddataservice/app/src/single_kvstore_impl.h index 279fc94486b17d7e9ae2314accb2fb1a5e38dac8..3763fac2a50ea59b4a7d6b250fa4d2153ef92d6e 100644 --- a/services/distributeddataservice/app/src/single_kvstore_impl.h +++ b/services/distributeddataservice/app/src/single_kvstore_impl.h @@ -61,9 +61,6 @@ public: Status ReKey(const std::vector &key); InnerStatus Close(DistributedDB::KvStoreDelegateManager *kvStoreDelegateManager); Status ForceClose(DistributedDB::KvStoreDelegateManager *kvStoreDelegateManager); - Status MigrateKvStore(const std::string &harmonyAccountId, const std::string &kvStoreDataDir, - DistributedDB::KvStoreDelegateManager *oldDelegateMgr, - DistributedDB::KvStoreDelegateManager *&newDelegateMgr); void IncreaseOpenCount(); Status PutBatch(const std::vector &entries) override; Status DeleteBatch(const std::vector &keys) override; @@ -100,8 +97,6 @@ private: uint64_t sequenceId); Status DoQuerySync(const std::vector &deviceIds, SyncMode mode, const std::string &query, const KvStoreSyncManager::SyncEnd &syncEnd, uint64_t sequenceId); - Status RebuildKvStoreObserver(DistributedDB::KvStoreNbDelegate *kvStoreNbDelegate); - Status RebuildKvStoreResultSet(); int ConvertToDbObserverMode(SubscribeType subscribeType) const; DistributedDB::SyncMode ConvertToDbSyncMode(SyncMode syncMode) const; Status DoSubscribe(const std::vector &deviceIds, @@ -120,8 +115,6 @@ private: // kvstore options. const Options options_; - // kvstore cipherKey. - const std::vector cipherKey_; // deviceAccount id get from service std::string deviceAccountId_; // appId get from PMS. @@ -136,7 +129,6 @@ private: // for top-app, 0 means synchronization immediately. for others, 0 means 1000ms. uint32_t defaultSyncDelayMs_{ 0 }; std::atomic_uint32_t waitingSyncCount_{ 0 }; - std::atomic_uint32_t waitingAutoSyncCount_{ 0 }; std::atomic_uint32_t syncRetries_{ 0 }; std::vector lastSyncDeviceIds_{ }; SyncMode lastSyncMode_{ SyncMode::PULL }; diff --git a/services/distributeddataservice/app/test/BUILD.gn b/services/distributeddataservice/app/test/BUILD.gn index fc20044f249dc3cc030e89055a285c6a5aaaae0f..614d071f6806d5c920c46fc2810f6e3e5907b61c 100644 --- a/services/distributeddataservice/app/test/BUILD.gn +++ b/services/distributeddataservice/app/test/BUILD.gn @@ -71,7 +71,6 @@ ohos_unittest("KvStoreImplLogicalIsolationTest") { "../src/kvstore_meta_manager.cpp", "../src/kvstore_observer_impl.cpp", "../src/kvstore_resultset_impl.cpp", - "../src/kvstore_snapshot_impl.cpp", "../src/kvstore_sync_manager.cpp", "../src/kvstore_user_manager.cpp", "../src/query_helper.cpp", @@ -136,7 +135,6 @@ ohos_unittest("KvStoreImplPhysicalIsolationTest") { "../src/kvstore_meta_manager.cpp", "../src/kvstore_observer_impl.cpp", "../src/kvstore_resultset_impl.cpp", - "../src/kvstore_snapshot_impl.cpp", "../src/kvstore_sync_manager.cpp", "../src/kvstore_user_manager.cpp", "../src/query_helper.cpp", @@ -201,7 +199,6 @@ ohos_unittest("KvStoreDataServiceTest") { "../src/kvstore_meta_manager.cpp", "../src/kvstore_observer_impl.cpp", "../src/kvstore_resultset_impl.cpp", - "../src/kvstore_snapshot_impl.cpp", "../src/kvstore_sync_manager.cpp", "../src/kvstore_user_manager.cpp", "../src/query_helper.cpp", @@ -267,7 +264,6 @@ ohos_unittest("KvStoreBackupTest") { "../src/kvstore_meta_manager.cpp", "../src/kvstore_observer_impl.cpp", "../src/kvstore_resultset_impl.cpp", - "../src/kvstore_snapshot_impl.cpp", "../src/kvstore_sync_manager.cpp", "../src/kvstore_user_manager.cpp", "../src/query_helper.cpp", @@ -369,7 +365,6 @@ ohos_unittest("KvStoreSyncManagerTest") { "../src/kvstore_meta_manager.cpp", "../src/kvstore_observer_impl.cpp", "../src/kvstore_resultset_impl.cpp", - "../src/kvstore_snapshot_impl.cpp", "../src/kvstore_sync_manager.cpp", "../src/kvstore_user_manager.cpp", "../src/query_helper.cpp", @@ -433,7 +428,6 @@ ohos_unittest("KvStoreUninstallerTest") { "../src/kvstore_meta_manager.cpp", "../src/kvstore_observer_impl.cpp", "../src/kvstore_resultset_impl.cpp", - "../src/kvstore_snapshot_impl.cpp", "../src/kvstore_sync_manager.cpp", "../src/kvstore_user_manager.cpp", "../src/query_helper.cpp", diff --git a/services/distributeddataservice/framework/metadata/meta_data_manager.cpp b/services/distributeddataservice/framework/metadata/meta_data_manager.cpp index a281c4ed6647b0579dcb87091ce40343f00cf3f0..a11a5fec98d524f4347610f9d91c251864bca6d9 100644 --- a/services/distributeddataservice/framework/metadata/meta_data_manager.cpp +++ b/services/distributeddataservice/framework/metadata/meta_data_manager.cpp @@ -17,7 +17,7 @@ #define LOG_TAG "MetaDataManager" #include "kv_store_nb_delegate.h" -#include "log/log_print.h" +#include "log_print.h" namespace OHOS::DistributedData { class MetaObserver : public DistributedDB::KvStoreObserver { diff --git a/services/distributeddataservice/service/directory/src/directory_manager.cpp b/services/distributeddataservice/service/directory/src/directory_manager.cpp index ca4dc5cc4d66a7a2744c2718e567eb02a1f06068..5fbde90a088a74dcc03674bd8cfb7faf36a37db8 100644 --- a/services/distributeddataservice/service/directory/src/directory_manager.cpp +++ b/services/distributeddataservice/service/directory/src/directory_manager.cpp @@ -21,7 +21,7 @@ #include #include "accesstoken_kit.h" -#include "log/log_print.h" +#include "log_print.h" #include "types.h" #include "unistd.h" namespace OHOS::DistributedData {