From bd3e9322eb36cc2e94e8011c12414900e8f1f187 Mon Sep 17 00:00:00 2001 From: xiefengzhu Date: Wed, 28 Jan 2026 15:49:07 +0800 Subject: [PATCH] fix Signed-off-by: xiefengzhu --- .../distributeddb/common/src/auto_launch.cpp | 4 ++ .../common/src/runtime_context_impl.cpp | 58 +++++++++++++++++++ .../common/src/runtime_context_impl.h | 3 +- .../communicator/include/combine_status.h | 2 + .../include/communicator_aggregator.h | 4 +- .../communicator/include/db_status_adapter.h | 2 + .../communicator/include/frame_combiner.h | 2 + .../communicator/include/frame_retainer.h | 2 + .../communicator/include/network_adapter.h | 2 + .../communicator/include/parse_result.h | 3 +- .../communicator/src/combine_status.cpp | 3 +- .../communicator/src/communicator.cpp | 2 + .../communicator/src/communicator.h | 2 + .../src/communicator_aggregator.cpp | 2 + .../communicator/src/communicator_linker.cpp | 2 + .../communicator/src/communicator_linker.h | 2 + .../communicator/src/db_status_adapter.cpp | 5 +- .../communicator/src/frame_combiner.cpp | 2 + .../communicator/src/frame_retainer.cpp | 2 + .../communicator/src/message_transform.cpp | 6 +- .../communicator/src/network_adapter.cpp | 2 + .../communicator/src/protocol_proto.cpp | 2 + .../communicator/src/protocol_proto.h | 2 + .../communicator/src/send_task_scheduler.cpp | 2 +- .../common/communicator/adapter_stub.cpp | 7 ++- .../common/communicator/adapter_stub.h | 3 +- .../distributeddb_communicator_common.cpp | 4 +- .../distributeddb_communicator_common.h | 4 +- .../distributeddb_communicator_deep_test.cpp | 4 +- ...buteddb_communicator_send_receive_test.cpp | 4 +- ...eddb_interfaces_import_and_export_test.cpp | 7 ++- ...nterfaces_nb_delegate_local_batch_test.cpp | 2 + ...tributeddb_interfaces_nb_delegate_test.cpp | 2 + ...distributeddb_relational_get_data_test.cpp | 2 + .../distributeddb_ability_sync_test.cpp | 4 ++ .../distributeddb_anti_dos_sync_test.cpp | 4 +- .../distributeddb_mock_sync_module_test.cpp | 3 + .../common/syncer/virtual_communicator.cpp | 4 ++ 38 files changed, 153 insertions(+), 19 deletions(-) diff --git a/frameworks/libs/distributeddb/common/src/auto_launch.cpp b/frameworks/libs/distributeddb/common/src/auto_launch.cpp index dad896e557..9447d5b42e 100644 --- a/frameworks/libs/distributeddb/common/src/auto_launch.cpp +++ b/frameworks/libs/distributeddb/common/src/auto_launch.cpp @@ -162,6 +162,7 @@ int AutoLaunch::EnableKvStoreAutoLaunchParmCheck(AutoLaunchItem &autoLaunchItem, int AutoLaunch::EnableKvStoreAutoLaunch(const KvDBProperties &properties, AutoLaunchNotifier notifier, const AutoLaunchOption &option) { +#ifdef USE_DISTRIBUTEDDB_DEVICE LOGI("[AutoLaunch] EnableKvStoreAutoLaunch"); bool isDualTupleMode = properties.GetBoolProp(KvDBProperties::SYNC_DUAL_TUPLE_MODE, false); std::string dualTupleIdentifier = properties.GetStringProp(KvDBProperties::DUAL_TUPLE_IDENTIFIER_DATA, ""); @@ -190,6 +191,9 @@ int AutoLaunch::EnableKvStoreAutoLaunch(const KvDBProperties &properties, AutoLa LOGE("[AutoLaunch] EnableKvStoreAutoLaunch failed errCode:%d", errCode); } return errCode; +#else + return E_OK; +#endif } void AutoLaunch::GetKVConnectionInEnableInner(const AutoLaunchItem &autoLaunchItem, const std::string &identifier, diff --git a/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp b/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp index 2dbd8767c0..ca334b1aba 100644 --- a/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp +++ b/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp @@ -25,6 +25,7 @@ #include "thread_pool_stub.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE RuntimeContextImpl::RuntimeContextImpl() : adapter_(nullptr), communicatorAggregator_(nullptr), @@ -40,6 +41,21 @@ RuntimeContextImpl::RuntimeContextImpl() isBatchDownloadAssets_(true) { } +#else +RuntimeContextImpl::RuntimeContextImpl() + : mainLoop_(nullptr), + currentTimerId_(0), + taskPoolReportsTimerId_(0), + timeTickMonitor_(nullptr), + systemApiAdapter_(nullptr), + lockStatusObserver_(nullptr), + currentSessionId_(1), + dbStatusAdapter_(nullptr), + subscribeRecorder_(nullptr), + isBatchDownloadAssets_(true) +{ +} +#endif // Destruct the object. RuntimeContextImpl::~RuntimeContextImpl() @@ -80,6 +96,7 @@ std::string RuntimeContextImpl::GetProcessLabel() const int RuntimeContextImpl::SetCommunicatorAdapter(IAdapter *adapter) { +#ifdef USE_DISTRIBUTEDDB_DEVICE { std::lock_guard autoLock(communicatorLock_); if (adapter_ != nullptr) { @@ -94,10 +111,14 @@ int RuntimeContextImpl::SetCommunicatorAdapter(IAdapter *adapter) GetCommunicatorAggregator(communicatorAggregator); autoLaunch_.SetCommunicatorAggregator(communicatorAggregator); return E_OK; +#else + return E_OK; +#endif } int RuntimeContextImpl::GetCommunicatorAggregator(ICommunicatorAggregator *&outAggregator) { +#ifdef USE_DISTRIBUTEDDB_DEVICE outAggregator = nullptr; const std::shared_ptr statusAdapter = GetDBStatusAdapter(); if (statusAdapter == nullptr) { @@ -128,10 +149,14 @@ int RuntimeContextImpl::GetCommunicatorAggregator(ICommunicatorAggregator *&outA } outAggregator = communicatorAggregator_; return errCode; +#else + return E_OK; +#endif } void RuntimeContextImpl::SetCommunicatorAggregator(ICommunicatorAggregator *inAggregator) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ != nullptr) { autoLaunch_.SetCommunicatorAggregator(nullptr); @@ -140,16 +165,21 @@ void RuntimeContextImpl::SetCommunicatorAggregator(ICommunicatorAggregator *inAg } communicatorAggregator_ = inAggregator; autoLaunch_.SetCommunicatorAggregator(communicatorAggregator_); +#endif } int RuntimeContextImpl::GetLocalIdentity(std::string &outTarget) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ != nullptr) { return communicatorAggregator_->GetLocalIdentity(outTarget); } LOGW("[RuntimeContextImpl] Get local id without communicatorAggregator"); return -E_NOT_INIT; +#else + return E_OK; +#endif } // Add and start a timer. @@ -615,11 +645,15 @@ void RuntimeContextImpl::NotifyTimestampChanged(TimeOffset offset) const bool RuntimeContextImpl::IsCommunicatorAggregatorValid() const { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ == nullptr && adapter_ == nullptr) { return false; } return true; +#else + return false; +#endif } void RuntimeContextImpl::SetStoreStatusNotifier(const StoreStatusNotifier ¬ifier) @@ -785,6 +819,7 @@ void RuntimeContextImpl::StopTimeTickMonitorIfNeed() void RuntimeContextImpl::SetDBInfoHandle(const std::shared_ptr &handle) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr) { dbStatusAdapter->SetDBInfoHandle(handle); @@ -793,14 +828,17 @@ void RuntimeContextImpl::SetDBInfoHandle(const std::shared_ptr &ha if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveAllSubscribe(); } +#endif } void RuntimeContextImpl::NotifyDBInfos(const DeviceInfos &devInfos, const std::vector &dbInfos) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr) { dbStatusAdapter->NotifyDBInfos(devInfos, dbInfos); } +#endif } std::shared_ptr RuntimeContextImpl::GetDBStatusAdapter() @@ -818,6 +856,7 @@ std::shared_ptr RuntimeContextImpl::GetDBStatusAdapter() void RuntimeContextImpl::RecordRemoteSubscribe(const DBInfo &dbInfo, const DeviceID &deviceId, const QuerySyncObject &query) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -826,10 +865,12 @@ void RuntimeContextImpl::RecordRemoteSubscribe(const DBInfo &dbInfo, const Devic if (subscribeRecorder != nullptr) { subscribeRecorder->RecordSubscribe(dbInfo, deviceId, query); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DeviceID &deviceId) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -838,10 +879,12 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DeviceID &deviceId) if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(deviceId); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -850,10 +893,12 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo) if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(dbInfo); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const DeviceID &deviceId) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -862,11 +907,13 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const Devic if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(dbInfo, deviceId); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const DeviceID &deviceId, const QuerySyncObject &query) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -875,11 +922,13 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const Devic if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(dbInfo, deviceId, query); } +#endif } void RuntimeContextImpl::GetSubscribeQuery(const DBInfo &dbInfo, std::map> &subscribeQuery) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -888,6 +937,7 @@ void RuntimeContextImpl::GetSubscribeQuery(const DBInfo &dbInfo, if (subscribeRecorder != nullptr) { subscribeRecorder->GetSubscribeQuery(dbInfo, subscribeQuery); } +#endif } std::shared_ptr RuntimeContextImpl::GetSubscribeRecorder() @@ -905,20 +955,26 @@ std::shared_ptr RuntimeContextImpl::GetSubscribeRecorder() bool RuntimeContextImpl::IsNeedAutoSync(const std::string &userId, const std::string &appId, const std::string &storeId, const std::string &devInfo) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter == nullptr) { return true; } return dbStatusAdapter->IsNeedAutoSync(userId, appId, storeId, devInfo); +#else + return false; +#endif } void RuntimeContextImpl::SetRemoteOptimizeCommunication(const std::string &dev, bool optimize) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter == nullptr) { return; } dbStatusAdapter->SetRemoteOptimizeCommunication(dev, optimize); +#endif } void RuntimeContextImpl::SetTranslateToDeviceIdCallback(const TranslateToDeviceIdCallback &callback) @@ -1225,11 +1281,13 @@ std::shared_ptr RuntimeContextImpl::GetAssetsDownloadMana void RuntimeContextImpl::ClearOnlineLabel() { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ == nullptr) { LOGE("[Runtime] clear online label with null aggregator"); return; } communicatorAggregator_->ClearOnlineLabel(); +#endif } } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/common/src/runtime_context_impl.h b/frameworks/libs/distributeddb/common/src/runtime_context_impl.h index cdcbdfd3b4..01b636d10f 100644 --- a/frameworks/libs/distributeddb/common/src/runtime_context_impl.h +++ b/frameworks/libs/distributeddb/common/src/runtime_context_impl.h @@ -215,11 +215,12 @@ private: // Context fields mutable std::mutex labelMutex_; std::string processLabel_; - +#ifdef USE_DISTRIBUTEDDB_DEVICE // Communicator mutable std::mutex communicatorLock_; IAdapter *adapter_; ICommunicatorAggregator *communicatorAggregator_; +#endif // Loop and timer mutable std::mutex loopLock_; diff --git a/frameworks/libs/distributeddb/communicator/include/combine_status.h b/frameworks/libs/distributeddb/communicator/include/combine_status.h index 1f602e88c9..01f9fc67c3 100644 --- a/frameworks/libs/distributeddb/communicator/include/combine_status.h +++ b/frameworks/libs/distributeddb/communicator/include/combine_status.h @@ -28,6 +28,7 @@ class CombineStatus { public: CombineStatus() = default; ~CombineStatus() = default; +#ifdef USE_DISTRIBUTEDDB_DEVICE void UpdateProgressId(uint64_t inProgressId); uint64_t GetProgressId() const; bool CheckProgress(); @@ -51,6 +52,7 @@ private: uint16_t fragmentCount_ = 0; std::set combinedFragmentNo_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h b/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h index d685b8b5a3..3f122e0b16 100644 --- a/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h +++ b/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h @@ -49,6 +49,7 @@ struct TaskConfig { * Upper layer Module should comply with calling convention, Inner Module interface will not do excessive check */ class CommunicatorAggregator : public ICommunicatorAggregator { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: CommunicatorAggregator(); ~CommunicatorAggregator() override; @@ -197,7 +198,7 @@ private: SendTaskScheduler scheduler_; IAdapter *adapterHandle_ = nullptr; CommunicatorLinker *commLinker_ = nullptr; - + // Thread related std::thread exclusiveThread_; bool wakingSignal_ = false; @@ -238,6 +239,7 @@ private: std::mutex sendSequenceMutex_; std::map sendSequence_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h b/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h index 35b5cc3fe1..7dcce2987f 100644 --- a/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h +++ b/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h @@ -25,6 +25,7 @@ using RemoteDBChangeCallback = std::function; using RemoteSupportChangeCallback = std::function; class DBStatusAdapter { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: DBStatusAdapter(); ~DBStatusAdapter() = default; @@ -68,6 +69,7 @@ private: bool localSendLabelExchange_; bool cacheLocalSendLabelExchange_; std::map remoteOptimizeInfo_; // key: device uuid, value: is support notified by user +#endif }; } #endif // DB_STATUS_ADAPTER_H diff --git a/frameworks/libs/distributeddb/communicator/include/frame_combiner.h b/frameworks/libs/distributeddb/communicator/include/frame_combiner.h index d1ec81f826..e4d50e0f2a 100644 --- a/frameworks/libs/distributeddb/communicator/include/frame_combiner.h +++ b/frameworks/libs/distributeddb/communicator/include/frame_combiner.h @@ -38,6 +38,7 @@ class FrameCombiner { public: FrameCombiner() = default; // Default constructor must be explicitly provided due to DISABLE_COPY_ASSIGN_MOVE ~FrameCombiner() = default; // Since constructor must be provided, codedex demand deconstructor be provided as well +#ifdef USE_DISTRIBUTEDDB_DEVICE DISABLE_COPY_ASSIGN_MOVE(FrameCombiner); // Start the timer to supervise the progress @@ -73,6 +74,7 @@ private: uint64_t incProgressId_ = 0; uint64_t totalSizeByByte_ = 0; std::map> combineWorkPool_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/frame_retainer.h b/frameworks/libs/distributeddb/communicator/include/frame_retainer.h index 7e2c5f17f5..c8a6cc6fda 100644 --- a/frameworks/libs/distributeddb/communicator/include/frame_retainer.h +++ b/frameworks/libs/distributeddb/communicator/include/frame_retainer.h @@ -47,6 +47,7 @@ class FrameRetainer { public: FrameRetainer() = default; // Default constructor must be explicitly provided due to DISABLE_COPY_ASSIGN_MOVE ~FrameRetainer() = default; // Since constructor must be provided, codedex demand deconstructor be provided as well +#ifdef USE_DISTRIBUTEDDB_DEVICE DISABLE_COPY_ASSIGN_MOVE(FrameRetainer); // Start the timer to clear up overtime frames @@ -82,6 +83,7 @@ private: uint64_t incRetainOrder_ = 0; std::map>> retainWorkPool_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/network_adapter.h b/frameworks/libs/distributeddb/communicator/include/network_adapter.h index fc1c390ab9..b30bc0995f 100644 --- a/frameworks/libs/distributeddb/communicator/include/network_adapter.h +++ b/frameworks/libs/distributeddb/communicator/include/network_adapter.h @@ -27,6 +27,7 @@ namespace DistributedDB { class NetworkAdapter : public IAdapter { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: NetworkAdapter(); explicit NetworkAdapter(const std::string &inProcessLabel); @@ -93,6 +94,7 @@ private: mutable std::mutex onReceiveMutex_; mutable std::mutex onChangeMutex_; mutable std::mutex onSendableMutex_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/parse_result.h b/frameworks/libs/distributeddb/communicator/include/parse_result.h index 9cf5cdb734..1b24a19617 100644 --- a/frameworks/libs/distributeddb/communicator/include/parse_result.h +++ b/frameworks/libs/distributeddb/communicator/include/parse_result.h @@ -25,7 +25,7 @@ class ParseResult { public: ParseResult() = default; ~ParseResult() = default; - +#ifdef USE_DISTRIBUTEDDB_DEVICE void SetFrameId(uint32_t inFrameId) { frameId_ = inFrameId; @@ -181,6 +181,7 @@ private: uint64_t labelExchangeSequenceId_ = 0; // For Both LabelExchange And LabelExchangeAck Frame std::set latestCommLabels_; // For Only LabelExchange Frame uint16_t dbVersion_ = 0; +#endif }; } diff --git a/frameworks/libs/distributeddb/communicator/src/combine_status.cpp b/frameworks/libs/distributeddb/communicator/src/combine_status.cpp index 8157e0953c..034ae39211 100644 --- a/frameworks/libs/distributeddb/communicator/src/combine_status.cpp +++ b/frameworks/libs/distributeddb/communicator/src/combine_status.cpp @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "combine_status.h" namespace DistributedDB { @@ -79,3 +79,4 @@ bool CombineStatus::IsCombineDone() const return (combinedFragmentNo_.size() >= fragmentCount_); } } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/communicator.cpp b/frameworks/libs/distributeddb/communicator/src/communicator.cpp index 1011ae1522..f6a87cf38e 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator.cpp +++ b/frameworks/libs/distributeddb/communicator/src/communicator.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "communicator.h" #include "db_common.h" #include "log_print.h" @@ -303,3 +304,4 @@ bool Communicator::ExchangeClosePending(bool expected) } DEFINE_OBJECT_TAG_FACILITIES(Communicator) } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/communicator.h b/frameworks/libs/distributeddb/communicator/src/communicator.h index 80c3f0e66b..244088eeed 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator.h +++ b/frameworks/libs/distributeddb/communicator/src/communicator.h @@ -29,6 +29,7 @@ namespace DistributedDB { class Communicator : public ICommunicator { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: Communicator(CommunicatorAggregator *inCommAggregator, const LabelType &inLabel); ~Communicator() override; @@ -92,6 +93,7 @@ private: std::mutex messageHandleMutex_; std::mutex connectHandleMutex_; std::mutex sendableHandleMutex_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp b/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp index 1b5cf4e067..5e2ef227ea 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp +++ b/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp @@ -25,6 +25,7 @@ #include "protocol_proto.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE namespace { constexpr int RETRY_TIME_SPLIT = 4; inline std::string GetThreadId() @@ -1237,4 +1238,5 @@ int32_t CommunicatorAggregator::GetRetryCount(const std::string &dev, bool isRet return scheduler_.GetRetryCount(dev, isRetryTask); } DEFINE_OBJECT_TAG_FACILITIES(CommunicatorAggregator) +#endif } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp b/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp index 83513365b5..a765d49646 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp +++ b/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "communicator_linker.h" #include @@ -507,3 +508,4 @@ void CommunicatorLinker::ClearOnlineLabel() } DEFINE_OBJECT_TAG_FACILITIES(CommunicatorLinker) } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/communicator_linker.h b/frameworks/libs/distributeddb/communicator/src/communicator_linker.h index f02630ac6e..ee518bef27 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator_linker.h +++ b/frameworks/libs/distributeddb/communicator/src/communicator_linker.h @@ -33,6 +33,7 @@ namespace DistributedDB { class CommunicatorAggregator; // Forward Declaration class CommunicatorLinker : public virtual RefObject { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: explicit CommunicatorLinker(CommunicatorAggregator *inAggregator, std::shared_ptr statusAdapter); @@ -126,6 +127,7 @@ private: std::map> targetMapOnlineLabels_; std::shared_ptr statusAdapter_; +#endif }; } diff --git a/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp b/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp index 79c076683a..4ace320443 100644 --- a/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp +++ b/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "db_status_adapter.h" #include "db_common.h" @@ -341,4 +343,5 @@ bool DBStatusAdapter::IsLocalDeviceId(const std::string &deviceId) } return deviceId == localId; } -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp b/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp index 5fafb9e88d..a51c20f105 100644 --- a/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp +++ b/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp @@ -19,6 +19,7 @@ #include "protocol_proto.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE static const uint32_t MAX_WORK_PER_SRC_TARGET = 1; // Only allow 1 CombineWork for each target static const int COMBINER_SURVAIL_PERIOD_IN_MILLISECOND = 10000; // Period is 10 s @@ -253,4 +254,5 @@ SerialBuffer *FrameCombiner::CreateNewFrameBuffer(const ParseResult &inInfo) } return buffer; } +#endif } // namespace DistributedDB \ No newline at end of file diff --git a/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp b/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp index 4c81e86181..238c8533a6 100644 --- a/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp +++ b/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp @@ -19,6 +19,7 @@ #include "serial_buffer.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE namespace { const uint32_t MAX_RETAIN_CAPACITY = 67108864; // 64 M bytes const uint32_t MAX_RETAIN_PERIOD_COUNT = 2; // One period is RETAIN_SURVAIL_PERIOD_IN_MILLISECOND. @@ -252,4 +253,5 @@ void FrameRetainer::ShrinkRetainWorkPool() retainWorkPool_.erase(entry); } } +#endif } // namespace DistributedDB \ No newline at end of file diff --git a/frameworks/libs/distributeddb/communicator/src/message_transform.cpp b/frameworks/libs/distributeddb/communicator/src/message_transform.cpp index dfcfc5162e..30dbbef161 100644 --- a/frameworks/libs/distributeddb/communicator/src/message_transform.cpp +++ b/frameworks/libs/distributeddb/communicator/src/message_transform.cpp @@ -19,6 +19,10 @@ namespace DistributedDB { int MessageTransform::RegTransformFunction(uint32_t msgId, const TransformFunc &inFunc) { +#ifdef USE_DISTRIBUTEDDB_DEVICE return ProtocolProto::RegTransformFunction(msgId, inFunc); +#else + return 0; +#endif } -} // namespace DistributedDB \ No newline at end of file +} // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp b/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp index 6a4ac21b84..2d3fef958e 100644 --- a/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp +++ b/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "network_adapter.h" #include "db_constant.h" #include "db_common.h" @@ -450,3 +451,4 @@ std::shared_ptr NetworkAdapter::GetExtendHeaderHandle(const return processCommunicator_->GetExtendHeaderHandle(paramInfo); } } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp b/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp index 8234aa2d7e..7ded2363b3 100644 --- a/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp +++ b/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "protocol_proto.h" #include #include @@ -1123,3 +1124,4 @@ int ProtocolProto::GetTransformFunc(uint32_t messageId, DistributedDB::Transform return E_OK; } } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/protocol_proto.h b/frameworks/libs/distributeddb/communicator/src/protocol_proto.h index 34c0210718..e512f1ad6a 100644 --- a/frameworks/libs/distributeddb/communicator/src/protocol_proto.h +++ b/frameworks/libs/distributeddb/communicator/src/protocol_proto.h @@ -47,6 +47,7 @@ struct FragmentPacket { uint32_t leftLength = 0u; }; +#ifdef USE_DISTRIBUTEDDB_DEVICE class ProtocolProto { public: // For application layer frame @@ -137,6 +138,7 @@ private: static std::shared_mutex msgIdMutex_; static std::map msgIdMapFunc_; }; +#endif } // namespace DistributedDB #endif // PROTOCOLPROTO_H diff --git a/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp b/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp index edbee34414..a46f4bff87 100644 --- a/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp +++ b/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp @@ -405,4 +405,4 @@ void SendTaskScheduler::IncreaseRetryCountIfNeed(const std::string &dev, bool is std::lock_guard autoLock(overallMutex_); retryCount_[dev][isRetryTask]++; } -} \ No newline at end of file +} diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp index f0276b8ae5..d7b44b7570 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp @@ -24,10 +24,12 @@ using namespace DistributedDB; +#ifdef USE_DISTRIBUTEDDB_DEVICE namespace { const uint32_t STUB_MTU_SIZE = 5 * 1024 * 1024; // 5 M, 1024 is scale const uint32_t STUB_TIME_OUT = 5 * 1000; // 5 S, 1000 is scale } +#endif /* * Override Part @@ -36,7 +38,7 @@ AdapterStub::~AdapterStub() { // Do nothing } - +#ifdef USE_DISTRIBUTEDDB_DEVICE int AdapterStub::StartAdapter() { return E_OK; @@ -476,4 +478,5 @@ std::vector AdapterStub::GetUserInfo() void AdapterStub::SetProcessCommunicator(std::shared_ptr processCommunicator) { processCommunicator_ = std::move(processCommunicator); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h index 638c2599eb..e0d0cdd6c6 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h @@ -33,7 +33,7 @@ public: * Override Part */ ~AdapterStub() override; - +#ifdef USE_DISTRIBUTEDDB_DEVICE int StartAdapter() override; void StopAdapter() override; uint32_t GetMtuSize() override; @@ -149,6 +149,7 @@ private: std::vector userInfo_; std::shared_ptr processCommunicator_ = nullptr; +#endif }; } diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp index cf2bb2e045..9c4c00d3c3 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "distributeddb_communicator_common.h" #include #include "db_errno.h" @@ -348,4 +349,5 @@ bool RegedGiantObject::CheckEqual(const RegedGiantObject &inLeft, const RegedGia index++; } return true; -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h index dbf2a0641b..4c56f4d1f9 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h @@ -37,7 +37,7 @@ struct OnOfflineDevice { std::string latestOnlineDevice; std::string latestOfflineDevice; }; - +#ifdef USE_DISTRIBUTEDDB_DEVICE bool SetUpEnv(EnvHandle &inEnv, const std::string &inName, const std::shared_ptr &adapter); bool SetUpEnv(EnvHandle &inEnv, const std::string &inName); @@ -150,5 +150,5 @@ DistributedDB::Message *BuildUnRegedTinyMessage(); ASSERT_NE(communicator, nullptr); \ (communicator)->Activate(userId); \ } - +#endif #endif // DISTRIBUTEDDB_COMMUNICATOR_COMMON_H \ No newline at end of file diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp index 74b5922e4a..0065532468 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include #include #include @@ -1611,4 +1612,5 @@ HWTEST_F(DistributedDBCommunicatorDeepTest, SendFailed002, TestSize.Level0) adapterStub->ForkSendBytes(nullptr); EXPECT_EQ(aggregator->GetRetryCount(DEVICE_NAME_B, true), 0); EXPECT_EQ(aggregator->GetRetryCount(DEVICE_NAME_B, false), 0); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp index a02bc2f7fb..cde1d7754c 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include #include #include "db_errno.h" @@ -919,4 +920,5 @@ HWTEST_F(DistributedDBCommunicatorSendReceiveTest, ToMessageTest001, TestSize.Le Message* msg = ProtocolProto::ToMessage(nullptr, errorNo, false); EXPECT_EQ(errorNo, -E_INVALID_ARGS); EXPECT_EQ(msg, nullptr); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp index 7347837fd3..4a35c78286 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifdef USE_DISTRIBUTEDDB_DEVICE #ifndef OMIT_ENCRYPT #include #include @@ -92,10 +94,8 @@ public: void DistributedDBInterfacesImportAndExportTest::SetUpTestCase(void) { -#ifdef USE_DISTRIBUTEDDB_DEVICE g_mgr.SetProcessLabel("6666", "8888"); g_mgr.SetProcessCommunicator(std::make_shared()); -#endif DistributedDBToolsUnitTest::TestDirInit(g_testDir); g_config.dataDir = g_testDir; g_mgr.SetKvStoreConfig(g_config); @@ -1482,4 +1482,5 @@ HWTEST_F(DistributedDBInterfacesImportAndExportTest, CheckSecurityLabel002, Test RuntimeContext::GetInstance()->SetProcessSystemApiAdapter(nullptr); g_junkFilesList.push_back(singleFileName); } -#endif // OMIT_ENCRYPT \ No newline at end of file +#endif // OMIT_ENCRYPT +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp index 1c22712414..4aa76968c0 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp @@ -485,6 +485,7 @@ HWTEST_F(DistributedDBInterfacesNBDelegateLocalBatchTest, SingleVerPutLocalBatch } #ifndef LOW_LEVEL_MEM_DEV +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: SingleVerPutLocalBatch005 * @tc.desc: Check for legal parameters that the sum size of all entries is smaller than 512M. @@ -578,6 +579,7 @@ HWTEST_F(DistributedDBInterfacesNBDelegateLocalBatchTest, SingleVerPutLocalBatch EXPECT_EQ(g_mgr.DeleteKvStore("SingleVerPutLocalBatch006"), OK); g_kvNbDelegatePtr = nullptr; } +#endif /** * @tc.name: SingleVerPutLocalBatch007 diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp index 7d684f3ddb..15c91426b1 100755 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp @@ -1176,6 +1176,7 @@ static void CreatEntrys(int recordSize, vector &keys, vector &values } #ifndef LOW_LEVEL_MEM_DEV +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: SingleVerPutBatch005 * @tc.desc: Check for legal parameters that the sum size of all entries is smaller than 512M. @@ -1269,6 +1270,7 @@ HWTEST_F(DistributedDBInterfacesNBDelegateTest, SingleVerPutBatch006, TestSize.L EXPECT_EQ(g_mgr.DeleteKvStore("distributed_SingleVerPutBatch_006"), OK); g_kvNbDelegatePtr = nullptr; } +#endif /** * @tc.name: SingleVerPutBatch007 diff --git a/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp index 99382c9501..af530798b8 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp @@ -1778,6 +1778,7 @@ HWTEST_F(DistributedDBRelationalGetDataTest, StopSync001, TestSize.Level1) userChangeThread.join(); } +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: EraseDeviceWaterMark001 * @tc.desc: Test Relational erase water mark. @@ -1791,6 +1792,7 @@ HWTEST_F(DistributedDBRelationalGetDataTest, EraseDeviceWaterMark001, TestSize.L ASSERT_NE(syncAbleEngine, nullptr); EXPECT_EQ(syncAbleEngine->EraseDeviceWaterMark("", true), -E_INVALID_ARGS); } +#endif /** * @tc.name: AbnormalSyncerProxyTest001 diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp index 15b8b5d133..b97447a4fd 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp @@ -382,6 +382,7 @@ HWTEST_F(DistributedDBAbilitySyncTest, AckPacketTest001, TestSize.Level0) ASSERT_TRUE(schema == TEST_SCHEMA); } +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: SyncStartTest001 * @tc.desc: Verify Ability sync SyncStart function. @@ -414,6 +415,7 @@ HWTEST_F(DistributedDBAbilitySyncTest, SyncStart001, TestSize.Level0) */ EXPECT_TRUE(async.SyncStart(1, 1, 1) == -E_PERIPHERAL_INTERFACE_FAIL); } + #ifndef OMIT_JSON /** * @tc.name: RequestReceiveTest001 @@ -485,6 +487,8 @@ HWTEST_F(DistributedDBAbilitySyncTest, RequestReceiveTest001, TestSize.Level0) RefObject::KillAndDecObjRef(context); } #endif +#endif + /** * @tc.name: AckReceiveTest001 * @tc.desc: Verify Ability AckReceive callback. diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp index 97a459c93c..84e5741fd8 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp @@ -153,6 +153,7 @@ void DistributeddbAntiDosSyncTest::TearDown(void) g_mgr.DeleteKvStore(ANTI_DOS_STORE_ID); } +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: Anti Dos attack Sync 001 * @tc.desc: Whether function run normally when the amount of message is lower than the maximum of threads @@ -318,4 +319,5 @@ HWTEST_F(DistributeddbAntiDosSyncTest, AntiDosAttackSync003, TestSize.Level3) EXPECT_TRUE(g_syncEngine->GetDiscardMsgNum() > 0); EXPECT_TRUE(g_syncEngine->GetQueueCacheSize() > 0); g_communicatorAggregator->SetBlockValue(false); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp index 076a228753..2a7ed22968 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifdef USE_DISTRIBUTEDDB_DEVICE #include #include #ifdef RUN_AS_ROOT @@ -2735,3 +2737,4 @@ HWTEST_F(DistributedDBMockSyncModuleTest, IsNeedRetrySyncTest, TestSize.Level0) RefObject::KillAndDecObjRef(context); } } +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp index 66d749d06c..2c41edee19 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp @@ -216,6 +216,7 @@ VirtualCommunicator::VirtualCommunicator(const std::string &deviceId, int VirtualCommunicator::TranslateMsg(const Message *inMsg, Message *&outMsg) { +#ifdef USE_DISTRIBUTEDDB_DEVICE int errCode = E_OK; std::shared_ptr extendHandle = nullptr; auto buffer = ProtocolProto::ToSerialBuffer(inMsg, extendHandle, false, errCode); @@ -227,6 +228,9 @@ int VirtualCommunicator::TranslateMsg(const Message *inMsg, Message *&outMsg) delete buffer; buffer = nullptr; return errCode; +#else + return E_OK; +#endif } void VirtualCommunicator::SetDropMessageTypeByDevice(MessageId msgid, uint32_t dropTimes) -- Gitee