This is an automated email from the ASF dual-hosted git repository.

adebreceni pushed a commit to branch MINIFICPP-2669
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/MINIFICPP-2669 by this push:
     new ad9285346 MINIFICPP-2669 - Comments, clang tidy fix
ad9285346 is described below

commit ad92853463021d47f54d15fc95f52ad88ddc13ad
Author: Adam Debreceni <[email protected]>
AuthorDate: Thu Mar 12 08:54:27 2026 +0100

    MINIFICPP-2669 - Comments, clang tidy fix
---
 .../include/controllers/AttributeProviderService.h               | 2 +-
 extension-framework/include/controllers/RecordSetReader.h        | 2 +-
 extension-framework/include/controllers/RecordSetWriter.h        | 2 +-
 .../include/controllers/keyvalue/KeyValueStateStorage.h          | 2 +-
 extensions/aws/controllerservices/AWSCredentialsService.h        | 2 +-
 .../azure/controllerservices/AzureStorageCredentialsService.h    | 2 +-
 .../couchbase/controllerservices/CouchbaseClusterService.h       | 2 +-
 .../elasticsearch/ElasticsearchCredentialsControllerService.h    | 2 +-
 .../gcp/controllerservices/GCPCredentialsControllerService.h     | 2 +-
 extensions/smb/SmbConnectionControllerService.h                  | 2 +-
 extensions/sql/services/DatabaseService.h                        | 2 +-
 libminifi/include/controllers/NetworkPrioritizerService.h        | 2 +-
 libminifi/include/controllers/SSLContextService.h                | 2 +-
 libminifi/include/controllers/UpdatePolicyControllerService.h    | 2 +-
 libminifi/test/integration/C2ControllerEnableFailureTest.cpp     | 2 +-
 libminifi/test/libtest/unit/MockClasses.h                        | 2 +-
 libminifi/test/unit/ComponentManifestTests.cpp                   | 2 +-
 libminifi/test/unit/ProcessorConfigUtilsTests.cpp                | 4 ++--
 .../include/minifi-cpp/core/controller/ControllerServiceApi.h    | 9 ++++++++-
 .../include/minifi-cpp/core/controller/ControllerServiceHandle.h | 3 +++
 20 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/extension-framework/include/controllers/AttributeProviderService.h 
b/extension-framework/include/controllers/AttributeProviderService.h
index 18d2eac09..694cbb34c 100644
--- a/extension-framework/include/controllers/AttributeProviderService.h
+++ b/extension-framework/include/controllers/AttributeProviderService.h
@@ -30,7 +30,7 @@ class AttributeProviderServiceImpl : public 
core::controller::ControllerServiceB
  public:
   using ControllerServiceBase::ControllerServiceBase;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 };
 
 }  // namespace org::apache::nifi::minifi::controllers
diff --git a/extension-framework/include/controllers/RecordSetReader.h 
b/extension-framework/include/controllers/RecordSetReader.h
index 6d46bf023..a15d2e575 100644
--- a/extension-framework/include/controllers/RecordSetReader.h
+++ b/extension-framework/include/controllers/RecordSetReader.h
@@ -26,7 +26,7 @@ class RecordSetReaderImpl : public 
controller::ControllerServiceBase, public Rec
  public:
   using ControllerServiceBase::ControllerServiceBase;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 };
 
 }  // namespace org::apache::nifi::minifi::core
diff --git a/extension-framework/include/controllers/RecordSetWriter.h 
b/extension-framework/include/controllers/RecordSetWriter.h
index 37755679e..6a2e32c2a 100644
--- a/extension-framework/include/controllers/RecordSetWriter.h
+++ b/extension-framework/include/controllers/RecordSetWriter.h
@@ -25,7 +25,7 @@ class RecordSetWriterImpl : public 
controller::ControllerServiceBase, public Rec
  public:
   using ControllerServiceBase::ControllerServiceBase;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 };
 
 }  // namespace org::apache::nifi::minifi::core
diff --git 
a/extension-framework/include/controllers/keyvalue/KeyValueStateStorage.h 
b/extension-framework/include/controllers/keyvalue/KeyValueStateStorage.h
index b9df7ac54..191a512c5 100644
--- a/extension-framework/include/controllers/keyvalue/KeyValueStateStorage.h
+++ b/extension-framework/include/controllers/keyvalue/KeyValueStateStorage.h
@@ -48,7 +48,7 @@ class KeyValueStateStorage : public core::StateStorageImpl, 
public core::control
   virtual bool clear() = 0;
   virtual bool update(const std::string& key, const std::function<bool(bool 
/*exists*/, std::string& /*value*/)>& update_func) = 0;
   virtual bool persist() = 0;
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
  private:
   bool getAll(std::unordered_map<utils::Identifier, std::string>& kvs);
diff --git a/extensions/aws/controllerservices/AWSCredentialsService.h 
b/extensions/aws/controllerservices/AWSCredentialsService.h
index ace14ae8c..ccd1ded67 100644
--- a/extensions/aws/controllerservices/AWSCredentialsService.h
+++ b/extensions/aws/controllerservices/AWSCredentialsService.h
@@ -76,7 +76,7 @@ class AWSCredentialsService : public 
core::controller::ControllerServiceBase, pu
 
   void onEnable() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   std::optional<Aws::Auth::AWSCredentials> getAWSCredentials();
 
diff --git 
a/extensions/azure/controllerservices/AzureStorageCredentialsService.h 
b/extensions/azure/controllerservices/AzureStorageCredentialsService.h
index 533979441..334dd5b96 100644
--- a/extensions/azure/controllerservices/AzureStorageCredentialsService.h
+++ b/extensions/azure/controllerservices/AzureStorageCredentialsService.h
@@ -92,7 +92,7 @@ class AzureStorageCredentialsService : public 
core::controller::ControllerServic
 
   void onEnable() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   storage::AzureStorageCredentials getCredentials() const {
     return credentials_;
diff --git a/extensions/couchbase/controllerservices/CouchbaseClusterService.h 
b/extensions/couchbase/controllerservices/CouchbaseClusterService.h
index 4d840a1a2..f6cdddc52 100644
--- a/extensions/couchbase/controllerservices/CouchbaseClusterService.h
+++ b/extensions/couchbase/controllerservices/CouchbaseClusterService.h
@@ -138,7 +138,7 @@ class CouchbaseClusterService : public 
core::controller::ControllerServiceBase,
     }
   }
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   virtual nonstd::expected<CouchbaseUpsertResult, CouchbaseErrorType> 
upsert(const CouchbaseCollection& collection, CouchbaseValueType document_type,
       const std::string& document_id, const std::vector<std::byte>& buffer, 
const ::couchbase::upsert_options& options) {
diff --git 
a/extensions/elasticsearch/ElasticsearchCredentialsControllerService.h 
b/extensions/elasticsearch/ElasticsearchCredentialsControllerService.h
index 3299a0c3b..ca7304bb8 100644
--- a/extensions/elasticsearch/ElasticsearchCredentialsControllerService.h
+++ b/extensions/elasticsearch/ElasticsearchCredentialsControllerService.h
@@ -64,7 +64,7 @@ class ElasticsearchCredentialsControllerService : public 
core::controller::Contr
 
   void onEnable() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   void authenticateClient(http::HTTPClient& client);
 
diff --git 
a/extensions/gcp/controllerservices/GCPCredentialsControllerService.h 
b/extensions/gcp/controllerservices/GCPCredentialsControllerService.h
index 056dcc05b..0eb8fbf8a 100644
--- a/extensions/gcp/controllerservices/GCPCredentialsControllerService.h
+++ b/extensions/gcp/controllerservices/GCPCredentialsControllerService.h
@@ -99,7 +99,7 @@ class GCPCredentialsControllerService : public 
core::controller::ControllerServi
 
   void onEnable() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   [[nodiscard]] const auto& getCredentials() const { return credentials_; }
 
diff --git a/extensions/smb/SmbConnectionControllerService.h 
b/extensions/smb/SmbConnectionControllerService.h
index 3748b77ec..22894badc 100644
--- a/extensions/smb/SmbConnectionControllerService.h
+++ b/extensions/smb/SmbConnectionControllerService.h
@@ -78,7 +78,7 @@ class SmbConnectionControllerService : public 
core::controller::ControllerServic
   void onEnable() override;
   void notifyStop() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   virtual std::error_code validateConnection();
   virtual std::filesystem::path getPath() const { return server_path_; }
diff --git a/extensions/sql/services/DatabaseService.h 
b/extensions/sql/services/DatabaseService.h
index c40c35225..81c250da2 100644
--- a/extensions/sql/services/DatabaseService.h
+++ b/extensions/sql/services/DatabaseService.h
@@ -52,7 +52,7 @@ class DatabaseService : public 
core::controller::ControllerServiceBase, public c
 
   void onEnable() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   virtual std::unique_ptr<sql::Connection> getConnection() const = 0;
 
diff --git a/libminifi/include/controllers/NetworkPrioritizerService.h 
b/libminifi/include/controllers/NetworkPrioritizerService.h
index 93774c6c8..f893a9f68 100644
--- a/libminifi/include/controllers/NetworkPrioritizerService.h
+++ b/libminifi/include/controllers/NetworkPrioritizerService.h
@@ -103,7 +103,7 @@ class NetworkPrioritizerService : public 
core::controller::ControllerServiceBase
 
   void onEnable() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   io::NetworkInterface getInterface(uint32_t size);
 
diff --git a/libminifi/include/controllers/SSLContextService.h 
b/libminifi/include/controllers/SSLContextService.h
index 6ccf1dcf9..22b62817e 100644
--- a/libminifi/include/controllers/SSLContextService.h
+++ b/libminifi/include/controllers/SSLContextService.h
@@ -81,7 +81,7 @@ class SSLContextService : public 
core::controller::ControllerServiceBase, public
 
   void initialize() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   std::unique_ptr<SSLContext> createSSLContext();
 
diff --git a/libminifi/include/controllers/UpdatePolicyControllerService.h 
b/libminifi/include/controllers/UpdatePolicyControllerService.h
index cd54f6861..2c3608147 100644
--- a/libminifi/include/controllers/UpdatePolicyControllerService.h
+++ b/libminifi/include/controllers/UpdatePolicyControllerService.h
@@ -78,7 +78,7 @@ class UpdatePolicyControllerService : public 
core::controller::ControllerService
 
   void onEnable() override;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   bool canUpdate(const std::string &property) const {
     return policy_->canUpdate(property);
diff --git a/libminifi/test/integration/C2ControllerEnableFailureTest.cpp 
b/libminifi/test/integration/C2ControllerEnableFailureTest.cpp
index 06f6ce265..b4252c9dc 100644
--- a/libminifi/test/integration/C2ControllerEnableFailureTest.cpp
+++ b/libminifi/test/integration/C2ControllerEnableFailureTest.cpp
@@ -49,7 +49,7 @@ class DummyController : public 
core::controller::ControllerServiceBase, public c
     setSupportedProperties(Properties);
   }
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   void onEnable() override {
     auto dummy_controller_property = getProperty(DummyControllerProperty.name);
diff --git a/libminifi/test/libtest/unit/MockClasses.h 
b/libminifi/test/libtest/unit/MockClasses.h
index 4e7d91ebb..4a00afff9 100644
--- a/libminifi/test/libtest/unit/MockClasses.h
+++ b/libminifi/test/libtest/unit/MockClasses.h
@@ -61,7 +61,7 @@ class MockControllerService : public 
minifi::core::controller::ControllerService
     str = "pushitrealgood";
   }
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
  protected:
   std::string str;
diff --git a/libminifi/test/unit/ComponentManifestTests.cpp 
b/libminifi/test/unit/ComponentManifestTests.cpp
index e2bdfac91..8bf733867 100644
--- a/libminifi/test/unit/ComponentManifestTests.cpp
+++ b/libminifi/test/unit/ComponentManifestTests.cpp
@@ -44,7 +44,7 @@ class ExampleService : public 
core::controller::ControllerServiceBase, public co
  public:
   using ControllerServiceBase::ControllerServiceBase;
 
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
 
   static constexpr const char* Description = "An example service";
   static constexpr auto Properties = std::array<core::PropertyReference, 0>{};
diff --git a/libminifi/test/unit/ProcessorConfigUtilsTests.cpp 
b/libminifi/test/unit/ProcessorConfigUtilsTests.cpp
index 7976eb8ef..2d34c6004 100644
--- a/libminifi/test/unit/ProcessorConfigUtilsTests.cpp
+++ b/libminifi/test/unit/ProcessorConfigUtilsTests.cpp
@@ -95,8 +95,8 @@ namespace {
 class TestControllerService : public controller::ControllerServiceBase, public 
core::controller::ControllerServiceHandle {
  public:
   using ControllerServiceBase::ControllerServiceBase;
-  ControllerServiceHandle* getControllerServiceHandle() override {return this;}
-  bool supportsDynamicProperties() const override {return false;}
+  [[nodiscard]] ControllerServiceHandle* getControllerServiceHandle() override 
{return this;}
+  [[nodiscard]] bool supportsDynamicProperties() const override {return false;}
 };
 
 const std::shared_ptr test_controller_service = []() {
diff --git 
a/minifi-api/include/minifi-cpp/core/controller/ControllerServiceApi.h 
b/minifi-api/include/minifi-cpp/core/controller/ControllerServiceApi.h
index 0a98d5144..0eab2727d 100644
--- a/minifi-api/include/minifi-cpp/core/controller/ControllerServiceApi.h
+++ b/minifi-api/include/minifi-cpp/core/controller/ControllerServiceApi.h
@@ -32,10 +32,17 @@ class ControllerServiceApi {
 
   [[nodiscard]] virtual bool supportsDynamicProperties() const = 0;
 
+  // Called after construction to advertise supported properties.
   virtual void initialize(ControllerServiceDescriptor& descriptor) = 0;
+  // Called before being used from processors and other controller services 
depending on this one
+  // the services in linked_services are already enabled
+  // after this the controller service should be ready to be used.
   virtual void onEnable(ControllerServiceContext& context, const 
std::shared_ptr<Configure>& configuration, const 
std::vector<std::shared_ptr<ControllerServiceHandle>>& linked_services) = 0;
+  // A handle that provides the actual service-specific functionality (will be 
dynamic_cast-ed to the expected interface)
+  // it should be valid between onEnable and notifyStop.
+  [[nodiscard]] virtual ControllerServiceHandle* getControllerServiceHandle() 
= 0;
+  // In this method the service should release all resources, after this 
either onEnable is called again, or the service is destroyed.
   virtual void notifyStop() = 0;
-  virtual ControllerServiceHandle* getControllerServiceHandle() = 0;
 };
 
 }  // namespace org::apache::nifi::minifi::core::controller
diff --git 
a/minifi-api/include/minifi-cpp/core/controller/ControllerServiceHandle.h 
b/minifi-api/include/minifi-cpp/core/controller/ControllerServiceHandle.h
index d06422e09..761054136 100644
--- a/minifi-api/include/minifi-cpp/core/controller/ControllerServiceHandle.h
+++ b/minifi-api/include/minifi-cpp/core/controller/ControllerServiceHandle.h
@@ -19,6 +19,9 @@
 
 namespace org::apache::nifi::minifi::core::controller {
 
+// Represents the usage side of the controller service.
+// It should be dynamic_cast to whatever actual interface we expect from the
+// service, e.g. RecordSetReader.
 class ControllerServiceHandle {
  public:
   virtual ~ControllerServiceHandle() = default;

Reply via email to