LogCabin
Server/ControlService.h
Go to the documentation of this file.
00001 /* Copyright (c) 2015 Diego Ongaro
00002  *
00003  * Permission to use, copy, modify, and distribute this software for any
00004  * purpose with or without fee is hereby granted, provided that the above
00005  * copyright notice and this permission notice appear in all copies.
00006  *
00007  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
00008  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00009  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
00010  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00011  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00012  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00013  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00014  */
00015 
00016 #include "RPC/Service.h"
00017 
00018 #ifndef LOGCABIN_SERVER_CONTROLSERVICE_H
00019 #define LOGCABIN_SERVER_CONTROLSERVICE_H
00020 
00021 namespace LogCabin {
00022 
00023 // forward declaration
00024 namespace Protocol {
00025 namespace ServerControl {
00026 class Settings;
00027 } // LogCabin::Protocol::ServerControl
00028 } // LogCabin::Protocol
00029 
00030 
00031 namespace Server {
00032 
00033 // forward declaration
00034 class Globals;
00035 
00036 /**
00037  * Invoked by logcabinctl client to inspect and manipulate internal server
00038  * state.
00039  */
00040 class ControlService : public RPC::Service {
00041   public:
00042     /// Constructor.
00043     explicit ControlService(Globals& globals);
00044 
00045     /// Destructor.
00046     ~ControlService();
00047 
00048     void handleRPC(RPC::ServerRPC rpc);
00049     std::string getName() const;
00050 
00051   private:
00052 
00053     ////////// RPC handlers //////////
00054 
00055     void debugFilenameGet(RPC::ServerRPC rpc);
00056     void debugFilenameSet(RPC::ServerRPC rpc);
00057     void debugPolicyGet(RPC::ServerRPC rpc);
00058     void debugPolicySet(RPC::ServerRPC rpc);
00059     void debugRotate(RPC::ServerRPC rpc);
00060     void serverInfoGet(RPC::ServerRPC rpc);
00061     void serverStatsDump(RPC::ServerRPC rpc);
00062     void serverStatsGet(RPC::ServerRPC rpc);
00063     void snapshotControl(RPC::ServerRPC rpc);
00064     void snapshotInhibitGet(RPC::ServerRPC rpc);
00065     void snapshotInhibitSet(RPC::ServerRPC rpc);
00066 
00067     /**
00068      * The LogCabin daemon's top-level objects.
00069      */
00070     Globals& globals;
00071 
00072   public:
00073 
00074     // ControlService is non-copyable.
00075     ControlService(const ControlService&) = delete;
00076     ControlService& operator=(const ControlService&) = delete;
00077 }; // class ControlService
00078 
00079 } // namespace LogCabin::Server
00080 } // namespace LogCabin
00081 
00082 #endif /* LOGCABIN_SERVER_CONTROLSERVICE_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines