You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2017/06/06 16:33:11 UTC
[8/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Property.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Property.h b/libminifi/include/core/Property.h
index fd940c5..278e2ec 100644
--- a/libminifi/include/core/Property.h
+++ b/libminifi/include/core/Property.h
@@ -56,8 +56,7 @@ class Property {
/*!
* Create a new property
*/
- Property(const std::string name, const std::string description,
- const std::string value)
+ Property(const std::string name, const std::string description, const std::string value)
: name_(name),
isCollection(false),
description_(description) {
@@ -144,8 +143,7 @@ class Property {
}
}
// Convert String
- static bool StringToTime(std::string input, int64_t &output,
- TimeUnit &timeunit) {
+ static bool StringToTime(std::string input, int64_t &output, TimeUnit &timeunit) {
if (input.size() == 0) {
return false;
}
@@ -165,28 +163,23 @@ class Property {
std::string unit(pEnd);
- if (unit == "sec" || unit == "s" || unit == "second" || unit == "seconds"
- || unit == "secs") {
+ if (unit == "sec" || unit == "s" || unit == "second" || unit == "seconds" || unit == "secs") {
timeunit = SECOND;
output = ival;
return true;
- } else if (unit == "min" || unit == "m" || unit == "mins"
- || unit == "minute" || unit == "minutes") {
+ } else if (unit == "min" || unit == "m" || unit == "mins" || unit == "minute" || unit == "minutes") {
timeunit = MINUTE;
output = ival;
return true;
- } else if (unit == "ns" || unit == "nano" || unit == "nanos"
- || unit == "nanoseconds") {
+ } else if (unit == "ns" || unit == "nano" || unit == "nanos" || unit == "nanoseconds") {
timeunit = NANOSECOND;
output = ival;
return true;
- } else if (unit == "ms" || unit == "milli" || unit == "millis"
- || unit == "milliseconds") {
+ } else if (unit == "ms" || unit == "milli" || unit == "millis" || unit == "milliseconds") {
timeunit = MILLISECOND;
output = ival;
return true;
- } else if (unit == "h" || unit == "hr" || unit == "hour" || unit == "hrs"
- || unit == "hours") {
+ } else if (unit == "h" || unit == "hr" || unit == "hour" || unit == "hrs" || unit == "hours") {
timeunit = HOUR;
output = ival;
return true;
@@ -219,8 +212,7 @@ class Property {
}
char end0 = toupper(pEnd[0]);
- if ((end0 == 'K') || (end0 == 'M') || (end0 == 'G') || (end0 == 'T')
- || (end0 == 'P')) {
+ if ((end0 == 'K') || (end0 == 'M') || (end0 == 'G') || (end0 == 'T') || (end0 == 'P')) {
if (pEnd[1] == '\0') {
unsigned long int multiplier = 1000;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Repository.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Repository.h b/libminifi/include/core/Repository.h
index debdc01..5f7e6c2 100644
--- a/libminifi/include/core/Repository.h
+++ b/libminifi/include/core/Repository.h
@@ -57,10 +57,8 @@ class Repository : public CoreComponent {
/*
* Constructor for the repository
*/
- Repository(std::string repo_name="Repository",
- std::string directory = REPOSITORY_DIRECTORY,
- int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME,
- int64_t maxPartitionBytes = MAX_REPOSITORY_STORAGE_SIZE,
+ Repository(std::string repo_name = "Repository", std::string directory = REPOSITORY_DIRECTORY, int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME, int64_t maxPartitionBytes =
+ MAX_REPOSITORY_STORAGE_SIZE,
uint64_t purgePeriod = REPOSITORY_PURGE_PERIOD)
: CoreComponent(repo_name),
thread_(),
@@ -111,8 +109,7 @@ class Repository : public CoreComponent {
virtual bool isRunning() {
return running_;
}
- uint64_t incrementSize(const char *fpath, const struct stat *sb,
- int typeflag) {
+ uint64_t incrementSize(const char *fpath, const struct stat *sb, int typeflag) {
return (repo_size_ += sb->st_size);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/RepositoryFactory.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/RepositoryFactory.h b/libminifi/include/core/RepositoryFactory.h
index db474a0..9fafb57 100644
--- a/libminifi/include/core/RepositoryFactory.h
+++ b/libminifi/include/core/RepositoryFactory.h
@@ -30,8 +30,7 @@ namespace minifi {
namespace core {
-std::shared_ptr<core::Repository> createRepository(
- const std::string configuration_class_name, bool fail_safe = false,const std::string repo_name = "");
+std::shared_ptr<core::Repository> createRepository(const std::string configuration_class_name, bool fail_safe = false, const std::string repo_name = "");
} /* namespace core */
} /* namespace minifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Resource.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Resource.h b/libminifi/include/core/Resource.h
index 8f110a1..1787843 100644
--- a/libminifi/include/core/Resource.h
+++ b/libminifi/include/core/Resource.h
@@ -32,8 +32,7 @@ class StaticClassType {
StaticClassType(const std::string &name) {
// Notify when the static member is created
- ClassLoader::getDefaultClassLoader().registerClass(
- name, std::unique_ptr<ObjectFactory>(new DefautObjectFactory<T>()));
+ ClassLoader::getDefaultClassLoader().registerClass(name, std::unique_ptr<ObjectFactory>(new DefautObjectFactory<T>()));
}
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceLookup.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceLookup.h b/libminifi/include/core/controller/ControllerServiceLookup.h
index 6f23e34..31dfa21 100644
--- a/libminifi/include/core/controller/ControllerServiceLookup.h
+++ b/libminifi/include/core/controller/ControllerServiceLookup.h
@@ -53,8 +53,7 @@ class ControllerServiceLookup {
* @param identifier reference string for controller service.
* @return controller service reference.
*/
- virtual std::shared_ptr<ControllerService> getControllerService(
- const std::string &identifier) = 0;
+ virtual std::shared_ptr<ControllerService> getControllerService(const std::string &identifier) = 0;
/**
* Detects if controller service is enabled.
@@ -74,8 +73,7 @@ class ControllerServiceLookup {
* Gets the controller service name for the provided reference identifier
* @param identifier reference string for the controller service.
*/
- virtual const std::string getControllerServiceName(
- const std::string &identifier) = 0;
+ virtual const std::string getControllerServiceName(const std::string &identifier) = 0;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceMap.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceMap.h b/libminifi/include/core/controller/ControllerServiceMap.h
index f1cc2cf..b5e3599 100644
--- a/libminifi/include/core/controller/ControllerServiceMap.h
+++ b/libminifi/include/core/controller/ControllerServiceMap.h
@@ -51,8 +51,7 @@ class ControllerServiceMap {
* @param id identifier for controller service.
* @return nullptr if node does not exist or controller service node shared pointer.
*/
- virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(
- const std::string &id) {
+ virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(const std::string &id) {
std::lock_guard<std::mutex> lock(mutex_);
auto exists = controller_services_.find(id);
if (exists != controller_services_.end())
@@ -66,8 +65,7 @@ class ControllerServiceMap {
* @param serviceNode service node to remove
*
*/
- virtual bool removeControllerService(
- const std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ virtual bool removeControllerService(const std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (IsNullOrEmpty(serviceNode.get()))
return false;
std::lock_guard<std::mutex> lock(mutex_);
@@ -82,8 +80,7 @@ class ControllerServiceMap {
* @param serviceNode controller service node shared pointer.
*
*/
- virtual bool put(const std::string &id,
- const std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ virtual bool put(const std::string &id, const std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (IsNullOrEmpty(id) || IsNullOrEmpty(serviceNode.get()))
return false;
std::lock_guard<std::mutex> lock(mutex_);
@@ -98,8 +95,7 @@ class ControllerServiceMap {
*/
std::vector<std::shared_ptr<ControllerServiceNode>> getAllControllerServices() {
std::lock_guard<std::mutex> lock(mutex_);
- return std::vector<std::shared_ptr<ControllerServiceNode>>(
- controller_services_list_.begin(), controller_services_list_.end());
+ return std::vector<std::shared_ptr<ControllerServiceNode>>(controller_services_list_.begin(), controller_services_list_.end());
}
ControllerServiceMap(const ControllerServiceMap &other) = delete;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceNode.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceNode.h b/libminifi/include/core/controller/ControllerServiceNode.h
index 54015be..8f30e4e 100644
--- a/libminifi/include/core/controller/ControllerServiceNode.h
+++ b/libminifi/include/core/controller/ControllerServiceNode.h
@@ -42,8 +42,7 @@ class ControllerServiceNode : public CoreComponent, public ConfigurableComponent
* @param id identifier for this node.
* @param configuration shared pointer configuration.
*/
- explicit ControllerServiceNode(std::shared_ptr<ControllerService> service,
- const std::string &id, std::shared_ptr<Configure> configuration)
+ explicit ControllerServiceNode(std::shared_ptr<ControllerService> service, const std::string &id, std::shared_ptr<Configure> configuration)
: CoreComponent(id),
ConfigurableComponent(),
controller_service_(service),
@@ -53,8 +52,7 @@ class ControllerServiceNode : public CoreComponent, public ConfigurableComponent
throw Exception(GENERAL_EXCEPTION, "Service must be properly configured");
}
if (IsNullOrEmpty(configuration)) {
- throw Exception(GENERAL_EXCEPTION,
- "Configuration must be properly configured");
+ throw Exception(GENERAL_EXCEPTION, "Configuration must be properly configured");
}
service->setConfiguration(configuration);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceProvider.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceProvider.h b/libminifi/include/core/controller/ControllerServiceProvider.h
index 978352b..148f970 100644
--- a/libminifi/include/core/controller/ControllerServiceProvider.h
+++ b/libminifi/include/core/controller/ControllerServiceProvider.h
@@ -33,8 +33,7 @@ namespace minifi {
namespace core {
namespace controller {
-class ControllerServiceProvider : public CoreComponent,
- public ConfigurableComponent, public ControllerServiceLookup {
+class ControllerServiceProvider : public CoreComponent, public ConfigurableComponent, public ControllerServiceLookup {
public:
explicit ControllerServiceProvider(const std::string &name)
@@ -43,15 +42,13 @@ class ControllerServiceProvider : public CoreComponent,
controller_map_ = std::make_shared<ControllerServiceMap>();
}
- explicit ControllerServiceProvider(
- std::shared_ptr<ControllerServiceMap> services)
+ explicit ControllerServiceProvider(std::shared_ptr<ControllerServiceMap> services)
: CoreComponent(core::getClassName<ControllerServiceProvider>()),
ConfigurableComponent(),
controller_map_(services) {
}
- explicit ControllerServiceProvider(
- const std::string &name, std::shared_ptr<ControllerServiceMap> services)
+ explicit ControllerServiceProvider(const std::string &name, std::shared_ptr<ControllerServiceMap> services)
: CoreComponent(name),
ConfigurableComponent(),
controller_map_(services) {
@@ -73,9 +70,8 @@ class ControllerServiceProvider : public CoreComponent,
* @param id controller service identifier.
* @return shared pointer to the controller service node.
*/
- virtual std::shared_ptr<ControllerServiceNode> createControllerService(
- const std::string &type, const std::string &id,
- bool firstTimeAdded) = 0;
+ virtual std::shared_ptr<ControllerServiceNode> createControllerService(const std::string &type, const std::string &id,
+ bool firstTimeAdded) = 0;
/**
* Gets a controller service node wrapping the controller service
*
@@ -83,8 +79,7 @@ class ControllerServiceProvider : public CoreComponent,
* @param id controller service identifier.
* @return shared pointer to the controller service node.
*/
- virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(
- const std::string &id) {
+ virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(const std::string &id) {
return controller_map_->getControllerServiceNode(id);
}
@@ -92,8 +87,7 @@ class ControllerServiceProvider : public CoreComponent,
* Removes a controller service.
* @param serviceNode controller service node.
*/
- virtual void removeControllerService(
- const std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ virtual void removeControllerService(const std::shared_ptr<ControllerServiceNode> &serviceNode) {
controller_map_->removeControllerService(serviceNode);
}
@@ -101,22 +95,19 @@ class ControllerServiceProvider : public CoreComponent,
* Enables the provided controller service
* @param serviceNode controller service node.
*/
- virtual void enableControllerService(
- std::shared_ptr<ControllerServiceNode> &serviceNode) = 0;
+ virtual void enableControllerService(std::shared_ptr<ControllerServiceNode> &serviceNode) = 0;
/**
* Enables the provided controller service nodes
* @param serviceNode controller service node.
*/
- virtual void enableControllerServices(
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes) = 0;
+ virtual void enableControllerServices(std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes) = 0;
/**
* Disables the provided controller service node
* @param serviceNode controller service node.
*/
- virtual void disableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual void disableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Gets a list of all controller services.
@@ -128,28 +119,24 @@ class ControllerServiceProvider : public CoreComponent,
/**
* Verifies that referencing components can be stopped for the controller service
*/
- virtual void verifyCanStopReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual void verifyCanStopReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Unschedules referencing components.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Verifies referencing components for <code>serviceNode</code> can be disabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual void verifyCanDisableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual void verifyCanDisableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Disables referencing components for <code>serviceNode</code> can be disabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
return std::vector<std::shared_ptr<core::controller::ControllerServiceNode>>();
}
@@ -157,10 +144,8 @@ class ControllerServiceProvider : public CoreComponent,
* Verifies referencing components for <code>serviceNode</code> can be enabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual void verifyCanEnableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ virtual void verifyCanEnableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
ref->canEnable();
}
@@ -170,24 +155,20 @@ class ControllerServiceProvider : public CoreComponent,
* Enables referencing components for <code>serviceNode</code> can be Enabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Schedules the service node and referencing components.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Returns a controller service for the service identifier and componentID
* @param service Identifier service identifier.
*/
- virtual std::shared_ptr<ControllerService> getControllerServiceForComponent(
- const std::string &serviceIdentifier, const std::string &componentId) {
- std::shared_ptr<ControllerService> node = getControllerService(
- serviceIdentifier);
+ virtual std::shared_ptr<ControllerService> getControllerServiceForComponent(const std::string &serviceIdentifier, const std::string &componentId) {
+ std::shared_ptr<ControllerService> node = getControllerService(serviceIdentifier);
return node;
}
@@ -195,16 +176,14 @@ class ControllerServiceProvider : public CoreComponent,
* Gets the controller service for the provided identifier
* @param identifier service identifier.
*/
- virtual std::shared_ptr<ControllerService> getControllerService(
- const std::string &identifier);
+ virtual std::shared_ptr<ControllerService> getControllerService(const std::string &identifier);
/**
* Determines if Controller service is enabled.
* @param identifier service identifier.
*/
virtual bool isControllerServiceEnabled(const std::string &identifier) {
- std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(
- identifier);
+ std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(identifier);
if (nullptr != node) {
return linkedServicesAre(ENABLED, node);
} else
@@ -216,16 +195,14 @@ class ControllerServiceProvider : public CoreComponent,
* @param identifier service identifier.
*/
virtual bool isControllerServiceEnabling(const std::string &identifier) {
- std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(
- identifier);
+ std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(identifier);
if (nullptr != node) {
return linkedServicesAre(ENABLING, node);
} else
return false;
}
- virtual const std::string getControllerServiceName(
- const std::string &identifier) {
+ virtual const std::string getControllerServiceName(const std::string &identifier) {
std::shared_ptr<ControllerService> node = getControllerService(identifier);
if (nullptr != node) {
return node->getName();
@@ -240,13 +217,10 @@ class ControllerServiceProvider : public CoreComponent,
/**
* verifies that linked services match the provided state.
*/
- inline bool linkedServicesAre(
- ControllerServiceState state,
- const std::shared_ptr<ControllerServiceNode> &node) {
+ inline bool linkedServicesAre(ControllerServiceState state, const std::shared_ptr<ControllerServiceNode> &node) {
if (node->getControllerServiceImplementation()->getState() == state) {
for (auto child_service : node->getLinkedControllerServices()) {
- if (child_service->getControllerServiceImplementation()->getState()
- != state) {
+ if (child_service->getControllerServiceImplementation()->getState() != state) {
return false;
}
}
@@ -264,30 +238,22 @@ class ControllerServiceProvider : public CoreComponent,
* Finds linked components
* @param referenceNode reference node from whcih we will find linked references.
*/
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> findLinkedComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &referenceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> findLinkedComponents(std::shared_ptr<core::controller::ControllerServiceNode> &referenceNode) {
std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references;
- for (std::shared_ptr<core::controller::ControllerServiceNode> linked_node : referenceNode
- ->getLinkedControllerServices()) {
+ for (std::shared_ptr<core::controller::ControllerServiceNode> linked_node : referenceNode->getLinkedControllerServices()) {
references.push_back(linked_node);
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> linked_references =
- findLinkedComponents(linked_node);
-
- auto removal_predicate =
- [&linked_references](std::shared_ptr<core::controller::ControllerServiceNode> key) ->bool
- {
- return std::find(linked_references.begin(), linked_references.end(), key) != linked_references.end();
- };
-
- references.erase(
- std::remove_if(references.begin(), references.end(),
- removal_predicate),
- references.end());
-
- references.insert(std::end(references), linked_references.begin(),
- linked_references.end());
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> linked_references = findLinkedComponents(linked_node);
+
+ auto removal_predicate = [&linked_references](std::shared_ptr<core::controller::ControllerServiceNode> key) ->bool
+ {
+ return std::find(linked_references.begin(), linked_references.end(), key) != linked_references.end();
+ };
+
+ references.erase(std::remove_if(references.begin(), references.end(), removal_predicate), references.end());
+
+ references.insert(std::end(references), linked_references.begin(), linked_references.end());
}
return references;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/StandardControllerServiceNode.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/StandardControllerServiceNode.h b/libminifi/include/core/controller/StandardControllerServiceNode.h
index 563c0f5..8e0b238 100644
--- a/libminifi/include/core/controller/StandardControllerServiceNode.h
+++ b/libminifi/include/core/controller/StandardControllerServiceNode.h
@@ -33,18 +33,14 @@ namespace controller {
class StandardControllerServiceNode : public ControllerServiceNode {
public:
- explicit StandardControllerServiceNode(
- std::shared_ptr<ControllerService> service,
- std::shared_ptr<ControllerServiceProvider> provider,
- const std::string &id, std::shared_ptr<Configure> configuration)
+ explicit StandardControllerServiceNode(std::shared_ptr<ControllerService> service, std::shared_ptr<ControllerServiceProvider> provider, const std::string &id,
+ std::shared_ptr<Configure> configuration)
: ControllerServiceNode(service, id, configuration),
provider(provider),
logger_(logging::LoggerFactory<StandardControllerServiceNode>::getLogger()) {
}
- explicit StandardControllerServiceNode(
- std::shared_ptr<ControllerService> service, const std::string &id,
- std::shared_ptr<Configure> configuration)
+ explicit StandardControllerServiceNode(std::shared_ptr<ControllerService> service, const std::string &id, std::shared_ptr<Configure> configuration)
: ControllerServiceNode(service, id, configuration),
provider(nullptr),
logger_(logging::LoggerFactory<StandardControllerServiceNode>::getLogger()) {
@@ -55,8 +51,7 @@ class StandardControllerServiceNode : public ControllerServiceNode {
void setProcessGroup(std::shared_ptr<ProcessGroup> &processGroup);
StandardControllerServiceNode(const StandardControllerServiceNode &other) = delete;
- StandardControllerServiceNode &operator=(
- const StandardControllerServiceNode &parent) = delete;
+ StandardControllerServiceNode &operator=(const StandardControllerServiceNode &parent) = delete;
/**
* Initializes the controller service node.
@@ -98,7 +93,7 @@ class StandardControllerServiceNode : public ControllerServiceNode {
std::mutex mutex_;
private:
- std::shared_ptr<logging::Logger> logger_;
+ std::shared_ptr<logging::Logger> logger_;
};
} /* namespace controller */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/StandardControllerServiceProvider.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/StandardControllerServiceProvider.h b/libminifi/include/core/controller/StandardControllerServiceProvider.h
index 1e94ab7..f474ed2 100644
--- a/libminifi/include/core/controller/StandardControllerServiceProvider.h
+++ b/libminifi/include/core/controller/StandardControllerServiceProvider.h
@@ -38,15 +38,12 @@ namespace minifi {
namespace core {
namespace controller {
-class StandardControllerServiceProvider : public ControllerServiceProvider,
- public std::enable_shared_from_this<StandardControllerServiceProvider> {
+class StandardControllerServiceProvider : public ControllerServiceProvider, public std::enable_shared_from_this<StandardControllerServiceProvider> {
public:
- explicit StandardControllerServiceProvider(
- std::shared_ptr<ControllerServiceMap> services,
- std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration,
- std::shared_ptr<minifi::SchedulingAgent> agent, ClassLoader &loader =
- ClassLoader::getDefaultClassLoader())
+ explicit StandardControllerServiceProvider(std::shared_ptr<ControllerServiceMap> services, std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration,
+ std::shared_ptr<minifi::SchedulingAgent> agent,
+ ClassLoader &loader = ClassLoader::getDefaultClassLoader())
: ControllerServiceProvider(services),
root_group_(root_group),
agent_(agent),
@@ -55,10 +52,8 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
logger_(logging::LoggerFactory<StandardControllerServiceProvider>::getLogger()) {
}
- explicit StandardControllerServiceProvider(
- std::shared_ptr<ControllerServiceMap> services,
- std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration,
- ClassLoader &loader = ClassLoader::getDefaultClassLoader())
+ explicit StandardControllerServiceProvider(std::shared_ptr<ControllerServiceMap> services, std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration, ClassLoader &loader =
+ ClassLoader::getDefaultClassLoader())
: ControllerServiceProvider(services),
root_group_(root_group),
agent_(0),
@@ -67,8 +62,7 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
logger_(logging::LoggerFactory<StandardControllerServiceProvider>::getLogger()) {
}
- explicit StandardControllerServiceProvider(
- const StandardControllerServiceProvider && other)
+ explicit StandardControllerServiceProvider(const StandardControllerServiceProvider && other)
: ControllerServiceProvider(std::move(other)),
root_group_(std::move(other.root_group_)),
agent_(std::move(other.agent_)),
@@ -86,40 +80,33 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
agent_ = agent;
}
- std::shared_ptr<ControllerServiceNode> createControllerService(
- const std::string &type, const std::string &id,
- bool firstTimeAdded) {
+ std::shared_ptr<ControllerServiceNode> createControllerService(const std::string &type, const std::string &id,
+ bool firstTimeAdded) {
- std::shared_ptr<ControllerService> new_controller_service =
- extension_loader_.instantiate<ControllerService>(type, id);
+ std::shared_ptr<ControllerService> new_controller_service = extension_loader_.instantiate<ControllerService>(type, id);
if (nullptr == new_controller_service) {
return nullptr;
}
- std::shared_ptr<ControllerServiceNode> new_service_node = std::make_shared<
- StandardControllerServiceNode>(
- new_controller_service,
- std::static_pointer_cast<ControllerServiceProvider>(shared_from_this()),
- id, configuration_);
+ std::shared_ptr<ControllerServiceNode> new_service_node = std::make_shared<StandardControllerServiceNode>(new_controller_service,
+ std::static_pointer_cast<ControllerServiceProvider>(shared_from_this()),
+ id,
+ configuration_);
controller_map_->put(id, new_service_node);
return new_service_node;
}
-
- void enableControllerService(
- std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ void enableControllerService(std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (serviceNode->canEnable()) {
agent_->enableControllerService(serviceNode);
}
}
-
virtual void enableAllControllerServices() {
- logger_->log_info("Enabling %d controller services",
- controller_map_->getAllControllerServices().size());
+ logger_->log_info("Enabling %d controller services", controller_map_->getAllControllerServices().size());
for (auto service : controller_map_->getAllControllerServices()) {
if (service->canEnable()) {
@@ -131,43 +118,31 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
}
}
-
- void enableControllerServices(
- std::vector<std::shared_ptr<ControllerServiceNode>> serviceNodes) {
+ void enableControllerServices(std::vector<std::shared_ptr<ControllerServiceNode>> serviceNodes) {
for (auto node : serviceNodes) {
enableControllerService(node);
}
}
-
- void disableControllerService(
- std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ void disableControllerService(std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (!IsNullOrEmpty(serviceNode.get()) && serviceNode->enabled()) {
agent_->disableControllerService(serviceNode);
}
}
-
- void verifyCanStopReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ void verifyCanStopReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
}
-
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->disableControllerService(ref);
}
return references;
}
-
- void verifyCanDisableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ void verifyCanDisableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
if (!ref->canEnable()) {
logger_->log_info("Cannot disable %s", ref->getName());
@@ -175,11 +150,8 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
}
}
-
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->disableControllerService(ref);
}
@@ -187,20 +159,16 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
return references;
}
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->enableControllerService(ref);
}
return references;
}
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->enableControllerService(ref);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/logging/Logger.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/logging/Logger.h b/libminifi/include/core/logging/Logger.h
index 6b71763..8b80006 100644
--- a/libminifi/include/core/logging/Logger.h
+++ b/libminifi/include/core/logging/Logger.h
@@ -64,9 +64,9 @@ class Logger {
*/
template<typename ... Args>
void log_error(const char * const format, const Args& ... args) {
- log(spdlog::level::err, format, args...);
+ log(spdlog::level::err, format, args...);
}
-
+
/**
* @brief Log warn message
* @param format format string ('man printf' for syntax)
@@ -74,9 +74,9 @@ class Logger {
*/
template<typename ... Args>
void log_warn(const char * const format, const Args& ... args) {
- log(spdlog::level::warn, format, args...);
+ log(spdlog::level::warn, format, args...);
}
-
+
/**
* @brief Log info message
* @param format format string ('man printf' for syntax)
@@ -84,9 +84,9 @@ class Logger {
*/
template<typename ... Args>
void log_info(const char * const format, const Args& ... args) {
- log(spdlog::level::info, format, args...);
+ log(spdlog::level::info, format, args...);
}
-
+
/**
* @brief Log debug message
* @param format format string ('man printf' for syntax)
@@ -94,9 +94,9 @@ class Logger {
*/
template<typename ... Args>
void log_debug(const char * const format, const Args& ... args) {
- log(spdlog::level::debug, format, args...);
+ log(spdlog::level::debug, format, args...);
}
-
+
/**
* @brief Log trace message
* @param format format string ('man printf' for syntax)
@@ -104,25 +104,27 @@ class Logger {
*/
template<typename ... Args>
void log_trace(const char * const format, const Args& ... args) {
- log(spdlog::level::trace, format, args...);
+ log(spdlog::level::trace, format, args...);
}
-
+
protected:
- Logger(std::shared_ptr<spdlog::logger> delegate) : delegate_(delegate) {}
-
+ Logger(std::shared_ptr<spdlog::logger> delegate)
+ : delegate_(delegate) {
+ }
+
std::shared_ptr<spdlog::logger> delegate_;
std::mutex mutex_;
- private:
+ private:
template<typename ... Args>
inline void log(spdlog::level::level_enum level, const char * const format, const Args& ... args) {
- std::lock_guard<std::mutex> lock(mutex_);
- if (!delegate_->should_log(level)) {
- return;
- }
- delegate_->log(level, format_string(format, conditional_conversion(args)...));
+ std::lock_guard<std::mutex> lock(mutex_);
+ if (!delegate_->should_log(level)) {
+ return;
+ }
+ delegate_->log(level, format_string(format, conditional_conversion(args)...));
}
-
+
Logger(Logger const&);
Logger& operator=(Logger const&);
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/logging/LoggerConfiguration.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/logging/LoggerConfiguration.h b/libminifi/include/core/logging/LoggerConfiguration.h
index 53f1403..99d318b 100644
--- a/libminifi/include/core/logging/LoggerConfiguration.h
+++ b/libminifi/include/core/logging/LoggerConfiguration.h
@@ -38,15 +38,21 @@ namespace core {
namespace logging {
namespace internal {
- struct LoggerNamespace {
- spdlog::level::level_enum level;
- bool has_level;
- std::vector<std::shared_ptr<spdlog::sinks::sink>> sinks;
- std::map<std::string, std::shared_ptr<LoggerNamespace>> children;
-
- LoggerNamespace() : level(spdlog::level::off), has_level(false), sinks(std::vector<std::shared_ptr<spdlog::sinks::sink>>()), children(std::map<std::string, std::shared_ptr<LoggerNamespace>>()) {}
- };
+struct LoggerNamespace {
+ spdlog::level::level_enum level;
+ bool has_level;
+ std::vector<std::shared_ptr<spdlog::sinks::sink>> sinks;
+ std::map<std::string, std::shared_ptr<LoggerNamespace>> children;
+
+ LoggerNamespace()
+ : level(spdlog::level::off),
+ has_level(false),
+ sinks(std::vector<std::shared_ptr<spdlog::sinks::sink>>()),
+ children(std::map<std::string, std::shared_ptr<LoggerNamespace>>()) {
+ }
};
+}
+;
class LoggerProperties : public Properties {
public:
@@ -62,15 +68,15 @@ class LoggerProperties : public Properties {
* Registers a sink witht the given name. This allows for programmatic definition of sinks.
*/
void add_sink(const std::string &name, std::shared_ptr<spdlog::sinks::sink> sink) {
- sinks_[name] = sink;
+ sinks_[name] = sink;
}
std::map<std::string, std::shared_ptr<spdlog::sinks::sink>> initial_sinks() {
- return sinks_;
+ return sinks_;
}
static const char* appender_prefix;
static const char* logger_prefix;
- private:
+ private:
std::map<std::string, std::shared_ptr<spdlog::sinks::sink>> sinks_;
};
@@ -80,8 +86,8 @@ class LoggerConfiguration {
* Gets the current log configuration
*/
static LoggerConfiguration& getConfiguration() {
- static LoggerConfiguration logger_configuration;
- return logger_configuration;
+ static LoggerConfiguration logger_configuration;
+ return logger_configuration;
}
/**
@@ -94,20 +100,25 @@ class LoggerConfiguration {
*/
std::shared_ptr<Logger> getLogger(const std::string &name);
static const char *spdlog_default_pattern;
- protected:
- static std::shared_ptr<internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<LoggerProperties> &logger_properties);
- static std::shared_ptr<spdlog::logger> get_logger(std::shared_ptr<Logger> logger, const std::shared_ptr<internal::LoggerNamespace> &root_namespace, const std::string &name, std::shared_ptr<spdlog::formatter> formatter, bool remove_if_present = false);
- private:
+ protected:
+ static std::shared_ptr<internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<LoggerProperties> &logger_properties);
+ static std::shared_ptr<spdlog::logger> get_logger(std::shared_ptr<Logger> logger, const std::shared_ptr<internal::LoggerNamespace> &root_namespace, const std::string &name,
+ std::shared_ptr<spdlog::formatter> formatter,
+ bool remove_if_present = false);
+ private:
static std::shared_ptr<internal::LoggerNamespace> create_default_root();
class LoggerImpl : public Logger {
- public:
- LoggerImpl(std::string name, std::shared_ptr<spdlog::logger> delegate):Logger(delegate), name(name) {}
- void set_delegate(std::shared_ptr<spdlog::logger> delegate) {
- std::lock_guard<std::mutex> lock(mutex_);
- delegate_ = delegate;
- }
- const std::string name;
+ public:
+ LoggerImpl(std::string name, std::shared_ptr<spdlog::logger> delegate)
+ : Logger(delegate),
+ name(name) {
+ }
+ void set_delegate(std::shared_ptr<spdlog::logger> delegate) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ delegate_ = delegate;
+ }
+ const std::string name;
};
LoggerConfiguration();
@@ -125,8 +136,8 @@ class LoggerFactory {
* Gets an initialized logger for the template class.
*/
static std::shared_ptr<Logger> getLogger() {
- static std::shared_ptr<Logger> logger = LoggerConfiguration::getConfiguration().getLogger(core::getClassName<T>());
- return logger;
+ static std::shared_ptr<Logger> logger = LoggerConfiguration::getConfiguration().getLogger(core::getClassName<T>());
+ return logger;
}
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h b/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
index b191499..9e3f567 100644
--- a/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
+++ b/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
@@ -39,15 +39,13 @@ namespace core {
namespace reporting {
//! SiteToSiteProvenanceReportingTask Class
-class SiteToSiteProvenanceReportingTask :
- public minifi::RemoteProcessorGroupPort {
+class SiteToSiteProvenanceReportingTask : public minifi::RemoteProcessorGroupPort {
public:
//! Constructor
/*!
* Create a new processor
*/
- SiteToSiteProvenanceReportingTask(
- const std::shared_ptr<io::StreamFactory> &stream_factory)
+ SiteToSiteProvenanceReportingTask(const std::shared_ptr<io::StreamFactory> &stream_factory)
: minifi::RemoteProcessorGroupPort(stream_factory, ReportTaskName),
logger_(logging::LoggerFactory<SiteToSiteProvenanceReportingTask>::getLogger()) {
this->setTriggerWhenEmpty(true);
@@ -59,21 +57,15 @@ class SiteToSiteProvenanceReportingTask :
}
//! Report Task Name
- static constexpr char const* ReportTaskName =
- "SiteToSiteProvenanceReportingTask";
+ static constexpr char const* ReportTaskName = "SiteToSiteProvenanceReportingTask";
static const char *ProvenanceAppStr;
public:
//! Get provenance json report
- void getJsonReport(
- core::ProcessContext *context, core::ProcessSession *session,
- std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
- std::string &report);
- void onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory);
+ void getJsonReport(core::ProcessContext *context, core::ProcessSession *session, std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records, std::string &report);
+ void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
//! OnTrigger method, implemented by NiFi SiteToSiteProvenanceReportingTask
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
//! Initialize, over write by NiFi SiteToSiteProvenanceReportingTask
virtual void initialize(void);
//! Set Port UUID
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/repository/FlowFileRepository.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/repository/FlowFileRepository.h b/libminifi/include/core/repository/FlowFileRepository.h
index 330a3d0..b7c43b2 100644
--- a/libminifi/include/core/repository/FlowFileRepository.h
+++ b/libminifi/include/core/repository/FlowFileRepository.h
@@ -43,22 +43,20 @@ namespace repository {
* Flow File repository
* Design: Extends Repository and implements the run function, using LevelDB as the primary substrate.
*/
-class FlowFileRepository : public core::Repository,
- public std::enable_shared_from_this<FlowFileRepository> {
+class FlowFileRepository : public core::Repository, public std::enable_shared_from_this<FlowFileRepository> {
public:
// Constructor
- FlowFileRepository(const std::string repo_name = "", std::string directory=FLOWFILE_REPOSITORY_DIRECTORY, int64_t maxPartitionMillis=MAX_FLOWFILE_REPOSITORY_ENTRY_LIFE_TIME,
- int64_t maxPartitionBytes=MAX_FLOWFILE_REPOSITORY_STORAGE_SIZE, uint64_t purgePeriod=FLOWFILE_REPOSITORY_PURGE_PERIOD)
- : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<FlowFileRepository>(), directory,
- maxPartitionMillis, maxPartitionBytes, purgePeriod),
+ FlowFileRepository(const std::string repo_name = "", std::string directory = FLOWFILE_REPOSITORY_DIRECTORY, int64_t maxPartitionMillis = MAX_FLOWFILE_REPOSITORY_ENTRY_LIFE_TIME,
+ int64_t maxPartitionBytes = MAX_FLOWFILE_REPOSITORY_STORAGE_SIZE,
+ uint64_t purgePeriod = FLOWFILE_REPOSITORY_PURGE_PERIOD)
+ : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<FlowFileRepository>(), directory, maxPartitionMillis, maxPartitionBytes, purgePeriod),
logger_(logging::LoggerFactory<FlowFileRepository>::getLogger())
{
db_ = NULL;
}
-
// Destructor
~FlowFileRepository() {
if (db_)
@@ -69,38 +67,27 @@ class FlowFileRepository : public core::Repository,
virtual bool initialize(const std::shared_ptr<Configure> &configure) {
std::string value;
- if (configure->get(Configure::nifi_flowfile_repository_directory_default,
- value)) {
+ if (configure->get(Configure::nifi_flowfile_repository_directory_default, value)) {
directory_ = value;
}
- logger_->log_info("NiFi FlowFile Repository Directory %s",
- directory_.c_str());
- if (configure->get(Configure::nifi_flowfile_repository_max_storage_size,
- value)) {
+ logger_->log_info("NiFi FlowFile Repository Directory %s", directory_.c_str());
+ if (configure->get(Configure::nifi_flowfile_repository_max_storage_size, value)) {
Property::StringToInt(value, max_partition_bytes_);
}
- logger_->log_info("NiFi FlowFile Max Partition Bytes %d",
- max_partition_bytes_);
- if (configure->get(Configure::nifi_flowfile_repository_max_storage_time,
- value)) {
+ logger_->log_info("NiFi FlowFile Max Partition Bytes %d", max_partition_bytes_);
+ if (configure->get(Configure::nifi_flowfile_repository_max_storage_time, value)) {
TimeUnit unit;
- if (Property::StringToTime(value, max_partition_millis_, unit)
- && Property::ConvertTimeUnitToMS(max_partition_millis_, unit,
- max_partition_millis_)) {
+ if (Property::StringToTime(value, max_partition_millis_, unit) && Property::ConvertTimeUnitToMS(max_partition_millis_, unit, max_partition_millis_)) {
}
}
- logger_->log_info("NiFi FlowFile Max Storage Time: [%d] ms",
- max_partition_millis_);
+ logger_->log_info("NiFi FlowFile Max Storage Time: [%d] ms", max_partition_millis_);
leveldb::Options options;
options.create_if_missing = true;
- leveldb::Status status = leveldb::DB::Open(options, directory_.c_str(),
- &db_);
+ leveldb::Status status = leveldb::DB::Open(options, directory_.c_str(), &db_);
if (status.ok()) {
- logger_->log_info("NiFi FlowFile Repository database open %s success",
- directory_.c_str());
+ logger_->log_info("NiFi FlowFile Repository database open %s success", directory_.c_str());
} else {
- logger_->log_error("NiFi FlowFile Repository database open %s fail",
- directory_.c_str());
+ logger_->log_error("NiFi FlowFile Repository database open %s fail", directory_.c_str());
return false;
}
return true;
@@ -145,8 +132,7 @@ class FlowFileRepository : public core::Repository,
return false;
}
- void setConnectionMap(
- std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
+ void setConnectionMap(std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
this->connectionMap = connectionMap;
}
void loadComponent();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/repository/VolatileRepository.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/repository/VolatileRepository.h b/libminifi/include/core/repository/VolatileRepository.h
index 37c1a0c..870a1f5 100644
--- a/libminifi/include/core/repository/VolatileRepository.h
+++ b/libminifi/include/core/repository/VolatileRepository.h
@@ -33,8 +33,7 @@ namespace minifi {
namespace core {
namespace repository {
-static uint16_t accounting_size = sizeof(std::vector<uint8_t>)
- + sizeof(std::string) + sizeof(size_t);
+static uint16_t accounting_size = sizeof(std::vector<uint8_t>) + sizeof(std::string) + sizeof(size_t);
class RepoValue {
public:
@@ -173,23 +172,16 @@ class AtomicEntry {
* Flow File repository
* Design: Extends Repository and implements the run function, using LevelDB as the primary substrate.
*/
-class VolatileRepository : public core::Repository,
- public std::enable_shared_from_this<VolatileRepository> {
+class VolatileRepository : public core::Repository, public std::enable_shared_from_this<VolatileRepository> {
public:
static const char *volatile_repo_max_count;
// Constructor
- VolatileRepository(
- std::string repo_name = "", std::string dir = REPOSITORY_DIRECTORY,
- int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME,
- int64_t maxPartitionBytes =
- MAX_REPOSITORY_STORAGE_SIZE,
- uint64_t purgePeriod = REPOSITORY_PURGE_PERIOD)
- : Repository(
- repo_name.length() > 0 ?
- repo_name : core::getClassName<VolatileRepository>(),
- "", maxPartitionMillis, maxPartitionBytes, purgePeriod),
+ VolatileRepository(std::string repo_name = "", std::string dir = REPOSITORY_DIRECTORY, int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME, int64_t maxPartitionBytes =
+ MAX_REPOSITORY_STORAGE_SIZE,
+ uint64_t purgePeriod = REPOSITORY_PURGE_PERIOD)
+ : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<VolatileRepository>(), "", maxPartitionMillis, maxPartitionBytes, purgePeriod),
max_size_(maxPartitionBytes * 0.75),
current_index_(0),
max_count_(10000),
@@ -215,8 +207,7 @@ class VolatileRepository : public core::Repository,
if (configure != nullptr) {
int64_t max_cnt = 0;
std::stringstream strstream;
- strstream << Configure::nifi_volatile_repository_options << getName()
- << "." << volatile_repo_max_count;
+ strstream << Configure::nifi_volatile_repository_options << getName() << "." << volatile_repo_max_count;
if (configure->get(strstream.str(), value)) {
if (core::Property::StringToInt(value, max_cnt)) {
max_count_ = max_cnt;
@@ -225,8 +216,7 @@ class VolatileRepository : public core::Repository,
}
}
- logger_->log_debug("Resizing value_vector_ for %s count is %d", getName(),
- max_count_);
+ logger_->log_debug("Resizing value_vector_ for %s count is %d", getName(), max_count_);
value_vector_.reserve(max_count_);
for (int i = 0; i < max_count_; i++) {
value_vector_.emplace_back(new AtomicEntry());
@@ -259,10 +249,8 @@ class VolatileRepository : public core::Repository,
continue;
}
}
- logger_->log_info("Set repo value at %d out of %d", private_index,
- max_count_);
- updated = value_vector_.at(private_index)->setRepoValue(new_value,
- reclaimed_size);
+ logger_->log_info("Set repo value at %d out of %d", private_index, max_count_);
+ updated = value_vector_.at(private_index)->setRepoValue(new_value, reclaimed_size);
if (reclaimed_size > 0) {
current_size_ -= reclaimed_size;
@@ -271,8 +259,7 @@ class VolatileRepository : public core::Repository,
} while (!updated);
current_size_ += size;
- logger_->log_info("VolatileRepository -- put %s %d %d", key,
- current_size_.load(), current_index_.load());
+ logger_->log_info("VolatileRepository -- put %s %d %d", key, current_size_.load(), current_index_.load());
return true;
}
/**
@@ -307,8 +294,7 @@ class VolatileRepository : public core::Repository,
if (ent->getValue(key, repo_value)) {
current_size_ -= value.size();
repo_value.emplace(value);
- logger_->log_info("VolatileRepository -- get %s %d", key,
- current_size_.load());
+ logger_->log_info("VolatileRepository -- get %s %d", key, current_size_.load());
return true;
}
@@ -316,8 +302,7 @@ class VolatileRepository : public core::Repository,
return false;
}
- void setConnectionMap(
- std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
+ void setConnectionMap(std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
this->connectionMap = connectionMap;
}
void loadComponent();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/yaml/YamlConfiguration.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/yaml/YamlConfiguration.h b/libminifi/include/core/yaml/YamlConfiguration.h
index a63412c..3bfaefd 100644
--- a/libminifi/include/core/yaml/YamlConfiguration.h
+++ b/libminifi/include/core/yaml/YamlConfiguration.h
@@ -45,14 +45,11 @@ namespace core {
class YamlConfiguration : public FlowConfiguration {
public:
- explicit YamlConfiguration(std::shared_ptr<core::Repository> repo,
- std::shared_ptr<core::Repository> flow_file_repo,
- std::shared_ptr<io::StreamFactory> stream_factory,
- std::shared_ptr<Configure> configuration,
- const std::string path = DEFAULT_FLOW_YAML_FILE_NAME)
- : FlowConfiguration(repo, flow_file_repo, stream_factory, configuration,
- path),
- logger_(logging::LoggerFactory<YamlConfiguration>::getLogger()) {
+ explicit YamlConfiguration(std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_file_repo, std::shared_ptr<io::StreamFactory> stream_factory,
+ std::shared_ptr<Configure> configuration,
+ const std::string path = DEFAULT_FLOW_YAML_FILE_NAME)
+ : FlowConfiguration(repo, flow_file_repo, stream_factory, configuration, path),
+ logger_(logging::LoggerFactory<YamlConfiguration>::getLogger()) {
stream_factory_ = stream_factory;
if (IsNullOrEmpty(config_path_)) {
config_path_ = DEFAULT_FLOW_YAML_FILE_NAME;
@@ -112,12 +109,9 @@ class YamlConfiguration : public FlowConfiguration {
YAML::Node flowControllerNode = rootYaml[CONFIG_YAML_FLOW_CONTROLLER_KEY];
YAML::Node processorsNode = rootYaml[CONFIG_YAML_PROCESSORS_KEY];
YAML::Node connectionsNode = rootYaml[CONFIG_YAML_CONNECTIONS_KEY];
- YAML::Node controllerServiceNode =
- rootYaml[CONFIG_YAML_CONTROLLER_SERVICES_KEY];
- YAML::Node remoteProcessingGroupsNode =
- rootYaml[CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY];
- YAML::Node provenanceReportNode =
- rootYaml[CONFIG_YAML_PROVENANCE_REPORT_KEY];
+ YAML::Node controllerServiceNode = rootYaml[CONFIG_YAML_CONTROLLER_SERVICES_KEY];
+ YAML::Node remoteProcessingGroupsNode = rootYaml[CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY];
+ YAML::Node provenanceReportNode = rootYaml[CONFIG_YAML_PROVENANCE_REPORT_KEY];
parseControllerServices(&controllerServiceNode);
// Create the root process group
@@ -128,12 +122,9 @@ class YamlConfiguration : public FlowConfiguration {
parseProvenanceReportingYaml(&provenanceReportNode, root);
// set the controller services into the root group.
- for (auto controller_service : controller_services_
- ->getAllControllerServices()) {
- root->addControllerService(controller_service->getName(),
- controller_service);
- root->addControllerService(controller_service->getUUIDStr(),
- controller_service);
+ for (auto controller_service : controller_services_->getAllControllerServices()) {
+ root->addControllerService(controller_service->getName(), controller_service);
+ root->addControllerService(controller_service->getUUIDStr(), controller_service);
}
return std::unique_ptr<core::ProcessGroup>(root);
@@ -150,8 +141,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parent the parent ProcessGroup to which the the created
* Processor should be added
*/
- void parseProcessorNodeYaml(YAML::Node processorNode,
- core::ProcessGroup * parent);
+ void parseProcessorNodeYaml(YAML::Node processorNode, core::ProcessGroup * parent);
/**
* Parses a port from its corressponding YAML config node and adds
@@ -164,8 +154,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parent the parent ProcessGroup for the port
* @param direction the TransferDirection of the port
*/
- void parsePortYaml(YAML::Node *portNode, core::ProcessGroup *parent,
- TransferDirection direction);
+ void parsePortYaml(YAML::Node *portNode, core::ProcessGroup *parent, TransferDirection direction);
/**
* Parses the root level YAML node for the flow configuration and
@@ -178,8 +167,7 @@ class YamlConfiguration : public FlowConfiguration {
core::ProcessGroup *parseRootProcessGroupYaml(YAML::Node rootNode);
// Process Property YAML
- void parseProcessorPropertyYaml(YAML::Node *doc, YAML::Node *node,
- std::shared_ptr<core::Processor> processor);
+ void parseProcessorPropertyYaml(YAML::Node *doc, YAML::Node *node, std::shared_ptr<core::Processor> processor);
/**
* Parse controller services
* @param controllerServicesNode controller services YAML node.
@@ -208,8 +196,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parent the root node of flow configuration to which
* to add the process groups that are parsed
*/
- void parseRemoteProcessGroupYaml(YAML::Node *node,
- core::ProcessGroup * parent);
+ void parseRemoteProcessGroupYaml(YAML::Node *node, core::ProcessGroup * parent);
/**
* Parses the Provenance Reporting section of a configuration YAML.
@@ -221,8 +208,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parentGroup the root node of flow configuration to which
* to add the provenance reporting config
*/
- void parseProvenanceReportingYaml(YAML::Node *reportNode,
- core::ProcessGroup * parentGroup);
+ void parseProvenanceReportingYaml(YAML::Node *reportNode, core::ProcessGroup * parentGroup);
/**
* A helper function to parse the Properties Node YAML for a processor.
@@ -230,9 +216,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param propertiesNode the YAML::Node containing the properties
* @param processor the Processor to which to add the resulting properties
*/
- void parsePropertiesNodeYaml(
- YAML::Node *propertiesNode,
- std::shared_ptr<core::ConfigurableComponent> processor);
+ void parsePropertiesNodeYaml(YAML::Node *propertiesNode, std::shared_ptr<core::ConfigurableComponent> processor);
/**
* A helper function for parsing or generating optional id fields.
@@ -250,8 +234,7 @@ class YamlConfiguration : public FlowConfiguration {
* is optional and defaults to 'id'
* @return the parsed or generated UUID string
*/
- std::string getOrGenerateId(YAML::Node *yamlNode, const std::string &idField =
- "id");
+ std::string getOrGenerateId(YAML::Node *yamlNode, const std::string &idField = "id");
/**
* This is a helper function for verifying the existence of a required
@@ -271,13 +254,11 @@ class YamlConfiguration : public FlowConfiguration {
* @throws std::invalid_argument if the required field 'fieldName' is
* not present in 'yamlNode'
*/
- void checkRequiredField(YAML::Node *yamlNode, const std::string &fieldName,
- const std::string &yamlSection = "",
- const std::string &errorMessage = "");
+ void checkRequiredField(YAML::Node *yamlNode, const std::string &fieldName, const std::string &yamlSection = "", const std::string &errorMessage = "");
protected:
std::shared_ptr<io::StreamFactory> stream_factory_;
- private:
+ private:
std::shared_ptr<logging::Logger> logger_;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/BaseStream.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/BaseStream.h b/libminifi/include/io/BaseStream.h
index 6f843bc..cae8a43 100644
--- a/libminifi/include/io/BaseStream.h
+++ b/libminifi/include/io/BaseStream.h
@@ -51,8 +51,7 @@ class BaseStream : public DataStream, public Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint32_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint32_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
int writeData(uint8_t *value, int size);
@@ -63,8 +62,7 @@ class BaseStream : public DataStream, public Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint16_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint16_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write valueto stream
@@ -82,8 +80,7 @@ class BaseStream : public DataStream, public Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint64_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint64_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write bool to stream
@@ -126,8 +123,7 @@ class BaseStream : public DataStream, public Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint16_t &base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads a byte from the stream
@@ -152,8 +148,7 @@ class BaseStream : public DataStream, public Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads eight byte from the stream
@@ -161,8 +156,7 @@ class BaseStream : public DataStream, public Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* read UTF from stream
@@ -171,7 +165,7 @@ class BaseStream : public DataStream, public Serializable {
* @return resulting read size
**/
virtual int readUTF(std::string &str, bool widen = false);
- protected:
+ protected:
DataStream *composable_stream_;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/CRCStream.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/CRCStream.h b/libminifi/include/io/CRCStream.h
index 99fdfc3..696f418 100644
--- a/libminifi/include/io/CRCStream.h
+++ b/libminifi/include/io/CRCStream.h
@@ -83,8 +83,7 @@ class CRCStream : public BaseStream {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint32_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint32_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write 2 bytes to stream
* @param base_value non encoded value
@@ -92,8 +91,7 @@ class CRCStream : public BaseStream {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint16_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint16_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write 8 bytes to stream
@@ -102,29 +100,25 @@ class CRCStream : public BaseStream {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint64_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint64_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system word
* @param value value to write
*/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a uint32_t
* @param value value to write
*/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system short
* @param value value to write
*/
- virtual int read(uint16_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
virtual short initialize() {
child_stream_->initialize();
@@ -139,7 +133,7 @@ class CRCStream : public BaseStream {
}
void reset();
- protected:
+ protected:
/**
* Creates a vector and returns the vector using the provided
@@ -215,13 +209,9 @@ void CRCStream<T>::updateCRC(uint8_t *buffer, uint32_t length) {
template<typename T>
int CRCStream<T>::write(uint64_t base_value, bool is_little_endian) {
- const uint64_t value =
- is_little_endian == 1 ? htonll_r(base_value) : base_value;
+ const uint64_t value = is_little_endian == 1 ? htonll_r(base_value) : base_value;
uint8_t bytes[sizeof value];
- std::copy(
- static_cast<const char*>(static_cast<const void*>(&value)),
- static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&value)), static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value, bytes);
return writeData(bytes, sizeof value);
}
@@ -229,10 +219,7 @@ template<typename T>
int CRCStream<T>::write(uint32_t base_value, bool is_little_endian) {
const uint32_t value = is_little_endian ? htonl(base_value) : base_value;
uint8_t bytes[sizeof value];
- std::copy(
- static_cast<const char*>(static_cast<const void*>(&value)),
- static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&value)), static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value, bytes);
return writeData(bytes, sizeof value);
}
@@ -240,10 +227,7 @@ template<typename T>
int CRCStream<T>::write(uint16_t base_value, bool is_little_endian) {
const uint16_t value = is_little_endian == 1 ? htons(base_value) : base_value;
uint8_t bytes[sizeof value];
- std::copy(
- static_cast<const char*>(static_cast<const void*>(&value)),
- static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&value)), static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value, bytes);
return writeData(bytes, sizeof value);
}
@@ -253,15 +237,11 @@ int CRCStream<T>::read(uint64_t &value, bool is_little_endian) {
auto buf = readBuffer(value);
if (is_little_endian) {
- value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48)
- | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32)
- | ((uint64_t) (buf[4] & 255) << 24) | ((uint64_t) (buf[5] & 255) << 16)
- | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
+ value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48) | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32) | ((uint64_t) (buf[4] & 255) << 24)
+ | ((uint64_t) (buf[5] & 255) << 16) | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
} else {
- value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8)
- | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24)
- | ((uint64_t) (buf[4] & 255) << 32) | ((uint64_t) (buf[5] & 255) << 40)
- | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
+ value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8) | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24) | ((uint64_t) (buf[4] & 255) << 32)
+ | ((uint64_t) (buf[5] & 255) << 40) | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
}
return sizeof(value);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/ClientSocket.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/ClientSocket.h b/libminifi/include/io/ClientSocket.h
index ea2312f..c7db7f1 100644
--- a/libminifi/include/io/ClientSocket.h
+++ b/libminifi/include/io/ClientSocket.h
@@ -40,10 +40,11 @@ namespace io {
/**
* Context class for socket. This is currently only used as a parent class for TLSContext. It is necessary so the Socket and TLSSocket constructors
* can be the same. It also gives us a common place to set timeouts, etc from the Configure object in the future.
- */
+ */
class SocketContext {
public:
- SocketContext(const std::shared_ptr<Configure> &configure) {}
+ SocketContext(const std::shared_ptr<Configure> &configure) {
+ }
};
/**
* Socket class.
@@ -64,8 +65,7 @@ class Socket : public BaseStream {
* @param port connecting port
* @param listeners number of listeners in the queue
*/
- explicit Socket(const std::shared_ptr<SocketContext> &context, const std::string &hostname, const uint16_t port,
- const uint16_t listeners);
+ explicit Socket(const std::shared_ptr<SocketContext> &context, const std::string &hostname, const uint16_t port, const uint16_t listeners);
/**
* Constructor that creates a client socket.
@@ -142,43 +142,37 @@ class Socket : public BaseStream {
* Writes a system word
* @param value value to write
*/
- virtual int write(uint64_t value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint64_t value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Writes a uint32_t
* @param value value to write
*/
- virtual int write(uint32_t value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint32_t value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Writes a system short
* @param value value to write
*/
- virtual int write(uint16_t value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint16_t value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system word
* @param value value to write
*/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a uint32_t
* @param value value to write
*/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system short
* @param value value to write
*/
- virtual int read(uint16_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Returns the underlying buffer
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/DataStream.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/DataStream.h b/libminifi/include/io/DataStream.h
index e37dbf7..460930d 100644
--- a/libminifi/include/io/DataStream.h
+++ b/libminifi/include/io/DataStream.h
@@ -85,22 +85,19 @@ class DataStream {
* Reads a system word
* @param value value to write
*/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a uint32_t
* @param value value to write
*/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system short
* @param value value to write
*/
- virtual int read(uint16_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Returns the underlying buffer
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/EndianCheck.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/EndianCheck.h b/libminifi/include/io/EndianCheck.h
index 3ceb19c..c4d4504 100644
--- a/libminifi/include/io/EndianCheck.h
+++ b/libminifi/include/io/EndianCheck.h
@@ -30,7 +30,7 @@ namespace io {
class EndiannessCheck {
public:
static bool IS_LITTLE;
- private:
+ private:
static bool is_little_endian() {
/* do whatever is needed at static init time */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/Serializable.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/Serializable.h b/libminifi/include/io/Serializable.h
index 5ee886b..326c7b7 100644
--- a/libminifi/include/io/Serializable.h
+++ b/libminifi/include/io/Serializable.h
@@ -73,8 +73,7 @@ class Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- int write(uint32_t base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int write(uint32_t base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write 2 bytes to stream
@@ -83,8 +82,7 @@ class Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- int write(uint16_t base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int write(uint16_t base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write valueto stream
@@ -102,8 +100,7 @@ class Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- int write(uint64_t base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int write(uint64_t base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write bool to stream
@@ -133,8 +130,7 @@ class Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- int read(uint16_t &base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int read(uint16_t &base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads a byte from the stream
@@ -159,8 +155,7 @@ class Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- int read(uint32_t &value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int read(uint32_t &value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads eight byte from the stream
@@ -168,8 +163,7 @@ class Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- int read(uint64_t &value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int read(uint64_t &value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* read UTF from stream
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/StreamFactory.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/StreamFactory.h b/libminifi/include/io/StreamFactory.h
index 3faee45..bcb2847 100644
--- a/libminifi/include/io/StreamFactory.h
+++ b/libminifi/include/io/StreamFactory.h
@@ -33,8 +33,7 @@ class AbstractStreamFactory {
virtual ~AbstractStreamFactory() {
}
- virtual std::unique_ptr<Socket> createSocket(const std::string &host,
- const uint16_t port) = 0;
+ virtual std::unique_ptr<Socket> createSocket(const std::string &host, const uint16_t port) = 0;
};
/**
@@ -49,8 +48,7 @@ class StreamFactory {
* Creates a socket and returns a unique ptr
*
*/
- std::unique_ptr<Socket> createSocket(const std::string &host,
- const uint16_t port) {
+ std::unique_ptr<Socket> createSocket(const std::string &host, const uint16_t port) {
return delegate_->createSocket(host, port);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/TLSSocket.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/TLSSocket.h b/libminifi/include/io/TLSSocket.h
index 011a012..e9e6ce4 100644
--- a/libminifi/include/io/TLSSocket.h
+++ b/libminifi/include/io/TLSSocket.h
@@ -50,8 +50,7 @@ class TLSContext {
* @returns new TLSContext;
*/
static TLSContext *getInstance() {
- TLSContext* atomic_context = context_instance.load(
- std::memory_order_relaxed);
+ TLSContext* atomic_context = context_instance.load(std::memory_order_relaxed);
std::atomic_thread_fence(std::memory_order_acquire);
if (atomic_context == nullptr) {
std::lock_guard<std::mutex> lock(context_mutex);
@@ -86,8 +85,7 @@ class TLSContext {
static int pemPassWordCb(char *buf, int size, int rwflag, void *userdata) {
std::string passphrase;
- if (Configure::getConfigure()->get(
- Configure::nifi_security_client_pass_phrase, passphrase)) {
+ if (Configure::getConfigure()->get(Configure::nifi_security_client_pass_phrase, passphrase)) {
std::ifstream file(passphrase.c_str(), std::ifstream::in);
if (!file.good()) {
@@ -96,8 +94,7 @@ class TLSContext {
}
std::string password;
- password.assign((std::istreambuf_iterator<char>(file)),
- std::istreambuf_iterator<char>());
+ password.assign((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
file.close();
memset(buf, 0x00, size);
memcpy(buf, password.c_str(), password.length() - 1);
@@ -129,8 +126,7 @@ class TLSSocket : public Socket {
* @param port connecting port
* @param listeners number of listeners in the queue
*/
- explicit TLSSocket(const std::string &hostname, const uint16_t port,
- const uint16_t listeners);
+ explicit TLSSocket(const std::string &hostname, const uint16_t port, const uint16_t listeners);
/**
* Constructor that creates a client socket.