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 2018/09/20 19:56:00 UTC
nifi-minifi-cpp git commit: MINIFICPP-614: Don't rebuild agent
information every call
Repository: nifi-minifi-cpp
Updated Branches:
refs/heads/master 8013bc3ce -> a19c8a0fa
MINIFICPP-614: Don't rebuild agent information every call
This closes #401.
Signed-off-by: Aldrin Piri <al...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/a19c8a0f
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/a19c8a0f
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/a19c8a0f
Branch: refs/heads/master
Commit: a19c8a0fa430127d4062b3df9e9a2bb78959d9c9
Parents: 8013bc3
Author: Marc Parisi <ph...@apache.org>
Authored: Wed Sep 19 21:30:58 2018 -0400
Committer: Aldrin Piri <al...@apache.org>
Committed: Thu Sep 20 15:55:35 2018 -0400
----------------------------------------------------------------------
.../include/core/state/nodes/AgentInformation.h | 90 ++++++++++----------
1 file changed, 45 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a19c8a0f/libminifi/include/core/state/nodes/AgentInformation.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/state/nodes/AgentInformation.h b/libminifi/include/core/state/nodes/AgentInformation.h
index 7093250..bd8ec01 100644
--- a/libminifi/include/core/state/nodes/AgentInformation.h
+++ b/libminifi/include/core/state/nodes/AgentInformation.h
@@ -465,69 +465,69 @@ class AgentManifest : public DeviceInformation {
}
std::vector<SerializedResponseNode> serialize() {
- std::vector<SerializedResponseNode> serialized;
-
- SerializedResponseNode ident;
+ static std::vector<SerializedResponseNode> serialized;
+ if (serialized.empty()) {
+ SerializedResponseNode ident;
- ident.name = "identifier";
- ident.value = AgentBuild::BUILD_IDENTIFIER;
+ ident.name = "identifier";
+ ident.value = AgentBuild::BUILD_IDENTIFIER;
- SerializedResponseNode type;
+ SerializedResponseNode type;
- type.name = "agentType";
- type.value = "cpp";
+ type.name = "agentType";
+ type.value = "cpp";
- SerializedResponseNode version;
+ SerializedResponseNode version;
- version.name = "version";
- version.value = AgentBuild::VERSION;
+ version.name = "version";
+ version.value = AgentBuild::VERSION;
- SerializedResponseNode buildInfo;
- buildInfo.name = "buildInfo";
+ SerializedResponseNode buildInfo;
+ buildInfo.name = "buildInfo";
- SerializedResponseNode build_version;
- build_version.name = "version";
- build_version.value = AgentBuild::VERSION;
+ SerializedResponseNode build_version;
+ build_version.name = "version";
+ build_version.value = AgentBuild::VERSION;
- SerializedResponseNode build_rev;
- build_rev.name = "revision";
- build_rev.value = AgentBuild::BUILD_REV;
+ SerializedResponseNode build_rev;
+ build_rev.name = "revision";
+ build_rev.value = AgentBuild::BUILD_REV;
- SerializedResponseNode build_date;
- build_date.name = "timestamp";
- build_date.value = (uint64_t) std::stoull(AgentBuild::BUILD_DATE);
+ SerializedResponseNode build_date;
+ build_date.name = "timestamp";
+ build_date.value = (uint64_t) std::stoull(AgentBuild::BUILD_DATE);
- SerializedResponseNode compiler_command;
- compiler_command.name = "compiler";
- compiler_command.value = AgentBuild::COMPILER;
+ SerializedResponseNode compiler_command;
+ compiler_command.name = "compiler";
+ compiler_command.value = AgentBuild::COMPILER;
- SerializedResponseNode compiler_flags;
- compiler_flags.name = "flags";
- compiler_flags.value = AgentBuild::COMPILER_FLAGS;
+ SerializedResponseNode compiler_flags;
+ compiler_flags.name = "flags";
+ compiler_flags.value = AgentBuild::COMPILER_FLAGS;
- buildInfo.children.push_back(compiler_flags);
- buildInfo.children.push_back(compiler_command);
+ buildInfo.children.push_back(compiler_flags);
+ buildInfo.children.push_back(compiler_command);
- buildInfo.children.push_back(build_version);
- buildInfo.children.push_back(build_rev);
- buildInfo.children.push_back(build_date);
+ buildInfo.children.push_back(build_version);
+ buildInfo.children.push_back(build_rev);
+ buildInfo.children.push_back(build_date);
- Bundles bundles("bundles");
+ Bundles bundles("bundles");
- serialized.push_back(ident);
- serialized.push_back(type);
- serialized.push_back(buildInfo);
- // serialize the bundle information.
- for (auto bundle : bundles.serialize()) {
- serialized.push_back(bundle);
- }
+ serialized.push_back(ident);
+ serialized.push_back(type);
+ serialized.push_back(buildInfo);
+ // serialize the bundle information.
+ for (auto bundle : bundles.serialize()) {
+ serialized.push_back(bundle);
+ }
- SchedulingDefaults defaults("schedulingDefaults");
+ SchedulingDefaults defaults("schedulingDefaults");
- for (auto defaultNode : defaults.serialize()) {
- serialized.push_back(defaultNode);
+ for (auto defaultNode : defaults.serialize()) {
+ serialized.push_back(defaultNode);
+ }
}
-
return serialized;
}
};