You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/11/10 09:35:59 UTC

[GitHub] [nifi-minifi-cpp] lordgamez commented on a change in pull request #1107: MINIFICPP-1338 - Handle processor state persistence through the session

lordgamez commented on a change in pull request #1107:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1107#discussion_r746369902



##########
File path: extensions/windows-event-log/tests/BookmarkTests.cpp
##########
@@ -41,7 +41,8 @@ std::unique_ptr<Bookmark> createBookmark(TestPlan &test_plan,
                                          const utils::Identifier &uuid = IdGenerator::getIdGenerator()->generate()) {
   const auto state_manager = test_plan.getStateManagerProvider()->getCoreComponentStateManager(uuid);
   const auto logger = test_plan.getLogger();
-  return std::make_unique<Bookmark>(channel, L"*", "", uuid, false, state_manager, logger);
+  auto bookmark = std::make_unique<Bookmark>(channel, L"*", "", uuid, false, state_manager, logger);
+  return bookmark;

Review comment:
       What was the reason for this change?

##########
File path: extensions/coap/tests/CoapIntegrationBase.h
##########
@@ -37,7 +37,7 @@ int ssl_enable(void *, void *) {
 
 class CoapIntegrationBase : public IntegrationBase {
  public:
-  explicit CoapIntegrationBase(uint64_t waitTime = 5000)
+  explicit CoapIntegrationBase(std::chrono::milliseconds waitTime = std::chrono::milliseconds(5000))

Review comment:
       You could use chrono literals instead. The same comment should apply to all the std::chrono usages in this PR.

##########
File path: libminifi/include/core/ProcessContext.h
##########
@@ -362,6 +369,8 @@ class ProcessContext : public controller::ControllerServiceLookup, public core::
   controller::ControllerServiceProvider* controller_service_provider_;
   // state manager provider
   std::shared_ptr<core::CoreComponentStateManagerProvider> state_manager_provider_;
+  // state manager
+  std::shared_ptr<CoreComponentStateManager> stateManager_;

Review comment:
       Use snake_case_ here as well (valid for any further member variables in the PR), also I think these member comments are unnecessary as they do not contain any useful info.

##########
File path: libminifi/include/controllers/keyvalue/AbstractCoreComponentStateManagerProvider.h
##########
@@ -34,29 +34,39 @@ namespace controllers {
 class AbstractCoreComponentStateManagerProvider : public std::enable_shared_from_this<AbstractCoreComponentStateManagerProvider>,
                                                    public core::CoreComponentStateManagerProvider {
  public:
-  ~AbstractCoreComponentStateManagerProvider() override;
-
   std::shared_ptr<core::CoreComponentStateManager> getCoreComponentStateManager(const utils::Identifier& uuid) override;
-
   std::map<utils::Identifier, std::unordered_map<std::string, std::string>> getAllCoreComponentStates() override;
 
   class AbstractCoreComponentStateManager : public core::CoreComponentStateManager{
    public:
     AbstractCoreComponentStateManager(std::shared_ptr<AbstractCoreComponentStateManagerProvider> provider, const utils::Identifier& id);
 
-    bool set(const core::CoreComponentState& kvs) override;
+    ~AbstractCoreComponentStateManager() override;
 
+    bool set(const core::CoreComponentState& kvs) override;
     bool get(core::CoreComponentState& kvs) override;
-
     bool clear() override;
-
     bool persist() override;
 
+    bool isTransactionInProgress() const override;
+    bool beginTransaction() override;
+    bool commit() override;
+    bool rollback() override;
+
    private:
+    enum class ChangeType {
+      NONE,
+      SET,
+      CLEAR
+    };
+
     std::shared_ptr<AbstractCoreComponentStateManagerProvider> provider_;
     utils::Identifier id_;
     bool state_valid_;
     core::CoreComponentState state_;
+    bool transactionInProgress_;
+    ChangeType changeType_;
+    core::CoreComponentState stateToSet_;

Review comment:
       Use snake_case_ format for member variables

##########
File path: libminifi/include/controllers/keyvalue/AbstractCoreComponentStateManagerProvider.h
##########
@@ -66,8 +76,11 @@ class AbstractCoreComponentStateManagerProvider : public std::enable_shared_from
   virtual bool removeImpl(const utils::Identifier& key) = 0;
   virtual bool persistImpl() = 0;
 
-  virtual std::string serialize(const core::CoreComponentState& kvs);
-  bool deserialize(const std::string& serialized, core::CoreComponentState& kvs);
+ private:
+  void removeFromCache(utils::Identifier id);
+
+  std::mutex mutex;

Review comment:
       Use "_" suffix for member




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org