martinzink commented on a change in pull request #1116:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1116#discussion_r677491529



##########
File path: extensions/standard-processors/processors/AppendHostInfo.h
##########
@@ -37,38 +39,43 @@ namespace nifi {
 namespace minifi {
 namespace processors {
 
-// AppendHostInfo Class
 class AppendHostInfo : public core::Processor {
  public:
-  // Constructor
-  /*!
-   * Create a new processor
-   */
-  AppendHostInfo(const std::string& name, const utils::Identifier& uuid = {}) 
// NOLINT
+  static constexpr const char* REFRESH_POLICY_ON_TRIGGER = "On every trigger";
+  static constexpr const char* REFRESH_POLICY_ON_SCHEDULE = "On schedule";
+
+  explicit AppendHostInfo(const std::string& name, const utils::Identifier& 
uuid = {})
       : core::Processor(name, uuid),
-        logger_(logging::LoggerFactory<AppendHostInfo>::getLogger()) {
+        logger_(logging::LoggerFactory<AppendHostInfo>::getLogger()),
+        refresh_on_trigger_(false) {
   }
-  // Destructor
   virtual ~AppendHostInfo() = default;
-  // Processor Name
   static constexpr char const* ProcessorName = "AppendHostInfo";
-  // Supported Properties
-  static core::Property InterfaceName;
+
+  static core::Property InterfaceNameFilter;
   static core::Property HostAttribute;
   static core::Property IPAttribute;
+  static core::Property RefreshPolicy;
 
-  // Supported Relationships
   static core::Relationship Success;
 
  public:
-  // OnTrigger method, implemented by NiFi AppendHostInfo
-  virtual void onTrigger(core::ProcessContext *context, core::ProcessSession 
*session);
-  // Initialize, over write by NiFi AppendHostInfo
-  virtual void initialize(void);
+  void onSchedule(const std::shared_ptr<core::ProcessContext>& context, const 
std::shared_ptr<core::ProcessSessionFactory>& sessionFactory) override;
+  void onTrigger(core::ProcessContext* context, core::ProcessSession* session) 
override;
+  void initialize() override;
+
+ protected:
+  virtual void refreshHostInfo();
 
  private:
-  // Logger
   std::shared_ptr<logging::Logger> logger_;
+  std::string hostname_attribute_name_;
+  std::string ipaddress_attribute_name_;
+  std::optional<std::regex> interface_name_filter_;
+
+  std::string hostname_;
+  std::optional<std::string> ipaddresses_;
+  bool refresh_on_trigger_;

Review comment:
       yeah, somehow I completly forgot about that possibility good catch.
   Since the writing and reading of these parameters are separated and c++17 is 
available, I've added a shared_mutex with exclusive locking in the onSchedule 
and shared locking where we only want to read these members.
   
https://github.com/apache/nifi-minifi-cpp/pull/1116/commits/5946f344cb2c408dd7a0931ca81c8093e147186f




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to