Skip to content

Commit

Permalink
Revert "Delia 65378"
Browse files Browse the repository at this point in the history
  • Loading branch information
npoltorapavlo authored Jun 18, 2024
1 parent fff5e53 commit ce9f068
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 37 deletions.
6 changes: 0 additions & 6 deletions PersistentStore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ cmake_minimum_required(VERSION 3.14)

set(PLUGIN_NAME PersistentStore)
find_package(WPEFramework)
if (NOT WPEFramework_FOUND)
find_package(Thunder)
if (Thunder_FOUND)
add_compile_definitions(WITH_THUNDER_NAMESPACE)
endif ()
endif ()
set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME})

set(CMAKE_CXX_STANDARD 11)
Expand Down
8 changes: 4 additions & 4 deletions PersistentStore/PersistentStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ namespace WPEFramework {

namespace {

#ifdef WITH_THUNDER_NAMESPACE
static Thunder::Plugin::Metadata<Plugin::PersistentStore> metadata(
#else
static Plugin::Metadata<Plugin::PersistentStore> metadata(
#endif
// Version (Major, Minor, Patch)
API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH,
// Preconditions
Expand Down Expand Up @@ -112,6 +108,9 @@ namespace Plugin {
_store = _service->Root<Exchange::IStore>(_connectionId, RPC::CommunicationTimeOut, _T("PersistentStoreImplementation"));
if (_store != nullptr) {
_store2 = _store->QueryInterface<Exchange::IStore2>();
if (_store2 != nullptr) {
_store2->Register(&_store2Sink);
}
_storeCache = _store->QueryInterface<Exchange::IStoreCache>();
_storeInspector = _store->QueryInterface<Exchange::IStoreInspector>();
_storeLimit = _store->QueryInterface<Exchange::IStoreLimit>();
Expand All @@ -137,6 +136,7 @@ namespace Plugin {

if (_store != nullptr) {
if (_store2 != nullptr) {
_store2->Unregister(&_store2Sink);
_store2->Release();
_store2 = nullptr;
}
Expand Down
34 changes: 34 additions & 0 deletions PersistentStore/PersistentStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,38 @@ namespace Plugin {
Core::JSON::DecUInt64 Limit;
};

class Store2Notification : public Exchange::IStore2::INotification {
private:
Store2Notification(const Store2Notification&) = delete;
Store2Notification& operator=(const Store2Notification&) = delete;

public:
explicit Store2Notification(PersistentStore& parent)
: _parent(parent)
{
}
~Store2Notification() override = default;

public:
void ValueChanged(const Exchange::IStore2::ScopeType scope, const string& ns, const string& key, const string& value) override
{
JsonData::PersistentStore::SetValueParamsData params;
params.Scope = JsonData::PersistentStore::ScopeType(scope);
params.Namespace = ns;
params.Key = key;
params.Value = value;

_parent.event_onValueChanged(params);
}

BEGIN_INTERFACE_MAP(Store2Notification)
INTERFACE_ENTRY(Exchange::IStore2::INotification)
END_INTERFACE_MAP

private:
PersistentStore& _parent;
};

class RemoteConnectionNotification : public RPC::IRemoteConnection::INotification {
private:
RemoteConnectionNotification() = delete;
Expand Down Expand Up @@ -110,6 +142,7 @@ namespace Plugin {
, _storeCache(nullptr)
, _storeInspector(nullptr)
, _storeLimit(nullptr)
, _store2Sink(*this)
, _notification(*this)
{
RegisterAll();
Expand Down Expand Up @@ -164,6 +197,7 @@ namespace Plugin {
Exchange::IStoreCache* _storeCache;
Exchange::IStoreInspector* _storeInspector;
Exchange::IStoreLimit* _storeLimit;
Core::Sink<Store2Notification> _store2Sink;
Core::Sink<RemoteConnectionNotification> _notification;
};

Expand Down
2 changes: 0 additions & 2 deletions PersistentStore/PersistentStoreJsonRpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ namespace Plugin {
params.Ttl.Value());
if (result == Core::ERROR_NONE) {
response.Success = true;

event_onValueChanged(params);
}

return result;
Expand Down
6 changes: 0 additions & 6 deletions PersistentStore/grpc/l0test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ FetchContent_MakeAvailable(googletest)
target_link_libraries(${PROJECT_NAME} PRIVATE gmock_main)

find_package(WPEFramework)
if (NOT WPEFramework_FOUND)
find_package(Thunder)
if (Thunder_FOUND)
add_compile_definitions(WITH_THUNDER_NAMESPACE)
endif ()
endif ()
find_package(${NAMESPACE}Plugins REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${NAMESPACE}Plugins::${NAMESPACE}Plugins)

Expand Down
6 changes: 0 additions & 6 deletions PersistentStore/l0test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ FetchContent_Declare(
FetchContent_MakeAvailable(googletest)

find_package(WPEFramework)
if (NOT WPEFramework_FOUND)
find_package(Thunder)
if (Thunder_FOUND)
add_compile_definitions(WITH_THUNDER_NAMESPACE)
endif ()
endif ()
find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)

Expand Down
6 changes: 0 additions & 6 deletions PersistentStore/l1test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ FetchContent_Declare(
FetchContent_MakeAvailable(googletest)

find_package(WPEFramework)
if (NOT WPEFramework_FOUND)
find_package(Thunder)
if (Thunder_FOUND)
add_compile_definitions(WITH_THUNDER_NAMESPACE)
endif ()
endif ()
find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)

Expand Down
8 changes: 1 addition & 7 deletions PersistentStore/sqlite/l1test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(googletest)

find_package(WPEFramework)
if (NOT WPEFramework_FOUND)
find_package(Thunder)
if (Thunder_FOUND)
add_compile_definitions(WITH_THUNDER_NAMESPACE)
endif ()
endif ()
find_package(WPEFramework REQUIRED)
find_package(${NAMESPACE}Plugins REQUIRED)

add_executable(${PROJECT_NAME}
Expand Down

0 comments on commit ce9f068

Please sign in to comment.