Skip to content

Commit

Permalink
Revert "Merge pull request #5046 from npoltorapavlo/RDK-47994-main"
Browse files Browse the repository at this point in the history
This reverts commit 71fff19, reversing
changes made to 89adee1.
  • Loading branch information
anand-ky committed Apr 2, 2024
1 parent 4709fab commit 28ac17a
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 1,355 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/L0-PersistentStore-grpc.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/L2-PersistentStore-grpc.yml

This file was deleted.

6 changes: 0 additions & 6 deletions PersistentStore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ All notable changes to this RDK Service will be documented in this file.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.

## [1.0.8] - 2024-03-21
### Added
- Account scope implementation
- L0, L2 unit tests
- Out-of-process

## [1.0.7] - 2024-03-18
### Fixed
- PersistentStore.json is not generated in R2 build due to write_config() empty parameter & its fixed for R2 builds
Expand Down
62 changes: 9 additions & 53 deletions PersistentStore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,91 +23,47 @@ set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME})

set(CMAKE_CXX_STANDARD 11)

set(PLUGIN_PERSISTENTSTORE_MODE "Local" CACHE STRING "Controls if the plugin should run in its own process, in process or remote")
set(PLUGIN_PERSISTENTSTORE_MODE "Off" CACHE STRING "Controls if the plugin should run in its own process, in process or remote")
set(PLUGIN_PERSISTENTSTORE_URI "ss.eu.prod.developer.comcast.com:443" CACHE STRING "Account scope endpoint")
set(PLUGIN_PERSISTENTSTORE_PATH "/opt/secure/persistent/rdkservicestore" CACHE STRING "Path")
set(PLUGIN_PERSISTENTSTORE_LEGACYPATH "/opt/persistent/rdkservicestore" CACHE STRING "Previously used path")
set(PLUGIN_PERSISTENTSTORE_KEY "" CACHE STRING "Encryption key")
set(PLUGIN_PERSISTENTSTORE_MAXSIZE "1000000" CACHE STRING "For all text data, in bytes")
set(PLUGIN_PERSISTENTSTORE_MAXVALUE "3000" CACHE STRING "For single text data, in bytes")
set(PLUGIN_PERSISTENTSTORE_LIMIT "10000" CACHE STRING "Default for all text data in namespace, in bytes")
set(PLUGIN_PERSISTENTSTORE_TOKEN_COMMAND "" CACHE STRING "Shell command to get the service access token")
set(PLUGIN_PERSISTENTSTORE_STARTUPORDER "" CACHE STRING "To configure startup order of PersistentStore plugin")

add_library(${MODULE_NAME} SHARED
PersistentStore.cpp
PersistentStoreJsonRpc.cpp
Module.cpp
)

find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)
target_link_libraries(${MODULE_NAME} PRIVATE
${NAMESPACE}Plugins::${NAMESPACE}Plugins
${NAMESPACE}Definitions::${NAMESPACE}Definitions
)

find_library(RFC_LIBRARIES NAMES rfcapi)
if (RFC_LIBRARIES)
find_path(RFC_INCLUDE_DIRS NAMES rfcapi.h REQUIRED)
target_include_directories(${MODULE_NAME} PRIVATE ${RFC_INCLUDE_DIRS})
target_link_libraries(${MODULE_NAME} PRIVATE ${RFC_LIBRARIES})
target_compile_definitions(${MODULE_NAME} PRIVATE WITH_RFC)
endif ()

install(TARGETS ${MODULE_NAME}
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)

set(PLUGIN_IMPLEMENTATION ${MODULE_NAME}Implementation)
add_library(${PLUGIN_IMPLEMENTATION} SHARED
sqlite/Store2.cpp
sqlite/StoreCache.cpp
sqlite/StoreInspector.cpp
sqlite/StoreLimit.cpp
grpc/Store2.cpp
Module.cpp
)

target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE
find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)
target_link_libraries(${MODULE_NAME} PRIVATE
${NAMESPACE}Plugins::${NAMESPACE}Plugins
${NAMESPACE}Definitions::${NAMESPACE}Definitions
)

find_package(PkgConfig REQUIRED)
pkg_search_module(SQLITE REQUIRED sqlite3)
target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE ${SQLITE_LIBRARIES})
target_link_libraries(${MODULE_NAME} PRIVATE ${SQLITE_LIBRARIES})

find_library(IARMBUS_LIBRARIES NAMES IARMBus)
if (IARMBUS_LIBRARIES)
find_path(IARMBUS_INCLUDE_DIRS NAMES libIBus.h PATH_SUFFIXES rdk/iarmbus REQUIRED)
find_path(IARMSYS_INCLUDE_DIRS NAMES sysMgr.h PATH_SUFFIXES rdk/iarmmgrs/sysmgr REQUIRED)
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ${IARMBUS_INCLUDE_DIRS} ${IARMSYS_INCLUDE_DIRS})
target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE ${IARMBUS_LIBRARIES})
target_compile_definitions(${PLUGIN_IMPLEMENTATION} PRIVATE WITH_SYSMGR)
target_include_directories(${MODULE_NAME} PRIVATE ${IARMBUS_INCLUDE_DIRS} ${IARMSYS_INCLUDE_DIRS})
target_link_libraries(${MODULE_NAME} PRIVATE ${IARMBUS_LIBRARIES})
add_definitions(-DWITH_SYSMGR)
endif ()

find_package(Protobuf REQUIRED)
target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE ${Protobuf_LIBRARIES})

add_custom_target(protoc
${Protobuf_PROTOC_EXECUTABLE} --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${CMAKE_CURRENT_SOURCE_DIR}/grpc/secure_storage ${CMAKE_CURRENT_SOURCE_DIR}/grpc/secure_storage/secure_storage.proto
)
add_dependencies(${PLUGIN_IMPLEMENTATION} protoc)

target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE grpc++)
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin REQUIRED)

add_custom_target(protoc-gen-grpc
${Protobuf_PROTOC_EXECUTABLE} --grpc_out ${CMAKE_CURRENT_BINARY_DIR} --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} -I ${CMAKE_CURRENT_SOURCE_DIR}/grpc/secure_storage ${CMAKE_CURRENT_SOURCE_DIR}/grpc/secure_storage/secure_storage.proto
)
add_dependencies(${PLUGIN_IMPLEMENTATION} protoc-gen-grpc)

set(PROTO_SRCS secure_storage.pb.cc secure_storage.grpc.pb.cc)
target_sources(${PLUGIN_IMPLEMENTATION} PRIVATE ${PROTO_SRCS})
set_property(SOURCE ${PROTO_SRCS} PROPERTY GENERATED 1)
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

install(TARGETS ${PLUGIN_IMPLEMENTATION}
install(TARGETS ${MODULE_NAME}
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)

write_config(${PLUGIN_NAME})
2 changes: 0 additions & 2 deletions PersistentStore/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
#define MAXSIZE_ENV "PERSISTENTSTORE_MAXSIZE"
#define MAXVALUE_ENV "PERSISTENTSTORE_MAXVALUE"
#define LIMIT_ENV "PERSISTENTSTORE_LIMIT"
#define TOKEN_COMMAND_ENV "PERSISTENTSTORE_TOKEN_COMMAND"
#define IARM_INIT_NAME "Thunder_Plugins"
#define URI_RFC "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.PersistentStore.Uri"

#undef EXTERNAL
#define EXTERNAL
2 changes: 0 additions & 2 deletions PersistentStore/PersistentStore.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ configuration = JSON()

rootobject = JSON()
rootobject.add("mode", "@PLUGIN_PERSISTENTSTORE_MODE@")
rootobject.add("locator", "lib@[email protected]")
configuration.add("root", rootobject)

configuration.add("uri", "@PLUGIN_PERSISTENTSTORE_URI@")
Expand All @@ -16,4 +15,3 @@ configuration.add("key", "@PLUGIN_PERSISTENTSTORE_KEY@")
configuration.add("maxsize", "@PLUGIN_PERSISTENTSTORE_MAXSIZE@")
configuration.add("maxvalue", "@PLUGIN_PERSISTENTSTORE_MAXVALUE@")
configuration.add("limit", "@PLUGIN_PERSISTENTSTORE_LIMIT@")
configuration.add("tokencommand", "@PLUGIN_PERSISTENTSTORE_TOKEN_COMMAND@")
19 changes: 10 additions & 9 deletions PersistentStore/PersistentStore.config
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
set(autostart true)
set(preconditions Platform)
set(callsign "org.rdk.PersistentStore")
set (autostart true)
set (preconditions Platform)
set (callsign "org.rdk.PersistentStore")

if(PLUGIN_PERSISTENTSTORE_STARTUPORDER)
set (startuporder ${PLUGIN_PERSISTENTSTORE_STARTUPORDER})
endif()

map()
key(root)
map()
kv(mode ${PLUGIN_PERSISTENTSTORE_MODE})
kv(locator lib${PLUGIN_IMPLEMENTATION}.so)
end()
kv(mode ${PLUGIN_PERSISTENTSTORE_MODE})
end()
ans(rootobject)

map()
kv(uri ${PLUGIN_PERSISTENTSTORE_URI})
kv(path ${PLUGIN_PERSISTENTSTORE_PATH})
kv(legacypath ${PLUGIN_PERSISTENTSTORE_LEGACYPATH})
kv(key ${PLUGIN_PERSISTENTSTORE_KEY})
kv(maxsize ${PLUGIN_PERSISTENTSTORE_MAXSIZE})
kv(maxvalue ${PLUGIN_PERSISTENTSTORE_MAXVALUE})
kv(limit ${PLUGIN_PERSISTENTSTORE_LIMIT})
kv(tokencommand ${PLUGIN_PERSISTENTSTORE_TOKEN_COMMAND})
end()
ans(configuration)

map_append(${configuration} root ${rootobject})
22 changes: 2 additions & 20 deletions PersistentStore/PersistentStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@

#include "PersistentStore.h"
#include <fstream>
#ifdef WITH_RFC
#include "rfcapi.h"
#endif

#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 0
#define API_VERSION_NUMBER_PATCH 8
#define API_VERSION_NUMBER_PATCH 6

namespace WPEFramework {

Expand Down Expand Up @@ -71,26 +68,11 @@ namespace Plugin {
}
}

auto uri = _config.Uri.Value();

#ifdef WITH_RFC
RFC_ParamData_t rfcParam;
auto rfcStatus = getRFCParameter(nullptr, URI_RFC, &rfcParam);
if (rfcStatus == WDMP_SUCCESS) {
if (rfcParam.value[0]) {
uri = rfcParam.value;
}
} else {
TRACE(Trace::Error, (_T("%s rfc error %d"), __FUNCTION__, rfcStatus));
}
#endif

Core::SystemInfo::SetEnvironment(URI_ENV, uri);
Core::SystemInfo::SetEnvironment(URI_ENV, _config.Uri.Value());
Core::SystemInfo::SetEnvironment(PATH_ENV, _config.Path.Value());
Core::SystemInfo::SetEnvironment(MAXSIZE_ENV, std::to_string(_config.MaxSize.Value()));
Core::SystemInfo::SetEnvironment(MAXVALUE_ENV, std::to_string(_config.MaxValue.Value()));
Core::SystemInfo::SetEnvironment(LIMIT_ENV, std::to_string(_config.Limit.Value()));
Core::SystemInfo::SetEnvironment(TOKEN_COMMAND_ENV, _config.TokenCommand.Value());

uint32_t connectionId;

Expand Down
2 changes: 0 additions & 2 deletions PersistentStore/PersistentStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ namespace Plugin {
Add(_T("maxsize"), &MaxSize);
Add(_T("maxvalue"), &MaxValue);
Add(_T("limit"), &Limit);
Add(_T("tokencommand"), &TokenCommand);
}

public:
Expand All @@ -61,7 +60,6 @@ namespace Plugin {
Core::JSON::DecUInt64 MaxSize;
Core::JSON::DecUInt64 MaxValue;
Core::JSON::DecUInt64 Limit;
Core::JSON::String TokenCommand;
};

class Store2Notification : public Exchange::IStore2::INotification {
Expand Down
8 changes: 0 additions & 8 deletions PersistentStore/grpc/Store2.cpp

This file was deleted.

Loading

0 comments on commit 28ac17a

Please sign in to comment.