]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Monitor: add a separate leader_supported_commands
authorGreg Farnum <greg@inktank.com>
Fri, 6 Dec 2013 21:55:38 +0000 (13:55 -0800)
committerGreg Farnum <greg@inktank.com>
Mon, 9 Dec 2013 06:21:41 +0000 (22:21 -0800)
This isn't used yet, but will be shortly.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index 136c42672a16bfe519bc59d68ae30e978fce302e..bb19bce6a41c40e190c72923fb49d2e875e827d2 100644 (file)
@@ -1880,6 +1880,8 @@ MonCommand mon_commands[] = {
   {parsesig, helptext, modulename, req_perms, avail},
 #include <mon/MonCommands.h>
 };
+const MonCommand *leader_supported_mon_commands = NULL;
+int leader_supported_mon_commands_size = 0;
 
 bool Monitor::_allowed_command(MonSession *s, string &module, string &prefix,
                                map<string,cmd_vartype>& cmdmap) {
@@ -1950,6 +1952,18 @@ void get_locally_supported_monitor_commands(const MonCommand **cmds, int *count)
   *cmds = mon_commands;
   *count = ARRAY_SIZE(mon_commands);
 }
+void get_leader_supported_commands(const MonCommand **cmds, int *count)
+{
+  *cmds = leader_supported_mon_commands;
+  *count = leader_supported_mon_commands_size;
+}
+void set_leader_supported_commands(const MonCommand *cmds, int size)
+{
+  if (leader_supported_mon_commands != mon_commands)
+    delete[] leader_supported_mon_commands;
+  leader_supported_mon_commands = cmds;
+  leader_supported_mon_commands_size = size;
+}
 
 void Monitor::handle_command(MMonCommand *m)
 {
index cfb9f549c398ed818570c45bd7d7f540f9b0c2fc..bda625fb2215cd73cc9a8917d29e66ded9edfe2f 100644 (file)
@@ -911,5 +911,9 @@ void get_command_descriptions(const MonCommand *commands,
                              Formatter *f,
                              bufferlist *rdata);
 void get_locally_supported_monitor_commands(const MonCommand **cmds, int *count);
+void get_leader_supported_commands(const MonCommand **cmds, int *count);
+/// the Monitor owns this pointer once you pass it in
+void set_leader_supported_commands(const MonCommand *cmds, int size);
+
 
 #endif