You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/02/05 06:18:46 UTC
[6/8] mesos git commit: Added remove() calls to process::Help.
Added remove() calls to process::Help.
Previously, there was no way to remove an installed help
string for a given endpoint.
This commit adds the ability to remove these help strings.
Review: https://reviews.apache.org/r/42957/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2eba6b10
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2eba6b10
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2eba6b10
Branch: refs/heads/master
Commit: 2eba6b108eaa3704fa3699535166759a0c0d1963
Parents: 32487ac
Author: Kevin Klues <kl...@gmail.com>
Authored: Thu Feb 4 19:21:54 2016 -0800
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Thu Feb 4 21:18:17 2016 -0800
----------------------------------------------------------------------
3rdparty/libprocess/include/process/help.hpp | 6 ++++++
3rdparty/libprocess/src/help.cpp | 23 ++++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/2eba6b10/3rdparty/libprocess/include/process/help.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/help.hpp b/3rdparty/libprocess/include/process/help.hpp
index 2e76a6a..414d14e 100644
--- a/3rdparty/libprocess/include/process/help.hpp
+++ b/3rdparty/libprocess/include/process/help.hpp
@@ -97,6 +97,12 @@ public:
const std::string& name,
const Option<std::string>& help);
+ // Remove a previously installed 'help' string for '/id/name'.
+ bool remove(const std::string& id, const std::string& name);
+
+ // Remove all previously installed 'help' strings for '/id/*'.
+ bool remove(const std::string& id);
+
protected:
virtual void initialize();
http://git-wip-us.apache.org/repos/asf/mesos/blob/2eba6b10/3rdparty/libprocess/src/help.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/help.cpp b/3rdparty/libprocess/src/help.cpp
index 2f718b9..ec1c2d4 100644
--- a/3rdparty/libprocess/src/help.cpp
+++ b/3rdparty/libprocess/src/help.cpp
@@ -16,7 +16,6 @@
#include <process/help.hpp>
-#include <map>
#include <string>
#include <vector>
@@ -101,6 +100,28 @@ void Help::add(
}
+bool Help::remove(const string& id, const string& name)
+{
+ if (helps.count(id) == 0 || helps[id].count(name) == 0) {
+ return false;
+ }
+
+ helps[id].erase(name);
+
+ if (helps[id].empty()) {
+ helps.erase(id);
+ }
+
+ return true;
+}
+
+
+bool Help::remove(const string& id)
+{
+ return helps.erase(id) == 1;
+}
+
+
void Help::initialize()
{
route("/", None(), &Help::help);