31 #include <boost/algorithm/string.hpp>
53 const uint8_t *ptr =
event->payload;
54 size_t remaining =
event->payload_len;
65 HT_INFOF(
"Entering RenameTable-%lld(%s, %s) state=%s",
94 m_context->hyperspace->attr_get(filename,
"schema", value_buf);
113 boost::trim_if(old_index, boost::is_any_of(
"/ "));
114 boost::trim_if(new_index, boost::is_any_of(
"/ "));
134 boost::trim_if(old_index, boost::is_any_of(
"/ "));
135 boost::trim_if(new_index, boost::is_any_of(
"/ "));
155 HT_FATALF(
"Unrecognized state %d", state);
158 HT_INFOF(
"Leaving RenameTable-%lld(%s, %s) state=%s",
166 <<
" id=" <<
m_id <<
" ";
205 return "OperationRenameTable";
int64_t id()
Operation identifier.
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
The FailureInducer simulates errors.
ContextPtr m_context
Pointer to Master context.
std::string String
A String is simply a typedef to std::string.
bool validate_subops()
Handles the results of sub operations.
void execute() override
Executes (carries out) the operation.
virtual size_t encoded_length() const
Returns serialized object length.
const String name() override
Name of operation used for exclusivity.
Lib::Master::Request::Parameters::RenameTable m_params
Request parmaeters.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
const char * get_text(int32_t state)
const string & from() const
Gets original table name.
A dynamic, resizable and reference counted memory buffer.
Represents a set of table parts (sub-tables).
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
const String label() override
Human readable label for operation.
TableParts m_parts
Index tables requiring renaming.
virtual void encode(uint8_t **bufp) const
Writes serialized representation of object to a buffer.
void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override
void set_state(int32_t state)
void display_state(std::ostream &os) override
Write human readable operation state to output stream.
Compatibility Macros for C/C++.
void stage_subop(std::shared_ptr< Operation > operation)
Stages a sub operation for execution.
Functions to serialize/deserialize primitives to/from a memory buffer.
void record_state()
Records operation state to the MML.
Request parameters for rename table operation.
static String basename(String name, char separator= '/')
A posix-compliant basename() which strips directory names from a filename.
OperationRenameTable(ContextPtr &context, const String &from, const String &to)
virtual void decode(const uint8_t **bufp, size_t *remainp)
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)
#define HT_FATALF(msg,...)
long long int Lld
Shortcut for printf formats.
bool table_exists(ContextPtr &context, const String &name, String &id)
Checks if table exists and returns table ID.
Declarations for general-purpose utility functions.
String m_id
Table ID path for new name.
DependencySet m_dependencies
Set of dependencies.
#define HT_INFOF(msg,...)
uint8_t * base
Pointer to the allocated memory buffer.
bool value_index() const
Test if value index is included in set.
Abstract base class for master operations.
void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Decode operation state.
This is a generic exception class for Hypertable.
void encode_state(uint8_t **bufp) const override
Encode operation state.
uint8_t encoding_version_state() const override
Returns version of encoding format of state.
static String dirname(String name, char separator= '/')
A posix-compliant dirname() which strips the last component from a file name.
DependencySet m_exclusivities
Set of exclusivities.
TableParts get_index_parts(const std::string &schema)
Gets index parts specified in schema.
#define HT_MAYBE_FAIL(_label_)
void complete_ok(std::vector< MetaLog::EntityPtr > &additional)
uint8_t decode_byte(const uint8_t **bufp, size_t *remainp)
Decodes a single byte from the given buffer.
const string & to() const
Gets new table name.
Error codes, Exception handling, error logging.
void complete_error(int error, const String &msg, std::vector< MetaLog::EntityPtr > &additional)
Completes operation with error.
bool qualifier_index() const
Test if qualifier index is included in set.
size_t encoded_length_state() const override
Encoded length of operation state.