szaszm commented on a change in pull request #920:
URL: https://github.com/apache/nifi-minifi-cpp/pull/920#discussion_r503376897
##########
File path:
extensions/standard-processors/controllers/UnorderedMapKeyValueStoreService.h
##########
@@ -29,19 +29,21 @@
#include "core/logging/Logger.h"
#include "core/logging/LoggerConfiguration.h"
#include "core/Resource.h"
+#include "controllers/keyvalue/PersistableKeyValueStoreService.h"
namespace org {
namespace apache {
namespace nifi {
namespace minifi {
namespace controllers {
-class UnorderedMapKeyValueStoreService : virtual public KeyValueStoreService {
+/// Key-value store serice purely in RAM without disk usage
+class UnorderedMapKeyValueStoreService : virtual public
PersistableKeyValueStoreService {
Review comment:
If it's RAM only, then why is it `PersistableKeyValueStoreService`?
##########
File path:
extensions/standard-processors/controllers/UnorderedMapPersistableKeyValueStoreService.h
##########
@@ -59,20 +61,30 @@ class UnorderedMapPersistableKeyValueStoreService : public
AbstractAutoPersistin
bool update(const std::string& key, const std::function<bool(bool
/*exists*/, std::string& /*value*/)>& update_func) override;
- bool persist() override;
+ bool persist() override {
+ persistNonVirtual();
+ }
protected:
+ using AbstractAutoPersistingKeyValueStoreService::getImpl;
+ using AbstractAutoPersistingKeyValueStoreService::setImpl;
+ using AbstractAutoPersistingKeyValueStoreService::persistImpl;
+ using AbstractAutoPersistingKeyValueStoreService::removeImpl;
+
+
static constexpr const char* FORMAT_VERSION_KEY =
"__UnorderedMapPersistableKeyValueStoreService_FormatVersion";
static constexpr int FORMAT_VERSION = 1;
std::string file_;
bool load();
- std::string escape(const std::string& str);
bool parseLine(const std::string& line, std::string& key, std::string&
value);
private:
+ void initializeNonVirtual();
+ bool persistNonVirtual();
Review comment:
Why are these necessary? If subclasses need to call the base class
implementation, they can always qualify the call with the base class name to
avoid dynamic dispatching,
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]