0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RegisterServer.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
26 
27 #ifndef Hypertable_Lib_Master_Request_Parameters_RegisterServer_h
28 #define Hypertable_Lib_Master_Request_Parameters_RegisterServer_h
29 
30 #include <Common/Serializable.h>
31 #include <Common/StatsSystem.h>
32 
33 #include <string>
34 
35 using namespace std;
36 
37 namespace Hypertable {
38 namespace Lib {
39 namespace Master {
40 namespace Request {
41 namespace Parameters {
42 
45 
47  class RegisterServer : public Serializable {
48  public:
49 
53 
60  RegisterServer(const std::string &location, uint16_t listen_port, bool lock_held,
61  StatsSystem &system_stats)
62  : m_location(location), m_listen_port(listen_port),
63  m_lock_held(lock_held), m_system_stats(system_stats) { }
64 
67  const string& location() const { return m_location; }
68 
71  uint16_t listen_port() { return m_listen_port; }
72 
75  bool lock_held() { return m_lock_held; }
76 
79  const StatsSystem &system_stats() const { return m_system_stats; }
80 
83  int64_t now() { return m_now; }
84 
85  private:
86 
89  uint8_t encoding_version() const override;
90 
94  size_t encoded_length_internal() const override;
95 
98  void encode_internal(uint8_t **bufp) const override;
99 
106  void decode_internal(uint8_t version, const uint8_t **bufp,
107  size_t *remainp) override;
108 
110  string m_location;
111 
113  uint16_t m_listen_port;
114 
117 
120 
122  int64_t m_now;
123 
124  };
125 
127 
128 }}}}}
129 
130 #endif // Hypertable_Lib_Master_Request_Parameters_RegisterServer_h
STL namespace.
Request parameters for register server operation.
int64_t m_now
Current time of registering server.
Collecting and (de)serializing system-wide statistics.
const StatsSystem & system_stats() const
Gets system stats.
Collects, serializes and deserializes system-wide statistics.
Definition: StatsSystem.h:43
Declarations for Serializable.
Hypertable definitions
Mixin class that provides a standard serialization interface.
Definition: Serializable.h:65
RegisterServer(const std::string &location, uint16_t listen_port, bool lock_held, StatsSystem &system_stats)
Constructor.
const string & location() const
Gets location (proxy name)