Skip to content

Commit 27ac6d1

Browse files
committed
Review fixes
1 parent f10b4bf commit 27ac6d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+56
-445
lines changed

extensions/rocksdb-repos/ProvenanceRepository.h

-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ class ProvenanceRepository : public core::repository::RocksDbRepository {
7676

7777
void destroy();
7878

79-
// Prevent default copy constructor and assignment operation
80-
// Only support pass by reference or pointer
8179
ProvenanceRepository(const ProvenanceRepository &parent) = delete;
8280

8381
ProvenanceRepository &operator=(const ProvenanceRepository &parent) = delete;

libminifi/include/ResourceClaim.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ class ResourceClaimImpl : public ResourceClaim {
9090
private:
9191
// Logger
9292
std::shared_ptr<core::logging::Logger> logger_;
93-
// Prevent default copy constructor and assignment operation
94-
// Only support pass by reference or pointer
93+
9594
ResourceClaimImpl(const ResourceClaimImpl &parent);
9695
ResourceClaimImpl &operator=(const ResourceClaimImpl &parent);
9796

libminifi/include/core/ProcessGroup.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ class ProcessGroup : public CoreComponentImpl {
268268
mutable std::recursive_mutex mutex_;
269269
// Logger
270270
std::shared_ptr<logging::Logger> logger_;
271-
// Prevent default copy constructor and assignment operation
272-
// Only support pass by reference or pointer
271+
273272
ProcessGroup(const ProcessGroup &parent);
274273
ProcessGroup &operator=(const ProcessGroup &parent);
275274
static std::shared_ptr<utils::IdGenerator> id_generator_;

libminifi/include/core/ProcessSession.h

+12-42
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,20 @@ std::string to_string(const ReadBufferResult& read_buffer_result);
4949

5050
namespace org::apache::nifi::minifi::core {
5151

52-
// ProcessSession Class
5352
class ProcessSessionImpl : public ReferenceContainerImpl, public virtual ProcessSession {
5453
public:
55-
// Constructor
56-
/*!
57-
* Create a new process session
58-
*/
5954
explicit ProcessSessionImpl(std::shared_ptr<ProcessContext> processContext);
6055

61-
// Destructor
6256
~ProcessSessionImpl() override;
63-
64-
// Commit the session
6557
void commit() override;
66-
// Roll Back the session
6758
void rollback() override;
6859

6960
nonstd::expected<void, std::exception_ptr> rollbackNoThrow() noexcept override;
70-
// Get Provenance Report
61+
7162
std::shared_ptr<provenance::ProvenanceReporter> getProvenanceReporter() override {
7263
return provenance_report_;
7364
}
74-
// writes the created contents to the underlying repository
65+
7566
void flushContent() override;
7667

7768
std::shared_ptr<core::FlowFile> get() override;
@@ -80,65 +71,52 @@ class ProcessSessionImpl : public ReferenceContainerImpl, public virtual Process
8071
void add(const std::shared_ptr<core::FlowFile> &record) override;
8172
std::shared_ptr<core::FlowFile> clone(const core::FlowFile& parent) override;
8273
std::shared_ptr<core::FlowFile> clone(const core::FlowFile& parent, int64_t offset, int64_t size) override;
83-
// Transfer the FlowFile to the relationship
74+
8475
void transfer(const std::shared_ptr<core::FlowFile>& flow, const Relationship& relationship) override;
8576
void transferToCustomRelationship(const std::shared_ptr<core::FlowFile>& flow, const std::string& relationship_name) override;
8677

8778
void putAttribute(core::FlowFile& flow, std::string_view key, const std::string& value) override;
8879
void removeAttribute(core::FlowFile& flow, std::string_view key) override;
8980

9081
void remove(const std::shared_ptr<core::FlowFile> &flow) override;
91-
// Access the contents of the flow file as an input stream; returns null if the flow file has no content claim
82+
9283
std::shared_ptr<io::InputStream> getFlowFileContentStream(const core::FlowFile& flow_file) override;
93-
// Execute the given read callback against the content
84+
9485
int64_t read(const std::shared_ptr<core::FlowFile>& flow_file, const io::InputStreamCallback& callback) override;
9586

9687
int64_t read(const core::FlowFile& flow_file, const io::InputStreamCallback& callback) override;
97-
// Read content into buffer
88+
9889
detail::ReadBufferResult readBuffer(const std::shared_ptr<core::FlowFile>& flow) override;
99-
// Execute the given write callback against the content
90+
10091
void write(const std::shared_ptr<core::FlowFile> &flow, const io::OutputStreamCallback& callback) override;
10192

10293
void write(core::FlowFile& flow, const io::OutputStreamCallback& callback) override;
10394
// Read and write the flow file at the same time (eg. for processing it line by line)
10495
int64_t readWrite(const std::shared_ptr<core::FlowFile> &flow, const io::InputOutputStreamCallback& callback) override;
105-
// Replace content with buffer
96+
10697
void writeBuffer(const std::shared_ptr<core::FlowFile>& flow_file, std::span<const char> buffer) override;
10798
void writeBuffer(const std::shared_ptr<core::FlowFile>& flow_file, std::span<const std::byte> buffer) override;
108-
// Execute the given write/append callback against the content
99+
109100
void append(const std::shared_ptr<core::FlowFile> &flow, const io::OutputStreamCallback& callback) override;
110-
// Append buffer to content
101+
111102
void appendBuffer(const std::shared_ptr<core::FlowFile>& flow, std::span<const char> buffer) override;
112103
void appendBuffer(const std::shared_ptr<core::FlowFile>& flow, std::span<const std::byte> buffer) override;
113-
// Penalize the flow
104+
114105
void penalize(const std::shared_ptr<core::FlowFile> &flow) override;
115106

116107
bool outgoingConnectionsFull(const std::string& relationship) override;
117108

118-
/**
119-
* Imports a file from the data stream
120-
* @param stream incoming data stream that contains the data to store into a file
121-
* @param flow flow file
122-
*/
123109
void importFrom(io::InputStream &stream, const std::shared_ptr<core::FlowFile> &flow) override;
124110
void importFrom(io::InputStream&& stream, const std::shared_ptr<core::FlowFile> &flow) override;
125111

126-
// import from the data source.
127112
void import(const std::string& source, const std::shared_ptr<core::FlowFile> &flow, bool keepSource = true, uint64_t offset = 0) override;
128113

129-
/**
130-
* Exports the data stream to a file
131-
* @param string file to export stream to
132-
* @param flow flow file
133-
* @param bool whether or not to keep the content in the flow file
134-
*/
135114
bool exportContent(const std::string &destination, const std::shared_ptr<core::FlowFile> &flow, bool keepContent) override;
136115

137116
bool exportContent(const std::string &destination, const std::string &tmpFileName, const std::shared_ptr<core::FlowFile> &flow, bool keepContent) override;
138117

139-
// Stash the content to a key
140118
void stash(const std::string &key, const std::shared_ptr<core::FlowFile> &flow) override;
141-
// Restore content previously stashed to a key
119+
142120
void restore(const std::string &key, const std::shared_ptr<core::FlowFile> &flow) override;
143121

144122
bool existsFlowFileInRelationship(const Relationship &relationship) override;
@@ -149,8 +127,6 @@ class ProcessSessionImpl : public ReferenceContainerImpl, public virtual Process
149127

150128
bool hasBeenTransferred(const core::FlowFile &flow) const override;
151129

152-
// Prevent default copy constructor and assignment operation
153-
// Only support pass by reference or pointer
154130
ProcessSessionImpl(const ProcessSessionImpl &parent) = delete;
155131
ProcessSessionImpl &operator=(const ProcessSessionImpl &parent) = delete;
156132

@@ -202,17 +178,11 @@ class ProcessSessionImpl : public ReferenceContainerImpl, public virtual Process
202178
void ensureNonNullResourceClaim(
203179
const std::map<Connectable*, std::vector<std::shared_ptr<core::FlowFile>>>& transactionMap);
204180

205-
// Clone the flow file during transfer to multiple connections for a relationship
206181
std::shared_ptr<core::FlowFile> cloneDuringTransfer(const core::FlowFile& parent);
207-
// ProcessContext
208182
std::shared_ptr<ProcessContext> process_context_;
209-
// Logger
210183
std::shared_ptr<logging::Logger> logger_;
211-
// Provenance Report
212184
std::shared_ptr<provenance::ProvenanceReporter> provenance_report_;
213-
214185
std::shared_ptr<ContentSession> content_session_;
215-
216186
StateManager* stateManager_;
217187

218188
static std::shared_ptr<utils::IdGenerator> id_generator_;

libminifi/include/core/ProcessSessionFactory.h

+2-19
Original file line numberDiff line numberDiff line change
@@ -25,40 +25,23 @@
2525
#include "ProcessSession.h"
2626
#include "minifi-cpp/core/ProcessSessionFactory.h"
2727

28-
namespace org {
29-
namespace apache {
30-
namespace nifi {
31-
namespace minifi {
32-
namespace core {
28+
namespace org::apache::nifi::minifi::core {
3329

34-
// ProcessSessionFactory Class
3530
class ProcessSessionFactoryImpl : public virtual ProcessSessionFactory {
3631
public:
37-
// Constructor
38-
/*!
39-
* Create a new process session factory
40-
*/
4132
explicit ProcessSessionFactoryImpl(std::shared_ptr<ProcessContext> processContext)
4233
: process_context_(processContext) {
4334
}
4435

45-
// Create the session
4636
std::shared_ptr<ProcessSession> createSession() override;
4737

48-
// Prevent default copy constructor and assignment operation
49-
// Only support pass by reference or pointer
5038
ProcessSessionFactoryImpl(const ProcessSessionFactoryImpl &parent) = delete;
5139
ProcessSessionFactoryImpl &operator=(const ProcessSessionFactoryImpl &parent) = delete;
5240

5341
~ProcessSessionFactoryImpl() override = default;
5442

5543
private:
56-
// ProcessContext
5744
std::shared_ptr<ProcessContext> process_context_;
5845
};
5946

60-
} // namespace core
61-
} // namespace minifi
62-
} // namespace nifi
63-
} // namespace apache
64-
} // namespace org
47+
} // namespace org::apache::nifi::minifi::core

libminifi/include/core/WeakReference.h

+2-10
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@
2525

2626
#include "minifi-cpp/core/WeakReference.h"
2727

28-
namespace org {
29-
namespace apache {
30-
namespace nifi {
31-
namespace minifi {
32-
namespace core {
28+
namespace org::apache::nifi::minifi::core {
3329

3430
/**
3531
* Reference container is a vector of weak references that enables
@@ -69,8 +65,4 @@ class ReferenceContainerImpl : public virtual ReferenceContainer {
6965
std::vector<std::shared_ptr<WeakReference> > references;
7066
};
7167

72-
} // namespace core
73-
} // namespace minifi
74-
} // namespace nifi
75-
} // namespace apache
76-
} // namespace org
68+
} // namespace org::apache::nifi::minifi::core

libminifi/include/core/controller/ControllerServiceNode.h

-8
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ namespace org::apache::nifi::minifi::core::controller {
3737

3838
class ControllerServiceNodeImpl : public CoreComponentImpl, public ConfigurableComponentImpl, public virtual ControllerServiceNode {
3939
public:
40-
/**
41-
* Constructor for the controller service node.
42-
* @param service controller service reference
43-
* @param id identifier for this node.
44-
* @param configuration shared pointer configuration.
45-
*/
4640
explicit ControllerServiceNodeImpl(std::shared_ptr<ControllerService> service, std::string id, std::shared_ptr<Configure> configuration)
4741
: CoreComponentImpl(std::move(id)),
4842
active(false),
@@ -105,9 +99,7 @@ class ControllerServiceNodeImpl : public CoreComponentImpl, public ConfigurableC
10599

106100
std::atomic<bool> active;
107101
std::shared_ptr<Configure> configuration_;
108-
// controller service.
109102
std::shared_ptr<ControllerService> controller_service_;
110-
// linked controller services.
111103
std::vector<ControllerServiceNode*> linked_controller_services_;
112104
};
113105

libminifi/include/core/state/FlowIdentifier.h

+2-13
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
#include "minifi-cpp/core/state/FlowIdentifier.h"
2222

2323

24-
namespace org {
25-
namespace apache {
26-
namespace nifi {
27-
namespace minifi {
28-
namespace state {
24+
namespace org::apache::nifi::minifi::state {
2925

3026
/**
3127
* Purpose: Represents a flow identifier for a given flow update or instance.
@@ -36,9 +32,6 @@ class FlowIdentifierImpl : public virtual FlowIdentifier {
3632
public:
3733
FlowIdentifierImpl() = delete;
3834

39-
/**
40-
* Constructor accepts the url, bucket id, and flow id.
41-
*/
4235
explicit FlowIdentifierImpl(const std::string &url, const std::string &bucket_id, const std::string &flow_id) {
4336
registry_url_ = url;
4437
bucket_id_ = bucket_id;
@@ -74,8 +67,4 @@ class FlowIdentifierImpl : public virtual FlowIdentifier {
7467
};
7568

7669

77-
} // namespace state
78-
} // namespace minifi
79-
} // namespace nifi
80-
} // namespace apache
81-
} // namespace org
70+
} // namespace org::apache::nifi::minifi::state

libminifi/include/core/state/nodes/MetricsBase.h

-6
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333

3434
namespace org::apache::nifi::minifi::state::response {
3535

36-
/**
37-
* Purpose: Defines a metric that
38-
*/
3936
class DeviceInformation : public ResponseNodeImpl {
4037
public:
4138
DeviceInformation(std::string_view name, const utils::Identifier& uuid)
@@ -47,9 +44,6 @@ class DeviceInformation : public ResponseNodeImpl {
4744
}
4845
};
4946

50-
/**
51-
* Purpose: Defines a metric that
52-
*/
5347
class ObjectNode : public ResponseNodeImpl {
5448
public:
5549
explicit ObjectNode(const std::string_view name, const utils::Identifier& uuid = {})

libminifi/include/properties/Properties.h

-4
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ class PropertiesImpl : public virtual Properties {
4949
return name_;
5050
}
5151

52-
// Clear the load config
5352
void clear() override {
5453
std::lock_guard<std::mutex> lock(mutex_);
5554
properties_.clear();
5655
}
5756
void set(const std::string& key, const std::string& value) override {
5857
set(key, value, PropertyChangeLifetime::PERSISTENT);
5958
}
60-
// Set the config value
6159
void set(const std::string &key, const std::string &value, PropertyChangeLifetime lifetime) override {
6260
auto active_value = utils::string::replaceEnvironmentVariables(value);
6361
std::lock_guard<std::mutex> lock(mutex_);
@@ -78,7 +76,6 @@ class PropertiesImpl : public virtual Properties {
7876
dirty_ = true;
7977
}
8078
}
81-
// Check whether the config value existed
8279
bool has(const std::string& key) const override {
8380
std::lock_guard<std::mutex> lock(mutex_);
8481
return properties_.count(key) > 0;
@@ -148,7 +145,6 @@ class PropertiesImpl : public virtual Properties {
148145

149146
// Mutex for protection
150147
mutable std::mutex mutex_;
151-
// Logger
152148
std::shared_ptr<core::logging::Logger> logger_;
153149
// Home location for this executable
154150
std::filesystem::path minifi_home_;

libminifi/include/provenance/Provenance.h

-4
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,6 @@ class ProvenanceEventRecordImpl : public core::SerializableComponentImpl, public
264264
std::string _alternateIdentifierUri;
265265

266266
private:
267-
// Prevent default copy constructor and assignment operation
268-
// Only support pass by reference or pointer
269267
ProvenanceEventRecordImpl(const ProvenanceEventRecordImpl &parent);
270268
ProvenanceEventRecordImpl &operator=(const ProvenanceEventRecordImpl &parent);
271269
static std::shared_ptr<core::logging::Logger> logger_;
@@ -337,8 +335,6 @@ class ProvenanceReporterImpl : public virtual ProvenanceReporter {
337335
std::set<std::shared_ptr<ProvenanceEventRecord>> _events;
338336
std::shared_ptr<core::Repository> repo_;
339337

340-
// Prevent default copy constructor and assignment operation
341-
// Only support pass by reference or pointer
342338
ProvenanceReporterImpl(const ProvenanceReporterImpl &parent);
343339
ProvenanceReporterImpl &operator=(const ProvenanceReporterImpl &parent);
344340
};

libminifi/include/sitetosite/HTTPProtocol.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ class HttpSiteToSiteClient : public sitetosite::SiteToSiteClient {
148148
private:
149149
sitetosite::RespondCode current_code;
150150
std::shared_ptr<core::logging::Logger> logger_ = core::logging::LoggerFactory<HttpSiteToSiteClient>::getLogger();
151-
// Prevent default copy constructor and assignment operation
152-
// Only support pass by reference or pointer
151+
153152
HttpSiteToSiteClient(const HttpSiteToSiteClient &parent);
154153
HttpSiteToSiteClient &operator=(const HttpSiteToSiteClient &parent);
155154
static std::shared_ptr<utils::IdGenerator> id_generator_;

libminifi/include/sitetosite/RawSocketProtocol.h

-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ class RawSiteToSiteClient : public sitetosite::SiteToSiteClient {
169169
// commsIdentifier
170170
utils::Identifier _commsIdentifier;
171171

172-
// Prevent default copy constructor and assignment operation
173-
// Only support pass by reference or pointer
174172
RawSiteToSiteClient(const RawSiteToSiteClient &parent);
175173
RawSiteToSiteClient &operator=(const RawSiteToSiteClient &parent);
176174
static std::shared_ptr<utils::IdGenerator> id_generator_;

libminifi/src/core/ProcessSession.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -933,8 +933,8 @@ void ProcessSessionImpl::commit() {
933933

934934
if (metrics_) {
935935
for (const auto& [relationship_name, transfer_metrics] : transfers) {
936-
metrics_->transferred_bytes() += transfer_metrics.transfer_size;
937-
metrics_->transferred_flow_files() += transfer_metrics.transfer_count;
936+
metrics_->transferredBytes() += transfer_metrics.transfer_size;
937+
metrics_->transferredFlowFiles() += transfer_metrics.transfer_count;
938938
metrics_->increaseRelationshipTransferCount(relationship_name, transfer_metrics.transfer_count);
939939
}
940940
}

libminifi/test/flow-tests/FlowControllerTests.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ TEST_CASE("Flow shutdown drains connections", "[TestFlow1]") {
110110
testController.configuration_->set(minifi::Configure::nifi_flowcontroller_drain_timeout, "100 ms");
111111

112112
auto sinkProc = dynamic_cast<minifi::processors::TestProcessor*>(root->findProcessorByName("TestProcessor"));
113+
gsl_Assert(sinkProc);
113114
// prevent execution of the consumer processor
114115
sinkProc->yield(10s);
115116

0 commit comments

Comments
 (0)