arpadboda commented on a change in pull request #605: MINIFICPP-550 - Implement 
RocksDB controller service and component st…
URL: https://github.com/apache/nifi-minifi-cpp/pull/605#discussion_r393365856
 
 

 ##########
 File path: extensions/windows-event-log/Bookmark.cpp
 ##########
 @@ -10,17 +11,29 @@ namespace apache {
 namespace nifi {
 namespace minifi {
 namespace processors {
-
-Bookmark::Bookmark(const std::wstring& channel, const std::wstring& query, 
const std::string& bookmarkRootDir, const std::string& uuid, 
std::shared_ptr<logging::Logger> logger)
-  :logger_(logger) {
-  if (!createUUIDDir(bookmarkRootDir, uuid, filePath_))
-    return;
-
-  filePath_ += "Bookmark.txt";
-
-  if (!getBookmarkXmlFromFile(bookmarkXml_)) {
-    return;
-  }
+static const std::string BOOKMARK_KEY = "bookmark";
+
+Bookmark::Bookmark(const std::wstring& channel, const std::wstring& query, 
const std::string& bookmarkRootDir, const std::string& uuid, 
std::shared_ptr<core::CoreComponentStateManager> state_manager, 
std::shared_ptr<logging::Logger> logger)
+  : logger_(logger)
+  , state_manager_(state_manager) {
+  std::unordered_map<std::string, std::string> state_map;
+  if (state_manager_->get(state_map) && state_map.count(BOOKMARK_KEY) == 1U) {
+    bookmarkXml_ = wel::to_wstring(state_map[BOOKMARK_KEY].c_str());
+  } else if (!bookmarkRootDir.empty()) {
+               filePath_ = utils::file::FileUtils::concat_path(
+                       utils::file::FileUtils::concat_path(
+                               
utils::file::FileUtils::concat_path(bookmarkRootDir, "uuid"), uuid), 
"Bookmark.txt");
+
+    std::wstring bookmarkXml;
+               if (getBookmarkXmlFromFile(bookmarkXml)) {
 
 Review comment:
   Some spaces/tabs issue here and above in this functions as well

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


With regards,
Apache Git Services

Reply via email to