0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PhantomLoad.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 "PhantomLoad.h"
25 
27 
29 
31 
32 #include <Common/Error.h>
33 #include <Common/Logger.h>
34 #include <Common/Serialization.h>
35 
36 using namespace Hypertable;
38 
41 
42  try {
43  const uint8_t *ptr = m_event->payload;
44  size_t remain = m_event->payload_len;
46  params.decode(&ptr, &remain);
47  m_range_server->phantom_load(&cb, params.location(),
48  params.plan_generation(), params.fragments(),
49  params.range_specs(), params.range_states());
50  }
51  catch (Exception &e) {
52  HT_ERROR_OUT << e << HT_END;
53  cb.error(e.code(), e.what());
54  return;
55  }
56 }
virtual void run()
Carries out the request.
Definition: PhantomLoad.cc:39
Declarations for RangeServer.
void phantom_load(ResponseCallback *, const String &location, int32_t plan_generation, const vector< int32_t > &fragments, const vector< QualifiedRangeSpec > &specs, const vector< RangeState > &states)
Logging routines and macros.
Declarations for PhantomLoad request parameters.
Compatibility Macros for C/C++.
const vector< QualifiedRangeSpec > & range_specs() const
Gets range specifications.
Definition: PhantomLoad.h:86
#define HT_END
Definition: Logger.h:220
Functions to serialize/deserialize primitives to/from a memory buffer.
const vector< RangeState > & range_states() const
Gets range states.
Definition: PhantomLoad.h:90
#define HT_ERROR_OUT
Definition: Logger.h:301
virtual void decode(const uint8_t **bufp, size_t *remainp)
Reads serialized representation of object from a buffer.
Definition: Serializable.cc:70
This class is used to generate and deliver standard responses back to a client.
Hypertable definitions
int32_t plan_generation() const
Gets plan generation.
Definition: PhantomLoad.h:78
virtual int error(int error, const String &msg)
Sends a standard error response back to the client.
Request parameters for phantom load function.
Definition: PhantomLoad.h:50
This is a generic exception class for Hypertable.
Definition: Error.h:314
EventPtr m_event
MESSAGE Event from which handler was initialized.
const vector< int32_t > & fragments() const
Gets fragments.
Definition: PhantomLoad.h:82
Declarations for ResponseCallback.
Error codes, Exception handling, error logging.
int code() const
Returns the error code.
Definition: Error.h:391