Skip to content

Commit

Permalink
Review update
Browse files Browse the repository at this point in the history
  • Loading branch information
lordgamez committed Oct 30, 2024
1 parent bffd76b commit 1830a11
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const char* TEST_ATTR = "ExtractedText";

TEST_CASE("Test creation of ExtractText", "[extracttextCreate]") {
TestController testController;
auto processor = std::make_shared<org::apache::nifi::minifi::processors::ExtractText>("processorname");
auto processor = std::make_unique<org::apache::nifi::minifi::processors::ExtractText>("processorname");
REQUIRE(processor->getName() == "processorname");
utils::Identifier processoruuid = processor->getUUID();
REQUIRE(processoruuid);
Expand Down
3 changes: 2 additions & 1 deletion libminifi/include/core/controller/ControllerServiceLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class ControllerServiceLookup {
virtual ~ControllerServiceLookup() = default;

/**
* Gets the controller service via the provided identifier.
* Gets the controller service via the provided identifier. This overload returns the controller service in a global scope from all
* available controller services in the flow.
* @param identifier reference string for controller service.
* @return controller service reference.
*/
Expand Down
4 changes: 3 additions & 1 deletion libminifi/include/core/controller/ControllerServiceNodeMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ControllerServiceNodeMap {
ControllerServiceNodeMap& operator=(ControllerServiceNodeMap&&) = delete;

ControllerServiceNode* get(const std::string &id) const;
ControllerServiceNode* get(const std::string &id, const utils::Identifier &processor_uuid) const;
ControllerServiceNode* get(const std::string &id, const utils::Identifier &processor_or_controller_uuid) const;

bool put(const std::string &id, const std::shared_ptr<ControllerServiceNode> &serviceNode);
bool put(const std::string &id, ProcessGroup* process_group);
Expand All @@ -51,7 +51,9 @@ class ControllerServiceNodeMap {

protected:
mutable std::mutex mutex_;
// Map of controller service id to the controller service node
std::map<std::string, std::shared_ptr<ControllerServiceNode>> controller_service_nodes_;
// Map of controller service id to the process group that contains it
std::map<std::string, gsl::not_null<ProcessGroup*>> process_groups_;
};

Expand Down
4 changes: 2 additions & 2 deletions libminifi/src/core/ProcessGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ void ProcessGroup::addProcessGroup(std::unique_ptr<ProcessGroup> child) {
void ProcessGroup::startProcessingProcessors(TimerDrivenSchedulingAgent& timeScheduler,
EventDrivenSchedulingAgent& eventScheduler, CronDrivenSchedulingAgent& cronScheduler) {

std::set<Processor*> processors_to_schedule;
std::vector<Processor*> processors_to_schedule;
{
std::unique_lock<std::recursive_mutex> lock(mutex_);
for (const auto& processor : failed_processors_) {
processors_to_schedule.insert(processor);
processors_to_schedule.push_back(processor);
}
}

Expand Down
6 changes: 3 additions & 3 deletions libminifi/src/core/controller/ControllerServiceNodeMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ControllerServiceNode* ControllerServiceNodeMap::get(const std::string &id) cons
return nullptr;
}

ControllerServiceNode* ControllerServiceNodeMap::get(const std::string &id, const utils::Identifier& processor_uuid) const {
ControllerServiceNode* ControllerServiceNodeMap::get(const std::string &id, const utils::Identifier& processor_or_controller_uuid) const {
std::lock_guard<std::mutex> lock(mutex_);
ControllerServiceNode* controller = nullptr;
auto exists = controller_service_nodes_.find(id);
Expand All @@ -48,11 +48,11 @@ ControllerServiceNode* ControllerServiceNodeMap::get(const std::string &id, cons
return nullptr;
}

if (process_group->findProcessorById(processor_uuid)) {
if (process_group->findProcessorById(processor_or_controller_uuid, ProcessGroup::Traverse::IncludeChildren)) {
return controller;
}

if (process_group->findControllerService(processor_uuid.to_string(), ProcessGroup::Traverse::IncludeChildren)) {
if (process_group->findControllerService(processor_or_controller_uuid.to_string(), ProcessGroup::Traverse::IncludeChildren)) {
return controller;
}

Expand Down

0 comments on commit 1830a11

Please sign in to comment.