0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RegisterServer.cc
Go to the documentation of this file.
1 /*
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 #include <Common/Compat.h>
28 
29 #include "RegisterServer.h"
30 
32 
33 #include <Common/Logger.h>
34 #include <Common/Serialization.h>
35 #include <Common/Time.h>
36 
37 using namespace Hypertable;
39 
41  return 1;
42 }
43 
47 }
48 
77 void RegisterServer::encode_internal(uint8_t **bufp) const {
81  m_system_stats.encode(bufp);
83 }
84 
85 void RegisterServer::decode_internal(uint8_t version, const uint8_t **bufp,
86  size_t *remainp) {
87  m_location = Serialization::decode_vstr(bufp, remainp);
89  m_lock_held = Serialization::decode_bool(bufp, remainp);
90  m_system_stats.decode(bufp, remainp);
91  m_now = Serialization::decode_i64(bufp, remainp);
92 }
93 
94 
95 
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
Declarations for Canonicalize.
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
int64_t m_now
Current time of registering server.
uint64_t decode_i64(const uint8_t **bufp, size_t *remainp)
Decode a 64-bit integer in little-endian order.
bool decode_bool(const uint8_t **bufp, size_t *remainp)
Decodes a boolean value from the given buffer.
Definition: Serialization.h:96
uint16_t decode_i16(const uint8_t **bufp, size_t *remainp)
Decode a 16-bit integer in little-endian order.
size_t encoded_length_internal() const override
Returns internal serialized length.
size_t encoded_length() const
Returns the encoded length of this object.
Logging routines and macros.
Compatibility Macros for C/C++.
void encode_i16(uint8_t **bufp, uint16_t val)
Encode a 16-bit integer in little-endian order.
uint8_t encoding_version() const override
Returns encoding version.
void encode_i64(uint8_t **bufp, uint64_t val)
Encode a 64-bit integer in little-endian order.
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
Functions to serialize/deserialize primitives to/from a memory buffer.
void decode(const uint8_t **bufp, size_t *remainp)
Deserializes this object from a buffer.
Time related declarations.
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
void encode_vstr(uint8_t **bufp, const void *buf, size_t len)
Encode a buffer as variable length string (vint64, data, null)
Hypertable definitions
void encode_bool(uint8_t **bufp, bool bval)
Encodes a boolean into the given buffer.
Definition: Serialization.h:84
void encode(uint8_t **bufp) const
Encodes the statistics to a serialized buffer.
Declarations for RegisterServer request parameters.
int64_t get_ts64()
Returns the current time in nanoseconds as a 64bit number.
Definition: Time.cc:40