0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MetadataSync.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; version 3 of the
9  * 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 
22 #include <Common/Compat.h>
23 
24 #include "MetadataSync.h"
25 
27 
29 
30 #include <Common/Error.h>
31 #include <Common/Logger.h>
32 #include <Common/Serialization.h>
33 
34 using namespace Hypertable;
36 
39  const char *table_id;
40  uint32_t flags, count;
41  const uint8_t *decode_ptr = m_event->payload;
42  size_t decode_remain = m_event->payload_len;
43  std::vector<const char *> columns;
44 
45  try {
46  table_id = Serialization::decode_vstr(&decode_ptr, &decode_remain);
47  flags = Serialization::decode_i32(&decode_ptr, &decode_remain);
48  count = Serialization::decode_i32(&decode_ptr, &decode_remain);
49  for (uint32_t i=0; i<count; i++)
50  columns.push_back(Serialization::decode_vstr(&decode_ptr, &decode_remain));
51 
52  m_range_server->metadata_sync(&cb, table_id, flags, columns);
53  }
54  catch (Exception &e) {
55  HT_ERROR_OUT << e << HT_END;
56  cb.error(e.code(), e.what());
57  }
58 }
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
virtual void run()
Carries out the request.
Definition: MetadataSync.cc:37
void metadata_sync(ResponseCallback *, const char *, uint32_t flags, std::vector< const char * > columns)
Declarations for RangeServer.
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
Logging routines and macros.
Compatibility Macros for C/C++.
#define HT_END
Definition: Logger.h:220
Functions to serialize/deserialize primitives to/from a memory buffer.
#define HT_ERROR_OUT
Definition: Logger.h:301
This class is used to generate and deliver standard responses back to a client.
Hypertable definitions
virtual int error(int error, const String &msg)
Sends a standard error response back to the client.
This is a generic exception class for Hypertable.
Definition: Error.h:314
EventPtr m_event
MESSAGE Event from which handler was initialized.
Declarations for ResponseCallback.
Error codes, Exception handling, error logging.
int code() const
Returns the error code.
Definition: Error.h:391