This is an automated email from the ASF dual-hosted git repository. adebreceni pushed a commit to branch minifi-api in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 27ac6d12c2453721b2082ac45d1a9ea0adbe693c Author: Adam Debreceni <[email protected]> AuthorDate: Mon Jan 6 11:23:58 2025 +0100 Review fixes --- extensions/rocksdb-repos/ProvenanceRepository.h | 2 - libminifi/include/ResourceClaim.h | 3 +- libminifi/include/core/ProcessGroup.h | 3 +- libminifi/include/core/ProcessSession.h | 54 +++++----------------- libminifi/include/core/ProcessSessionFactory.h | 21 +-------- libminifi/include/core/WeakReference.h | 12 +---- .../core/controller/ControllerServiceNode.h | 8 ---- libminifi/include/core/state/FlowIdentifier.h | 15 +----- libminifi/include/core/state/nodes/MetricsBase.h | 6 --- libminifi/include/properties/Properties.h | 4 -- libminifi/include/provenance/Provenance.h | 4 -- libminifi/include/sitetosite/HTTPProtocol.h | 3 +- libminifi/include/sitetosite/RawSocketProtocol.h | 2 - libminifi/src/core/ProcessSession.cpp | 4 +- libminifi/test/flow-tests/FlowControllerTests.cpp | 1 + libminifi/test/flow-tests/LoopTest.cpp | 2 + libminifi/test/flow-tests/MultiLoopTest.cpp | 2 + libminifi/test/schema-tests/SchemaTests.cpp | 1 - minifi-api/include/minifi-cpp/core/FlowFile.h | 10 ---- minifi-api/include/minifi-cpp/core/ObjectFactory.h | 16 +------ .../include/minifi-cpp/core/ProcessContext.h | 9 +--- .../minifi-cpp/core/ProcessContextBuilder.h | 10 ---- .../include/minifi-cpp/core/ProcessSession.h | 15 +----- .../minifi-cpp/core/ProcessSessionFactory.h | 14 +----- minifi-api/include/minifi-cpp/core/Processor.h | 12 ----- .../include/minifi-cpp/core/ProcessorConfig.h | 20 ++------ .../include/minifi-cpp/core/ProcessorMetrics.h | 4 -- minifi-api/include/minifi-cpp/core/ProcessorNode.h | 3 -- minifi-api/include/minifi-cpp/core/Property.h | 13 +----- minifi-api/include/minifi-cpp/core/Repository.h | 14 ------ minifi-api/include/minifi-cpp/core/Scheduling.h | 16 ++----- minifi-api/include/minifi-cpp/core/WeakReference.h | 16 ++----- .../minifi-cpp/core/controller/ControllerService.h | 13 ------ .../core/controller/ControllerServiceLookup.h | 19 ++------ .../minifi-cpp/core/extension/ExtensionManager.h | 4 -- .../include/minifi-cpp/core/state/FlowIdentifier.h | 13 +----- .../minifi-cpp/core/state/nodes/MetricsBase.h | 21 --------- .../core/state/nodes/ResponseNodeLoader.h | 5 -- minifi-api/include/minifi-cpp/utils/AnyRef.h | 29 ------------ minifi-api/include/minifi-cpp/utils/TimeUtil.h | 3 -- utils/CMakeLists.txt | 1 - utils/include/core/ContentRepository.h | 7 --- utils/include/core/Core.h | 18 -------- utils/include/core/ProcessContext.h | 19 +------- utils/include/core/Repository.h | 2 - utils/include/io/BaseStream.h | 4 -- utils/include/utils/MinifiConcurrentQueue.h | 18 ++------ utils/src/core/Core.cpp | 6 +-- 48 files changed, 56 insertions(+), 445 deletions(-) diff --git a/extensions/rocksdb-repos/ProvenanceRepository.h b/extensions/rocksdb-repos/ProvenanceRepository.h index 29d1fd6ca..89b89dbe8 100644 --- a/extensions/rocksdb-repos/ProvenanceRepository.h +++ b/extensions/rocksdb-repos/ProvenanceRepository.h @@ -76,8 +76,6 @@ class ProvenanceRepository : public core::repository::RocksDbRepository { void destroy(); - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer ProvenanceRepository(const ProvenanceRepository &parent) = delete; ProvenanceRepository &operator=(const ProvenanceRepository &parent) = delete; diff --git a/libminifi/include/ResourceClaim.h b/libminifi/include/ResourceClaim.h index 8d38a33dc..6db004811 100644 --- a/libminifi/include/ResourceClaim.h +++ b/libminifi/include/ResourceClaim.h @@ -90,8 +90,7 @@ class ResourceClaimImpl : public ResourceClaim { private: // Logger std::shared_ptr<core::logging::Logger> logger_; - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer + ResourceClaimImpl(const ResourceClaimImpl &parent); ResourceClaimImpl &operator=(const ResourceClaimImpl &parent); diff --git a/libminifi/include/core/ProcessGroup.h b/libminifi/include/core/ProcessGroup.h index 579ad8939..bb3b018b7 100644 --- a/libminifi/include/core/ProcessGroup.h +++ b/libminifi/include/core/ProcessGroup.h @@ -268,8 +268,7 @@ class ProcessGroup : public CoreComponentImpl { mutable std::recursive_mutex mutex_; // Logger std::shared_ptr<logging::Logger> logger_; - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer + ProcessGroup(const ProcessGroup &parent); ProcessGroup &operator=(const ProcessGroup &parent); static std::shared_ptr<utils::IdGenerator> id_generator_; diff --git a/libminifi/include/core/ProcessSession.h b/libminifi/include/core/ProcessSession.h index 14adb5675..b424acbce 100644 --- a/libminifi/include/core/ProcessSession.h +++ b/libminifi/include/core/ProcessSession.h @@ -49,29 +49,20 @@ std::string to_string(const ReadBufferResult& read_buffer_result); namespace org::apache::nifi::minifi::core { -// ProcessSession Class class ProcessSessionImpl : public ReferenceContainerImpl, public virtual ProcessSession { public: - // Constructor - /*! - * Create a new process session - */ explicit ProcessSessionImpl(std::shared_ptr<ProcessContext> processContext); - // Destructor ~ProcessSessionImpl() override; - - // Commit the session void commit() override; - // Roll Back the session void rollback() override; nonstd::expected<void, std::exception_ptr> rollbackNoThrow() noexcept override; - // Get Provenance Report + std::shared_ptr<provenance::ProvenanceReporter> getProvenanceReporter() override { return provenance_report_; } - // writes the created contents to the underlying repository + void flushContent() override; std::shared_ptr<core::FlowFile> get() override; @@ -80,7 +71,7 @@ class ProcessSessionImpl : public ReferenceContainerImpl, public virtual Process void add(const std::shared_ptr<core::FlowFile> &record) override; std::shared_ptr<core::FlowFile> clone(const core::FlowFile& parent) override; std::shared_ptr<core::FlowFile> clone(const core::FlowFile& parent, int64_t offset, int64_t size) override; - // Transfer the FlowFile to the relationship + void transfer(const std::shared_ptr<core::FlowFile>& flow, const Relationship& relationship) override; void transferToCustomRelationship(const std::shared_ptr<core::FlowFile>& flow, const std::string& relationship_name) override; @@ -88,57 +79,44 @@ class ProcessSessionImpl : public ReferenceContainerImpl, public virtual Process void removeAttribute(core::FlowFile& flow, std::string_view key) override; void remove(const std::shared_ptr<core::FlowFile> &flow) override; - // Access the contents of the flow file as an input stream; returns null if the flow file has no content claim + std::shared_ptr<io::InputStream> getFlowFileContentStream(const core::FlowFile& flow_file) override; - // Execute the given read callback against the content + int64_t read(const std::shared_ptr<core::FlowFile>& flow_file, const io::InputStreamCallback& callback) override; int64_t read(const core::FlowFile& flow_file, const io::InputStreamCallback& callback) override; - // Read content into buffer + detail::ReadBufferResult readBuffer(const std::shared_ptr<core::FlowFile>& flow) override; - // Execute the given write callback against the content + void write(const std::shared_ptr<core::FlowFile> &flow, const io::OutputStreamCallback& callback) override; void write(core::FlowFile& flow, const io::OutputStreamCallback& callback) override; // Read and write the flow file at the same time (eg. for processing it line by line) int64_t readWrite(const std::shared_ptr<core::FlowFile> &flow, const io::InputOutputStreamCallback& callback) override; - // Replace content with buffer + void writeBuffer(const std::shared_ptr<core::FlowFile>& flow_file, std::span<const char> buffer) override; void writeBuffer(const std::shared_ptr<core::FlowFile>& flow_file, std::span<const std::byte> buffer) override; - // Execute the given write/append callback against the content + void append(const std::shared_ptr<core::FlowFile> &flow, const io::OutputStreamCallback& callback) override; - // Append buffer to content + void appendBuffer(const std::shared_ptr<core::FlowFile>& flow, std::span<const char> buffer) override; void appendBuffer(const std::shared_ptr<core::FlowFile>& flow, std::span<const std::byte> buffer) override; - // Penalize the flow + void penalize(const std::shared_ptr<core::FlowFile> &flow) override; bool outgoingConnectionsFull(const std::string& relationship) override; - /** - * Imports a file from the data stream - * @param stream incoming data stream that contains the data to store into a file - * @param flow flow file - */ void importFrom(io::InputStream &stream, const std::shared_ptr<core::FlowFile> &flow) override; void importFrom(io::InputStream&& stream, const std::shared_ptr<core::FlowFile> &flow) override; - // import from the data source. void import(const std::string& source, const std::shared_ptr<core::FlowFile> &flow, bool keepSource = true, uint64_t offset = 0) override; - /** - * Exports the data stream to a file - * @param string file to export stream to - * @param flow flow file - * @param bool whether or not to keep the content in the flow file - */ bool exportContent(const std::string &destination, const std::shared_ptr<core::FlowFile> &flow, bool keepContent) override; bool exportContent(const std::string &destination, const std::string &tmpFileName, const std::shared_ptr<core::FlowFile> &flow, bool keepContent) override; - // Stash the content to a key void stash(const std::string &key, const std::shared_ptr<core::FlowFile> &flow) override; - // Restore content previously stashed to a key + void restore(const std::string &key, const std::shared_ptr<core::FlowFile> &flow) override; bool existsFlowFileInRelationship(const Relationship &relationship) override; @@ -149,8 +127,6 @@ class ProcessSessionImpl : public ReferenceContainerImpl, public virtual Process bool hasBeenTransferred(const core::FlowFile &flow) const override; -// Prevent default copy constructor and assignment operation -// Only support pass by reference or pointer ProcessSessionImpl(const ProcessSessionImpl &parent) = delete; ProcessSessionImpl &operator=(const ProcessSessionImpl &parent) = delete; @@ -202,17 +178,11 @@ class ProcessSessionImpl : public ReferenceContainerImpl, public virtual Process void ensureNonNullResourceClaim( const std::map<Connectable*, std::vector<std::shared_ptr<core::FlowFile>>>& transactionMap); - // Clone the flow file during transfer to multiple connections for a relationship std::shared_ptr<core::FlowFile> cloneDuringTransfer(const core::FlowFile& parent); - // ProcessContext std::shared_ptr<ProcessContext> process_context_; - // Logger std::shared_ptr<logging::Logger> logger_; - // Provenance Report std::shared_ptr<provenance::ProvenanceReporter> provenance_report_; - std::shared_ptr<ContentSession> content_session_; - StateManager* stateManager_; static std::shared_ptr<utils::IdGenerator> id_generator_; diff --git a/libminifi/include/core/ProcessSessionFactory.h b/libminifi/include/core/ProcessSessionFactory.h index 2bf57d442..fae0fb1ed 100644 --- a/libminifi/include/core/ProcessSessionFactory.h +++ b/libminifi/include/core/ProcessSessionFactory.h @@ -25,40 +25,23 @@ #include "ProcessSession.h" #include "minifi-cpp/core/ProcessSessionFactory.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { +namespace org::apache::nifi::minifi::core { -// ProcessSessionFactory Class class ProcessSessionFactoryImpl : public virtual ProcessSessionFactory { public: - // Constructor - /*! - * Create a new process session factory - */ explicit ProcessSessionFactoryImpl(std::shared_ptr<ProcessContext> processContext) : process_context_(processContext) { } - // Create the session std::shared_ptr<ProcessSession> createSession() override; - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer ProcessSessionFactoryImpl(const ProcessSessionFactoryImpl &parent) = delete; ProcessSessionFactoryImpl &operator=(const ProcessSessionFactoryImpl &parent) = delete; ~ProcessSessionFactoryImpl() override = default; private: - // ProcessContext std::shared_ptr<ProcessContext> process_context_; }; -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org +} // namespace org::apache::nifi::minifi::core diff --git a/libminifi/include/core/WeakReference.h b/libminifi/include/core/WeakReference.h index f28f557d3..be7a27bc6 100644 --- a/libminifi/include/core/WeakReference.h +++ b/libminifi/include/core/WeakReference.h @@ -25,11 +25,7 @@ #include "minifi-cpp/core/WeakReference.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { +namespace org::apache::nifi::minifi::core { /** * Reference container is a vector of weak references that enables @@ -69,8 +65,4 @@ class ReferenceContainerImpl : public virtual ReferenceContainer { std::vector<std::shared_ptr<WeakReference> > references; }; -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org +} // namespace org::apache::nifi::minifi::core diff --git a/libminifi/include/core/controller/ControllerServiceNode.h b/libminifi/include/core/controller/ControllerServiceNode.h index af2952546..bb09b2644 100644 --- a/libminifi/include/core/controller/ControllerServiceNode.h +++ b/libminifi/include/core/controller/ControllerServiceNode.h @@ -37,12 +37,6 @@ namespace org::apache::nifi::minifi::core::controller { class ControllerServiceNodeImpl : public CoreComponentImpl, public ConfigurableComponentImpl, public virtual ControllerServiceNode { public: - /** - * Constructor for the controller service node. - * @param service controller service reference - * @param id identifier for this node. - * @param configuration shared pointer configuration. - */ explicit ControllerServiceNodeImpl(std::shared_ptr<ControllerService> service, std::string id, std::shared_ptr<Configure> configuration) : CoreComponentImpl(std::move(id)), active(false), @@ -105,9 +99,7 @@ class ControllerServiceNodeImpl : public CoreComponentImpl, public ConfigurableC std::atomic<bool> active; std::shared_ptr<Configure> configuration_; - // controller service. std::shared_ptr<ControllerService> controller_service_; - // linked controller services. std::vector<ControllerServiceNode*> linked_controller_services_; }; diff --git a/libminifi/include/core/state/FlowIdentifier.h b/libminifi/include/core/state/FlowIdentifier.h index 5df4563ed..61fe6d79b 100644 --- a/libminifi/include/core/state/FlowIdentifier.h +++ b/libminifi/include/core/state/FlowIdentifier.h @@ -21,11 +21,7 @@ #include "minifi-cpp/core/state/FlowIdentifier.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace state { +namespace org::apache::nifi::minifi::state { /** * Purpose: Represents a flow identifier for a given flow update or instance. @@ -36,9 +32,6 @@ class FlowIdentifierImpl : public virtual FlowIdentifier { public: FlowIdentifierImpl() = delete; - /** - * Constructor accepts the url, bucket id, and flow id. - */ explicit FlowIdentifierImpl(const std::string &url, const std::string &bucket_id, const std::string &flow_id) { registry_url_ = url; bucket_id_ = bucket_id; @@ -74,8 +67,4 @@ class FlowIdentifierImpl : public virtual FlowIdentifier { }; -} // namespace state -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org +} // namespace org::apache::nifi::minifi::state diff --git a/libminifi/include/core/state/nodes/MetricsBase.h b/libminifi/include/core/state/nodes/MetricsBase.h index 2bbc0267b..98a1c260c 100644 --- a/libminifi/include/core/state/nodes/MetricsBase.h +++ b/libminifi/include/core/state/nodes/MetricsBase.h @@ -33,9 +33,6 @@ namespace org::apache::nifi::minifi::state::response { -/** - * Purpose: Defines a metric that - */ class DeviceInformation : public ResponseNodeImpl { public: DeviceInformation(std::string_view name, const utils::Identifier& uuid) @@ -47,9 +44,6 @@ class DeviceInformation : public ResponseNodeImpl { } }; -/** - * Purpose: Defines a metric that - */ class ObjectNode : public ResponseNodeImpl { public: explicit ObjectNode(const std::string_view name, const utils::Identifier& uuid = {}) diff --git a/libminifi/include/properties/Properties.h b/libminifi/include/properties/Properties.h index 87a778472..2cab983ae 100644 --- a/libminifi/include/properties/Properties.h +++ b/libminifi/include/properties/Properties.h @@ -49,7 +49,6 @@ class PropertiesImpl : public virtual Properties { return name_; } - // Clear the load config void clear() override { std::lock_guard<std::mutex> lock(mutex_); properties_.clear(); @@ -57,7 +56,6 @@ class PropertiesImpl : public virtual Properties { void set(const std::string& key, const std::string& value) override { set(key, value, PropertyChangeLifetime::PERSISTENT); } - // Set the config value void set(const std::string &key, const std::string &value, PropertyChangeLifetime lifetime) override { auto active_value = utils::string::replaceEnvironmentVariables(value); std::lock_guard<std::mutex> lock(mutex_); @@ -78,7 +76,6 @@ class PropertiesImpl : public virtual Properties { dirty_ = true; } } - // Check whether the config value existed bool has(const std::string& key) const override { std::lock_guard<std::mutex> lock(mutex_); return properties_.count(key) > 0; @@ -148,7 +145,6 @@ class PropertiesImpl : public virtual Properties { // Mutex for protection mutable std::mutex mutex_; - // Logger std::shared_ptr<core::logging::Logger> logger_; // Home location for this executable std::filesystem::path minifi_home_; diff --git a/libminifi/include/provenance/Provenance.h b/libminifi/include/provenance/Provenance.h index 41eb61674..01e3c3fbe 100644 --- a/libminifi/include/provenance/Provenance.h +++ b/libminifi/include/provenance/Provenance.h @@ -264,8 +264,6 @@ class ProvenanceEventRecordImpl : public core::SerializableComponentImpl, public std::string _alternateIdentifierUri; private: - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer ProvenanceEventRecordImpl(const ProvenanceEventRecordImpl &parent); ProvenanceEventRecordImpl &operator=(const ProvenanceEventRecordImpl &parent); static std::shared_ptr<core::logging::Logger> logger_; @@ -337,8 +335,6 @@ class ProvenanceReporterImpl : public virtual ProvenanceReporter { std::set<std::shared_ptr<ProvenanceEventRecord>> _events; std::shared_ptr<core::Repository> repo_; - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer ProvenanceReporterImpl(const ProvenanceReporterImpl &parent); ProvenanceReporterImpl &operator=(const ProvenanceReporterImpl &parent); }; diff --git a/libminifi/include/sitetosite/HTTPProtocol.h b/libminifi/include/sitetosite/HTTPProtocol.h index 769275870..342078d29 100644 --- a/libminifi/include/sitetosite/HTTPProtocol.h +++ b/libminifi/include/sitetosite/HTTPProtocol.h @@ -148,8 +148,7 @@ class HttpSiteToSiteClient : public sitetosite::SiteToSiteClient { private: sitetosite::RespondCode current_code; std::shared_ptr<core::logging::Logger> logger_ = core::logging::LoggerFactory<HttpSiteToSiteClient>::getLogger(); - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer + HttpSiteToSiteClient(const HttpSiteToSiteClient &parent); HttpSiteToSiteClient &operator=(const HttpSiteToSiteClient &parent); static std::shared_ptr<utils::IdGenerator> id_generator_; diff --git a/libminifi/include/sitetosite/RawSocketProtocol.h b/libminifi/include/sitetosite/RawSocketProtocol.h index 09baec688..2bee3b311 100644 --- a/libminifi/include/sitetosite/RawSocketProtocol.h +++ b/libminifi/include/sitetosite/RawSocketProtocol.h @@ -169,8 +169,6 @@ class RawSiteToSiteClient : public sitetosite::SiteToSiteClient { // commsIdentifier utils::Identifier _commsIdentifier; - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer RawSiteToSiteClient(const RawSiteToSiteClient &parent); RawSiteToSiteClient &operator=(const RawSiteToSiteClient &parent); static std::shared_ptr<utils::IdGenerator> id_generator_; diff --git a/libminifi/src/core/ProcessSession.cpp b/libminifi/src/core/ProcessSession.cpp index dbba6c462..0aa27752a 100644 --- a/libminifi/src/core/ProcessSession.cpp +++ b/libminifi/src/core/ProcessSession.cpp @@ -933,8 +933,8 @@ void ProcessSessionImpl::commit() { if (metrics_) { for (const auto& [relationship_name, transfer_metrics] : transfers) { - metrics_->transferred_bytes() += transfer_metrics.transfer_size; - metrics_->transferred_flow_files() += transfer_metrics.transfer_count; + metrics_->transferredBytes() += transfer_metrics.transfer_size; + metrics_->transferredFlowFiles() += transfer_metrics.transfer_count; metrics_->increaseRelationshipTransferCount(relationship_name, transfer_metrics.transfer_count); } } diff --git a/libminifi/test/flow-tests/FlowControllerTests.cpp b/libminifi/test/flow-tests/FlowControllerTests.cpp index abba35d2e..5771e41f7 100644 --- a/libminifi/test/flow-tests/FlowControllerTests.cpp +++ b/libminifi/test/flow-tests/FlowControllerTests.cpp @@ -110,6 +110,7 @@ TEST_CASE("Flow shutdown drains connections", "[TestFlow1]") { testController.configuration_->set(minifi::Configure::nifi_flowcontroller_drain_timeout, "100 ms"); auto sinkProc = dynamic_cast<minifi::processors::TestProcessor*>(root->findProcessorByName("TestProcessor")); + gsl_Assert(sinkProc); // prevent execution of the consumer processor sinkProc->yield(10s); diff --git a/libminifi/test/flow-tests/LoopTest.cpp b/libminifi/test/flow-tests/LoopTest.cpp index 48d62b5ca..e46aaa2f6 100644 --- a/libminifi/test/flow-tests/LoopTest.cpp +++ b/libminifi/test/flow-tests/LoopTest.cpp @@ -90,7 +90,9 @@ TEST_CASE("Flow with a single loop", "[SingleLoopFlow]") { auto root = testController.root_; auto procGenerator = dynamic_cast<org::apache::nifi::minifi::processors::TestFlowFileGenerator*>(root->findProcessorByName("Generator")); + gsl_Assert(procGenerator); auto procA = dynamic_cast<org::apache::nifi::minifi::processors::TestProcessor*>(root->findProcessorByName("A")); + gsl_Assert(procA); int tryCount = 0; // wait for the procA to get triggered 15 times diff --git a/libminifi/test/flow-tests/MultiLoopTest.cpp b/libminifi/test/flow-tests/MultiLoopTest.cpp index e11183dec..28aed161e 100644 --- a/libminifi/test/flow-tests/MultiLoopTest.cpp +++ b/libminifi/test/flow-tests/MultiLoopTest.cpp @@ -99,7 +99,9 @@ TEST_CASE("Flow with two loops", "[MultiLoopFlow]") { auto root = testController.root_; auto procGenerator = dynamic_cast<org::apache::nifi::minifi::processors::TestFlowFileGenerator*>(root->findProcessorByName("Generator")); + gsl_Assert(procGenerator); auto procA = dynamic_cast<org::apache::nifi::minifi::processors::TestProcessor*>(root->findProcessorByName("A")); + gsl_Assert(procA); int tryCount = 0; while (tryCount++ < 10 && procA->trigger_count.load() <= 15) { diff --git a/libminifi/test/schema-tests/SchemaTests.cpp b/libminifi/test/schema-tests/SchemaTests.cpp index a2700fe17..3a3f7dc58 100644 --- a/libminifi/test/schema-tests/SchemaTests.cpp +++ b/libminifi/test/schema-tests/SchemaTests.cpp @@ -132,7 +132,6 @@ TEST_CASE("The generated JSON schema matches a valid json flow") { } TEST_CASE("The JSON schema detects invalid values in the json flow") { - std::ofstream{"/Users/adebreceni/work/minifi-homes/json-schema-test/schema.json"} << minifi::docs::generateJsonSchema(); const nlohmann::json config_schema = nlohmann::json::parse(minifi::docs::generateJsonSchema()); nlohmann::json_schema::json_validator validator; diff --git a/minifi-api/include/minifi-cpp/core/FlowFile.h b/minifi-api/include/minifi-cpp/core/FlowFile.h index 9bdb5e734..2e20ad314 100644 --- a/minifi-api/include/minifi-cpp/core/FlowFile.h +++ b/minifi-api/include/minifi-cpp/core/FlowFile.h @@ -81,25 +81,15 @@ class FlowFile : public virtual CoreComponent, public virtual ReferenceContainer static std::shared_ptr<FlowFile> create(); }; -// FlowFile Attribute struct SpecialFlowAttribute { - // The flowfile's path indicates the relative directory to which a FlowFile belongs and does not contain the filename MINIFIAPI static constexpr std::string_view PATH = "path"; - // The flowfile's absolute path indicates the absolute directory to which a FlowFile belongs and does not contain the filename MINIFIAPI static constexpr std::string_view ABSOLUTE_PATH = "absolute.path"; - // The filename of the FlowFile. The filename should not contain any directory structure. MINIFIAPI static constexpr std::string_view FILENAME = "filename"; - // A unique UUID assigned to this FlowFile. MINIFIAPI static constexpr std::string_view UUID = "uuid"; - // A numeric value indicating the FlowFile priority MINIFIAPI static constexpr std::string_view priority = "priority"; - // The MIME Type of this FlowFile MINIFIAPI static constexpr std::string_view MIME_TYPE = "mime.type"; - // Specifies the reason that a FlowFile is being discarded MINIFIAPI static constexpr std::string_view DISCARD_REASON = "discard.reason"; - // Indicates an identifier other than the FlowFile's UUID that is known to refer to this FlowFile. MINIFIAPI static constexpr std::string_view ALTERNATE_IDENTIFIER = "alternate.identifier"; - // Flow identifier MINIFIAPI static constexpr std::string_view FLOW_ID = "flow.id"; static constexpr std::array<std::string_view, 9> getSpecialFlowAttributes() { diff --git a/minifi-api/include/minifi-cpp/core/ObjectFactory.h b/minifi-api/include/minifi-cpp/core/ObjectFactory.h index 9230a50c5..9f247b2a2 100644 --- a/minifi-api/include/minifi-cpp/core/ObjectFactory.h +++ b/minifi-api/include/minifi-cpp/core/ObjectFactory.h @@ -22,16 +22,8 @@ #include <utility> #include "Core.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { +namespace org::apache::nifi::minifi::core { -/** - * Factory that is used as an interface for - * creating processors from shared objects. - */ class ObjectFactory { public: virtual std::unique_ptr<CoreComponent> create(const std::string& /*name*/) = 0; @@ -44,8 +36,4 @@ class ObjectFactory { virtual ~ObjectFactory() = default; }; -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org +} // namespace org::apache::nifi::minifi::core diff --git a/minifi-api/include/minifi-cpp/core/ProcessContext.h b/minifi-api/include/minifi-cpp/core/ProcessContext.h index 70207fcbb..a7c302788 100644 --- a/minifi-api/include/minifi-cpp/core/ProcessContext.h +++ b/minifi-api/include/minifi-cpp/core/ProcessContext.h @@ -16,21 +16,14 @@ */ #pragma once -#include <algorithm> -#include <atomic> -#include <concepts> -#include <map> #include <memory> -#include <mutex> #include <optional> -#include <queue> #include <string> -#include <unordered_map> #include <vector> #include "minifi-cpp/core/Core.h" #include "minifi-cpp/core/ContentRepository.h" -#include "minifi-cpp/core/controller/ControllerServiceLookup.h" +#include "minifi-cpp/core/controller/ControllerService.h" #include "minifi-cpp/core/ProcessorNode.h" #include "minifi-cpp/core/Property.h" #include "minifi-cpp/core/Repository.h" diff --git a/minifi-api/include/minifi-cpp/core/ProcessContextBuilder.h b/minifi-api/include/minifi-cpp/core/ProcessContextBuilder.h index dee31da51..70adfc0c9 100644 --- a/minifi-api/include/minifi-cpp/core/ProcessContextBuilder.h +++ b/minifi-api/include/minifi-cpp/core/ProcessContextBuilder.h @@ -16,24 +16,14 @@ */ #pragma once -#include <string> -#include <vector> -#include <queue> -#include <map> -#include <mutex> -#include <atomic> -#include <algorithm> #include <memory> -#include "Property.h" #include "minifi-cpp/core/Core.h" -#include "utils/Id.h" #include "core/ContentRepository.h" #include "minifi-cpp/properties/Configure.h" #include "minifi-cpp/core/controller/ControllerServiceProvider.h" #include "ProcessContext.h" #include "ProcessorNode.h" #include "minifi-cpp/core/Repository.h" -#include "VariableRegistry.h" namespace org::apache::nifi::minifi::core { /** diff --git a/minifi-api/include/minifi-cpp/core/ProcessSession.h b/minifi-api/include/minifi-cpp/core/ProcessSession.h index 6bd971813..e19af3b18 100644 --- a/minifi-api/include/minifi-cpp/core/ProcessSession.h +++ b/minifi-api/include/minifi-cpp/core/ProcessSession.h @@ -19,23 +19,10 @@ #include <memory> #include <string> -#include <utility> #include <vector> -#include <queue> -#include <map> -#include <mutex> -#include <atomic> -#include <algorithm> -#include <set> -#include <unordered_map> -#include <unordered_set> - -#include "ProcessContext.h" -#include "core/logging/LoggerFactory.h" + #include "FlowFile.h" -#include "WeakReference.h" #include "minifi-cpp/provenance/Provenance.h" -#include "utils/gsl.h" #include "ProcessorMetrics.h" #include "minifi-cpp/io/StreamCallback.h" diff --git a/minifi-api/include/minifi-cpp/core/ProcessSessionFactory.h b/minifi-api/include/minifi-cpp/core/ProcessSessionFactory.h index d2ede7ceb..f12f547dc 100644 --- a/minifi-api/include/minifi-cpp/core/ProcessSessionFactory.h +++ b/minifi-api/include/minifi-cpp/core/ProcessSessionFactory.h @@ -22,24 +22,14 @@ #include <memory> -#include "ProcessContext.h" #include "ProcessSession.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { +namespace org::apache::nifi::minifi::core { -// ProcessSessionFactory Class class ProcessSessionFactory { public: virtual std::shared_ptr<ProcessSession> createSession() = 0; virtual ~ProcessSessionFactory() = default; }; -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org +} // namespace org::apache::nifi::minifi::core diff --git a/minifi-api/include/minifi-cpp/core/Processor.h b/minifi-api/include/minifi-cpp/core/Processor.h index 54bb8c0a3..092df1426 100644 --- a/minifi-api/include/minifi-cpp/core/Processor.h +++ b/minifi-api/include/minifi-cpp/core/Processor.h @@ -16,29 +16,17 @@ */ #pragma once -#include <utils/Id.h> - -#include <algorithm> -#include <atomic> #include <chrono> -#include <condition_variable> -#include <functional> #include <memory> #include <mutex> #include <string> -#include <string_view> #include <unordered_set> #include <unordered_map> -#include <utility> -#include <vector> #include "ConfigurableComponent.h" #include "Connectable.h" -#include "Core.h" #include "minifi-cpp/core/Annotation.h" -#include "DynamicProperty.h" #include "Scheduling.h" -#include "utils/TimeUtil.h" #include "minifi-cpp/core/state/nodes/MetricsBase.h" #include "ProcessorMetrics.h" #include "utils/gsl.h" diff --git a/minifi-api/include/minifi-cpp/core/ProcessorConfig.h b/minifi-api/include/minifi-cpp/core/ProcessorConfig.h index 04d3761d4..0a943ed1a 100644 --- a/minifi-api/include/minifi-cpp/core/ProcessorConfig.h +++ b/minifi-api/include/minifi-cpp/core/ProcessorConfig.h @@ -14,21 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_CORE_PROCESSORCONFIG_H_ -#define LIBMINIFI_INCLUDE_CORE_PROCESSORCONFIG_H_ +#pragma once +#include <chrono> #include <string> #include <vector> -#include "Core.h" #include "Property.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { - +namespace org::apache::nifi::minifi::core { constexpr const char* DEFAULT_SCHEDULING_STRATEGY{"TIMER_DRIVEN"}; constexpr const char* DEFAULT_SCHEDULING_PERIOD_STR{"1 sec"}; @@ -53,10 +47,4 @@ struct ProcessorConfig { std::string parameterContextName; }; -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org - -#endif // LIBMINIFI_INCLUDE_CORE_PROCESSORCONFIG_H_ +} // namespace org::apache::nifi::minifi::core diff --git a/minifi-api/include/minifi-cpp/core/ProcessorMetrics.h b/minifi-api/include/minifi-cpp/core/ProcessorMetrics.h index 8a61fd24e..5e4825731 100644 --- a/minifi-api/include/minifi-cpp/core/ProcessorMetrics.h +++ b/minifi-api/include/minifi-cpp/core/ProcessorMetrics.h @@ -19,12 +19,8 @@ #include <string> #include <chrono> #include <atomic> -#include <unordered_map> -#include <mutex> -#include <vector> #include "minifi-cpp/core/state/nodes/MetricsBase.h" -#include "minifi-cpp/core/state/PublishedMetricProvider.h" namespace org::apache::nifi::minifi::core { diff --git a/minifi-api/include/minifi-cpp/core/ProcessorNode.h b/minifi-api/include/minifi-cpp/core/ProcessorNode.h index f0a16d560..06d63f175 100644 --- a/minifi-api/include/minifi-cpp/core/ProcessorNode.h +++ b/minifi-api/include/minifi-cpp/core/ProcessorNode.h @@ -29,9 +29,6 @@ namespace org::apache::nifi::minifi::core { -/** - * Processor node functions as a pass through to the implementing Connectables - */ class ProcessorNode : public virtual ConfigurableComponent, public virtual Connectable { public: virtual Connectable* getProcessor() const = 0; diff --git a/minifi-api/include/minifi-cpp/core/Property.h b/minifi-api/include/minifi-cpp/core/Property.h index b840cb72a..8307747a3 100644 --- a/minifi-api/include/minifi-cpp/core/Property.h +++ b/minifi-api/include/minifi-cpp/core/Property.h @@ -120,14 +120,11 @@ class Property { void setAllowedValues(gsl::span<const std::string_view> allowed_values, const core::PropertyParser& property_parser); - /** - * Add value to the collection of values. - */ void addValue(const std::string &value); Property &operator=(const Property &other) = default; Property &operator=(Property &&other) = default; -// Compare - bool operator <(const Property & right) const; + + bool operator<(const Property & right) const; static bool StringToPermissions(const std::string& input, uint32_t& output) { uint32_t temp = 0U; @@ -169,7 +166,6 @@ class Property { return true; } - // Convert String to Integer template<typename T> static bool StringToInt(std::string input, T &output); @@ -177,7 +173,6 @@ class Property { return StringToInt<int64_t>(input, output); } -// Convert String to Integer static bool StringToInt(std::string input, uint64_t &output) { return StringToInt<uint64_t>(input, output); } @@ -186,15 +181,11 @@ class Property { return StringToInt<int32_t>(input, output); } -// Convert String to Integer static bool StringToInt(std::string input, uint32_t &output) { return StringToInt<uint32_t>(input, output); } protected: - /** - * Coerce default values at construction. - */ PropertyValue coerceDefaultValue(const std::string &value); std::string name_; diff --git a/minifi-api/include/minifi-cpp/core/Repository.h b/minifi-api/include/minifi-cpp/core/Repository.h index 763a0b4a0..9754d2324 100644 --- a/minifi-api/include/minifi-cpp/core/Repository.h +++ b/minifi-api/include/minifi-cpp/core/Repository.h @@ -19,33 +19,19 @@ */ #pragma once -#include <atomic> #include <cstdint> -#include <cstring> #include <map> #include <memory> -#include <set> #include <string> -#include <string_view> -#include <utility> #include <vector> -#include "minifi-cpp/ResourceClaim.h" #include "Connectable.h" #include "ContentRepository.h" -#include "Property.h" #include "SerializableComponent.h" -#include "core/logging/LoggerFactory.h" #include "RepositoryMetricsSource.h" #include "minifi-cpp/properties/Configure.h" -#include "utils/BackTrace.h" -#include "minifi-cpp/SwapManager.h" #include "core/Core.h" -#ifndef WIN32 -#include <sys/stat.h> -#endif - namespace org::apache::nifi::minifi::core { class Repository : public virtual core::CoreComponent, public virtual core::RepositoryMetricsSource { diff --git a/minifi-api/include/minifi-cpp/core/Scheduling.h b/minifi-api/include/minifi-cpp/core/Scheduling.h index 9a46b6cb7..34b68e9b8 100644 --- a/minifi-api/include/minifi-cpp/core/Scheduling.h +++ b/minifi-api/include/minifi-cpp/core/Scheduling.h @@ -15,14 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_CORE_SCHEDULING_H_ -#define LIBMINIFI_INCLUDE_CORE_SCHEDULING_H_ +#pragma once -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { +namespace org::apache::nifi::minifi::core { /* * Indicates the valid values for the state of a entity @@ -49,9 +44,4 @@ enum SchedulingStrategy { CRON_DRIVEN }; -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org -#endif // LIBMINIFI_INCLUDE_CORE_SCHEDULING_H_ +} // namespace org::apache::nifi::minifi::core diff --git a/minifi-api/include/minifi-cpp/core/WeakReference.h b/minifi-api/include/minifi-cpp/core/WeakReference.h index 3b5ecb402..70cda61a6 100644 --- a/minifi-api/include/minifi-cpp/core/WeakReference.h +++ b/minifi-api/include/minifi-cpp/core/WeakReference.h @@ -18,16 +18,10 @@ #pragma once +#include <cstdint> #include <memory> -#include <type_traits> -#include <vector> - -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { +namespace org::apache::nifi::minifi::core { /* * An homage to weak references in java, this acts as a class @@ -55,8 +49,4 @@ class ReferenceContainer { virtual void removeReferences() = 0; }; -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org +} // namespace org::apache::nifi::minifi::core diff --git a/minifi-api/include/minifi-cpp/core/controller/ControllerService.h b/minifi-api/include/minifi-cpp/core/controller/ControllerService.h index 471eaa3f9..326075716 100644 --- a/minifi-api/include/minifi-cpp/core/controller/ControllerService.h +++ b/minifi-api/include/minifi-cpp/core/controller/ControllerService.h @@ -23,28 +23,15 @@ #include <vector> #include "minifi-cpp/properties/Configure.h" -#include "minifi-cpp/core/Core.h" #include "minifi-cpp/core/ConfigurableComponent.h" #include "minifi-cpp/core/Connectable.h" namespace org::apache::nifi::minifi::core::controller { enum ControllerServiceState { - /** - * Controller Service is disabled and cannot be used. - */ DISABLED, - /** - * Controller Service is in the process of being disabled. - */ DISABLING, - /** - * Controller Service is being enabled. - */ ENABLING, - /** - * Controller Service is enabled. - */ ENABLED }; diff --git a/minifi-api/include/minifi-cpp/core/controller/ControllerServiceLookup.h b/minifi-api/include/minifi-cpp/core/controller/ControllerServiceLookup.h index 64ea9525e..89d13baa1 100644 --- a/minifi-api/include/minifi-cpp/core/controller/ControllerServiceLookup.h +++ b/minifi-api/include/minifi-cpp/core/controller/ControllerServiceLookup.h @@ -15,8 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_CORE_CONTROLLER_CONTROLLERSERVICELOOKUP_H_ -#define LIBMINIFI_INCLUDE_CORE_CONTROLLER_CONTROLLERSERVICELOOKUP_H_ +#pragma once #include <memory> #include <string> @@ -25,12 +24,7 @@ #include "minifi-cpp/core/ConfigurableComponent.h" #include "ControllerService.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace core { -namespace controller { +namespace org::apache::nifi::minifi::core::controller { /** * Controller Service Lookup pure virtual class. @@ -82,11 +76,4 @@ class ControllerServiceLookup { virtual const std::string getControllerServiceName(const std::string &identifier) const = 0; }; -} // namespace controller -} // namespace core -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org - -#endif // LIBMINIFI_INCLUDE_CORE_CONTROLLER_CONTROLLERSERVICELOOKUP_H_ +} // namespace org::apache::nifi::minifi::core::controller diff --git a/minifi-api/include/minifi-cpp/core/extension/ExtensionManager.h b/minifi-api/include/minifi-cpp/core/extension/ExtensionManager.h index 38a6e94ff..63936f1d7 100644 --- a/minifi-api/include/minifi-cpp/core/extension/ExtensionManager.h +++ b/minifi-api/include/minifi-cpp/core/extension/ExtensionManager.h @@ -17,10 +17,6 @@ #pragma once -#include <memory> -#include <string> -#include <vector> - #include "Extension.h" namespace org::apache::nifi::minifi::core::extension { diff --git a/minifi-api/include/minifi-cpp/core/state/FlowIdentifier.h b/minifi-api/include/minifi-cpp/core/state/FlowIdentifier.h index 6e61f789f..ebb7a9312 100644 --- a/minifi-api/include/minifi-cpp/core/state/FlowIdentifier.h +++ b/minifi-api/include/minifi-cpp/core/state/FlowIdentifier.h @@ -20,12 +20,7 @@ #include <string> - -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace state { +namespace org::apache::nifi::minifi::state { /** * Purpose: Represents a flow identifier for a given flow update or instance. @@ -41,8 +36,4 @@ class FlowIdentifier { }; -} // namespace state -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org +} // namespace org::apache::nifi::minifi::state diff --git a/minifi-api/include/minifi-cpp/core/state/nodes/MetricsBase.h b/minifi-api/include/minifi-cpp/core/state/nodes/MetricsBase.h index 21f20e850..08fccb249 100644 --- a/minifi-api/include/minifi-cpp/core/state/nodes/MetricsBase.h +++ b/minifi-api/include/minifi-cpp/core/state/nodes/MetricsBase.h @@ -22,7 +22,6 @@ #include <memory> #include <string> #include <optional> -#include <unordered_map> #include "../Value.h" #include "../PublishedMetricProvider.h" @@ -34,9 +33,6 @@ namespace org::apache::nifi::minifi::state::response { class ResponseNode; using SharedResponseNode = gsl::not_null<std::shared_ptr<ResponseNode>>; -/** - * Purpose: Defines a metric. Serialization is intended to be thread safe. - */ class ResponseNode : public virtual core::Connectable, public virtual PublishedMetricProvider { public: ~ResponseNode() override = default; @@ -48,10 +44,6 @@ class ResponseNode : public virtual core::Connectable, public virtual PublishedM virtual bool isEmpty() = 0; }; -/** - * Purpose: Retrieves Metrics from the defined class. The current Metric, which is a consumable for any reader of Metrics must have the ability to set metrics. - * - */ class ResponseNodeSource { public: virtual ~ResponseNodeSource() = default; @@ -70,23 +62,10 @@ class NodeReporter { virtual ~NodeReporter() = default; - /** - * Retrieves metrics node - * @return metrics response node - */ virtual std::optional<ReportedNode> getMetricsNode(const std::string& metricsClass) const = 0; - /** - * Retrieves root nodes configured to be included in heartbeat - * @param includeManifest -- determines if manifest is to be included - * @return a list of response nodes - */ virtual std::vector<ReportedNode> getHeartbeatNodes(bool includeManifest) const = 0; - /** - * Retrieves the agent manifest to be sent as a response to C2 DESCRIBE manifest - * @return the agent manifest response node - */ virtual ReportedNode getAgentManifest() = 0; }; diff --git a/minifi-api/include/minifi-cpp/core/state/nodes/ResponseNodeLoader.h b/minifi-api/include/minifi-cpp/core/state/nodes/ResponseNodeLoader.h index ee35b10b1..c887cb018 100644 --- a/minifi-api/include/minifi-cpp/core/state/nodes/ResponseNodeLoader.h +++ b/minifi-api/include/minifi-cpp/core/state/nodes/ResponseNodeLoader.h @@ -17,12 +17,7 @@ */ #pragma once -#include <unordered_map> -#include <map> #include <string> -#include <memory> -#include <mutex> -#include <functional> #include <vector> #include "MetricsBase.h" diff --git a/minifi-api/include/minifi-cpp/utils/AnyRef.h b/minifi-api/include/minifi-cpp/utils/AnyRef.h deleted file mode 100644 index 05b06ffb4..000000000 --- a/minifi-api/include/minifi-cpp/utils/AnyRef.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -namespace org::apache::nifi::minifi::utils { - -class AnyRef { - class Base { - - }; - public: - -}; - -} // namespace org::apache::nifi::minifi::utils diff --git a/minifi-api/include/minifi-cpp/utils/TimeUtil.h b/minifi-api/include/minifi-cpp/utils/TimeUtil.h index aa1665711..6969261e6 100644 --- a/minifi-api/include/minifi-cpp/utils/TimeUtil.h +++ b/minifi-api/include/minifi-cpp/utils/TimeUtil.h @@ -22,9 +22,6 @@ namespace org::apache::nifi::minifi::utils::timeutils { -/** - * Mockable clock classes - */ class Clock { public: virtual ~Clock() = default; diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 138aaec3e..6a763a556 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -13,7 +13,6 @@ file(GLOB SOURCES add_minifi_library(minifi-utils STATIC ${SOURCES}) target_include_directories(minifi-utils PUBLIC include) -#target_link_libraries(minifi-utils PUBLIC minifi-core magic_enum gsl-lite range-v3 expected-lite spdlog) target_link_libraries(minifi-utils PUBLIC minifi-core ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite libsodium range-v3 expected-lite date::date date::tz asio magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON) if(NOT WIN32) target_link_libraries(minifi-utils PUBLIC OSSP::libuuid++) diff --git a/utils/include/core/ContentRepository.h b/utils/include/core/ContentRepository.h index 81122eaaa..ab9d97533 100644 --- a/utils/include/core/ContentRepository.h +++ b/utils/include/core/ContentRepository.h @@ -33,9 +33,6 @@ namespace org::apache::nifi::minifi::core { -/** - * Content repository definition that extends StreamManager. - */ class ContentRepositoryImpl : public CoreComponentImpl, public StreamManagerImpl<minifi::ResourceClaim>, public RepositoryMetricsSourceImpl, public virtual ContentRepository { class ContentStreamAppendLock : public StreamAppendLock { public: @@ -50,8 +47,6 @@ class ContentRepositoryImpl : public CoreComponentImpl, public StreamManagerImpl explicit ContentRepositoryImpl(std::string_view name, const utils::Identifier& uuid = {}) : core::CoreComponentImpl(name, uuid) {} ~ContentRepositoryImpl() override = default; - bool initialize(const std::shared_ptr<Configure> &configure) override = 0; - std::string getStoragePath() const override; std::shared_ptr<ContentSession> createSession() override; void reset() override; @@ -60,8 +55,6 @@ class ContentRepositoryImpl : public CoreComponentImpl, public StreamManagerImpl void incrementStreamCount(const minifi::ResourceClaim &streamId) override; StreamState decrementStreamCount(const minifi::ResourceClaim &streamId) override; - void clearOrphans() override = 0; - void start() override {} void stop() override {} diff --git a/utils/include/core/Core.h b/utils/include/core/Core.h index 85038ab4e..ddbd58fb3 100644 --- a/utils/include/core/Core.h +++ b/utils/include/core/Core.h @@ -99,30 +99,14 @@ class CoreComponentImpl : public virtual CoreComponent { ~CoreComponentImpl() override = default; - // Get component name [[nodiscard]] std::string getName() const override; - /** - * Set name. - * @param name - */ void setName(std::string name) override; - /** - * Set UUID in this instance - * @param uuid uuid to apply to the internal representation. - */ void setUUID(const utils::Identifier& uuid) override; - /** - * Returns the UUID. - * @return the uuid of the component - */ [[nodiscard]] utils::Identifier getUUID() const override; - /** - * Return the UUID string - */ [[nodiscard]] utils::SmallString<36> getUUIDStr() const override { return uuid_.to_string(); } @@ -133,8 +117,6 @@ class CoreComponentImpl : public virtual CoreComponent { protected: // A global unique identifier utils::Identifier uuid_; - - // CoreComponent's name std::string name_; }; diff --git a/utils/include/core/ProcessContext.h b/utils/include/core/ProcessContext.h index d935e8b58..5ed76c432 100644 --- a/utils/include/core/ProcessContext.h +++ b/utils/include/core/ProcessContext.h @@ -48,9 +48,6 @@ namespace org::apache::nifi::minifi::core { class ProcessContextImpl : public core::VariableRegistryImpl, public virtual ProcessContext { public: - /*! - * Create a new process context associated with the processor/controller service/state manager - */ ProcessContextImpl(const std::shared_ptr<ProcessorNode> &processor, controller::ControllerServiceProvider* controller_service_provider, const std::shared_ptr<core::Repository> &repo, const std::shared_ptr<core::Repository> &flow_repo, const std::shared_ptr<core::ContentRepository> &content_repo = repository::createFileSystemRepository()) : VariableRegistryImpl(Configure::create()), @@ -65,9 +62,6 @@ class ProcessContextImpl : public core::VariableRegistryImpl, public virtual Pro state_storage_ = getStateStorage(logger_, controller_service_provider_, nullptr); } - /*! - * Create a new process context associated with the processor/controller service/state manager - */ ProcessContextImpl(const std::shared_ptr<ProcessorNode> &processor, controller::ControllerServiceProvider* controller_service_provider, const std::shared_ptr<core::Repository> &repo, const std::shared_ptr<core::Repository> &flow_repo, const std::shared_ptr<minifi::Configure> &configuration, const std::shared_ptr<core::ContentRepository> &content_repo = repository::createFileSystemRepository()) : VariableRegistryImpl(configuration), @@ -114,29 +108,24 @@ class ProcessContextImpl : public core::VariableRegistryImpl, public virtual Pro std::vector<std::string> getDynamicPropertyKeys() const override { return processor_node_->getDynamicPropertyKeys(); } - // Sets the property value using the property's string name bool setProperty(const std::string &name, std::string value) override { return processor_node_->setProperty(name, value); - } // Sets the dynamic property value using the property's string name + } bool setDynamicProperty(const std::string &name, std::string value) override { return processor_node_->setDynamicProperty(name, value); } - // Sets the property value using the Property object bool setProperty(const Property& property, std::string value) override { return setProperty(property.getName(), value); } bool setProperty(const PropertyReference& property, std::string_view value) override { return setProperty(std::string{property.name}, std::string{value}); } - // Check whether the relationship is auto terminated bool isAutoTerminated(Relationship relationship) const override { return processor_node_->isAutoTerminated(relationship); } - // Get ProcessContext Maximum Concurrent Tasks uint8_t getMaxConcurrentTasks() const override { return processor_node_->getMaxConcurrentTasks(); } - // Yield based on the yield period void yield() override { processor_node_->yield(); } @@ -145,10 +134,6 @@ class ProcessContextImpl : public core::VariableRegistryImpl, public virtual Pro return repo_; } - /** - * Returns a reference to the content repository for the running instance. - * @return content repository shared pointer. - */ std::shared_ptr<core::ContentRepository> getContentRepository() const override { return content_repo_; } @@ -157,8 +142,6 @@ class ProcessContextImpl : public core::VariableRegistryImpl, public virtual Pro return flow_repo_; } - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer ProcessContextImpl(const ProcessContextImpl &parent) = delete; ProcessContextImpl &operator=(const ProcessContextImpl &parent) = delete; diff --git a/utils/include/core/Repository.h b/utils/include/core/Repository.h index 1dd8acaa3..b5f25a0e2 100644 --- a/utils/include/core/Repository.h +++ b/utils/include/core/Repository.h @@ -123,8 +123,6 @@ class RepositoryImpl : public core::CoreComponentImpl, public core::RepositoryMe return getName(); } - // Prevent default copy constructor and assignment operation - // Only support pass by reference or pointer RepositoryImpl(const RepositoryImpl &parent) = delete; RepositoryImpl &operator=(const RepositoryImpl &parent) = delete; diff --git a/utils/include/io/BaseStream.h b/utils/include/io/BaseStream.h index fa11305fa..99b62d159 100644 --- a/utils/include/io/BaseStream.h +++ b/utils/include/io/BaseStream.h @@ -18,10 +18,6 @@ #pragma once -#include <string> -#include <vector> -#include <iostream> -#include <cstdint> #include "InputStream.h" #include "OutputStream.h" #include "minifi-cpp/io/BaseStream.h" diff --git a/utils/include/utils/MinifiConcurrentQueue.h b/utils/include/utils/MinifiConcurrentQueue.h index 1db58080b..490cc601a 100644 --- a/utils/include/utils/MinifiConcurrentQueue.h +++ b/utils/include/utils/MinifiConcurrentQueue.h @@ -14,9 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef LIBMINIFI_INCLUDE_UTILS_MINIFICONCURRENTQUEUE_H_ -#define LIBMINIFI_INCLUDE_UTILS_MINIFICONCURRENTQUEUE_H_ - +#pragma once #include <algorithm> #include <chrono> @@ -29,11 +27,7 @@ #include "utils/TryMoveCall.h" -namespace org { -namespace apache { -namespace nifi { -namespace minifi { -namespace utils { +namespace org::apache::nifi::minifi::utils { // Provides a queue API and guarantees no race conditions in case of multiple producers and consumers. // Guarantees elements to be dequeued in order of insertion @@ -242,10 +236,4 @@ class ConditionConcurrentQueue : private ConcurrentQueue<T> { std::condition_variable cv_; }; -} // namespace utils -} // namespace minifi -} // namespace nifi -} // namespace apache -} // namespace org - -#endif // LIBMINIFI_INCLUDE_UTILS_MINIFICONCURRENTQUEUE_H_ +} // namespace org::apache::nifi::minifi::utils diff --git a/utils/src/core/Core.cpp b/utils/src/core/Core.cpp index a42b315b9..66920bba5 100644 --- a/utils/src/core/Core.cpp +++ b/utils/src/core/Core.cpp @@ -25,28 +25,24 @@ namespace org::apache::nifi::minifi::core { CoreComponentImpl::CoreComponentImpl(std::string_view name, const utils::Identifier& uuid, const std::shared_ptr<utils::IdGenerator>& idGenerator) : name_(name) { if (uuid.isNil()) { - // Generate the global UUID for the flow record uuid_ = idGenerator->generate(); } else { uuid_ = uuid; } } -// Set UUID void CoreComponentImpl::setUUID(const utils::Identifier& uuid) { uuid_ = uuid; } -// Get UUID utils::Identifier CoreComponentImpl::getUUID() const { return uuid_; } -// Set Processor Name void CoreComponentImpl::setName(std::string name) { name_ = std::move(name); } -// Get Process Name + std::string CoreComponentImpl::getName() const { return name_; }
