Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A command-line tool to initiate transfers

Transfers can be manually specified in the configuration.
  • Loading branch information...
commit 40f93e530446ad968e244db6dede0c459b994f7d 1 parent e4cb042
@rescrv authored
View
1  .gitignore
@@ -23,6 +23,7 @@ hyperdex
hyperdex-add-space
hyperdex-binary-test
hyperdex-daemon
+hyperdex-initiate-transfer
hyperdex-kill
hyperdex-replication-stress-test
hyperdex-rm-space
View
7 Makefile.am
@@ -62,7 +62,8 @@ hyperdexexec_PROGRAMS = \
hyperdex-add-space \
hyperdex-rm-space \
hyperdex-kill \
- hyperdex-show-config
+ hyperdex-show-config \
+ hyperdex-initiate-transfer
noinst_PROGRAMS = \
client/c/testcompile \
@@ -219,6 +220,7 @@ libhypercoordinator_la_SOURCES = \
coordinator/add-space.cc \
coordinator/coordinator.cc \
coordinator/get-config.cc \
+ coordinator/initiate-transfer.cc \
coordinator/kill.cc \
coordinator/meta.cc \
coordinator/register.cc \
@@ -379,6 +381,9 @@ hyperdex_kill_LDADD = libhyperclient.la
hyperdex_show_config_SOURCES = tools/show-config.cc
hyperdex_show_config_LDADD = libhyperclient.la
+hyperdex_initiate_transfer_SOURCES = tools/initiate-transfer.cc
+hyperdex_initiate_transfer_LDADD = libhyperclient.la
+
################################################################################
################################## Benchmarks ##################################
################################################################################
View
64 client/hyperclient.cc
@@ -156,6 +156,9 @@ hyperclient :: add_space(const char* description)
case hyperdex::COORD_NOT_FOUND:
status = HYPERCLIENT_NOTFOUND;
break;
+ case hyperdex::COORD_TRANSFER_IN_PROGRESS:
+ status = HYPERCLIENT_INTERNAL;
+ break;
default:
status = HYPERCLIENT_INTERNAL;
break;
@@ -205,6 +208,9 @@ hyperclient :: rm_space(const char* space)
case hyperdex::COORD_NOT_FOUND:
status = HYPERCLIENT_NOTFOUND;
break;
+ case hyperdex::COORD_TRANSFER_IN_PROGRESS:
+ status = HYPERCLIENT_INTERNAL;
+ break;
default:
status = HYPERCLIENT_INTERNAL;
break;
@@ -742,6 +748,64 @@ hyperclient :: kill(uint64_t server_id)
case hyperdex::COORD_NOT_FOUND:
status = HYPERCLIENT_NOTFOUND;
break;
+ case hyperdex::COORD_TRANSFER_IN_PROGRESS:
+ status = HYPERCLIENT_INTERNAL;
+ break;
+ default:
+ status = HYPERCLIENT_INTERNAL;
+ break;
+ }
+ }
+
+ if (output)
+ {
+ replicant_destroy_output(output, output_sz);
+ }
+
+ return status;
+}
+
+hyperclient_returncode
+hyperclient :: initiate_transfer(uint64_t region_id, uint64_t server_id)
+{
+ hyperclient_returncode status;
+ char data[2 * sizeof(uint64_t)];
+ e::pack64be(region_id, data);
+ e::pack64be(server_id, data + sizeof(uint64_t));
+ const char* output;
+ size_t output_sz;
+
+ if (!m_coord->make_rpc("initiate-transfer", data, 2 * sizeof(uint64_t),
+ &status, &output, &output_sz))
+ {
+ return status;
+ }
+
+ status = HYPERCLIENT_SUCCESS;
+
+ if (output_sz >= 2)
+ {
+ uint16_t x;
+ e::unpack16be(output, &x);
+ coordinator_returncode rc = static_cast<coordinator_returncode>(x);
+
+ switch (rc)
+ {
+ case hyperdex::COORD_SUCCESS:
+ status = HYPERCLIENT_SUCCESS;
+ break;
+ case hyperdex::COORD_MALFORMED:
+ status = HYPERCLIENT_INTERNAL;
+ break;
+ case hyperdex::COORD_DUPLICATE:
+ status = HYPERCLIENT_DUPLICATE;
+ break;
+ case hyperdex::COORD_NOT_FOUND:
+ status = HYPERCLIENT_NOTFOUND;
+ break;
+ case hyperdex::COORD_TRANSFER_IN_PROGRESS:
+ status = HYPERCLIENT_DUPLICATE;
+ break;
default:
status = HYPERCLIENT_INTERNAL;
break;
View
1  client/hyperclient.h
@@ -842,6 +842,7 @@ class hyperclient
private:
hyperclient_returncode show_config(std::ostream& out);
hyperclient_returncode kill(uint64_t server_id);
+ hyperclient_returncode initiate_transfer(uint64_t region_id, uint64_t server_id);
private:
int64_t maintain_coord_connection(hyperclient_returncode* status);
View
2  client/tool_wrapper.h
@@ -46,6 +46,8 @@ class tool_wrapper
{ return m_h->show_config(out); }
hyperclient_returncode kill(uint64_t server_id)
{ return m_h->kill(server_id); }
+ hyperclient_returncode initiate_transfer(uint64_t region_id, uint64_t server_id)
+ { return m_h->initiate_transfer(region_id, server_id); }
public:
tool_wrapper& operator = (const tool_wrapper& rhs)
View
9 common/configuration.cc
@@ -560,7 +560,14 @@ configuration :: debug_dump(std::ostream& out)
first = false;
}
- out << "]" << std::endl;
+ out << "]";
+
+ if (r.tid != transfer_id())
+ {
+ out << " " << r.tid << "->" << r.tsi;
+ }
+
+ out << std::endl;
}
}
}
View
4 common/coordinator_returncode.h
@@ -37,7 +37,9 @@ enum coordinator_returncode
COORD_SUCCESS = 8832,
COORD_MALFORMED = 8833,
COORD_DUPLICATE = 8834,
- COORD_NOT_FOUND = 8835
+ COORD_NOT_FOUND = 8835,
+ COORD_TRANSFER_IN_PROGRESS = 8836
+
};
} // namespace hyperdex
View
27 common/hyperspace.cc
@@ -351,6 +351,8 @@ region :: region()
, upper_coord()
, replicas()
, capture(false)
+ , tid()
+ , tsi()
{
}
@@ -360,6 +362,8 @@ region :: region(const region& other)
, upper_coord(other.upper_coord)
, replicas(other.replicas)
, capture(other.capture)
+ , tid(other.tid)
+ , tsi(other.tsi)
{
}
@@ -375,6 +379,8 @@ region :: operator = (const region& rhs)
upper_coord = rhs.upper_coord;
replicas = rhs.replicas;
capture = rhs.capture;
+ tid = rhs.tid;
+ tsi = rhs.tsi;
return *this;
}
@@ -383,7 +389,8 @@ hyperdex :: operator << (e::buffer::packer pa, const region& r)
{
uint16_t num_hashes = r.lower_coord.size();
uint8_t num_replicas = r.replicas.size();
- uint8_t flags = (r.capture ? 1 : 0);
+ uint8_t flags = (r.capture ? 1 : 0)
+ | (r.tid != transfer_id() ? 2 : 0);
pa = pa << r.id.get() << num_hashes << num_replicas << flags;
for (size_t i = 0; i < num_hashes; ++i)
@@ -396,6 +403,11 @@ hyperdex :: operator << (e::buffer::packer pa, const region& r)
pa = pa << r.replicas[i];
}
+ if (r.tid != transfer_id())
+ {
+ pa = pa << r.tid.get() << r.tsi.get();
+ }
+
return pa;
}
@@ -423,6 +435,15 @@ hyperdex :: operator >> (e::unpacker up, region& r)
up = up >> r.replicas[i];
}
+ if ((flags & 2))
+ {
+ uint64_t tid;
+ uint64_t tsi;
+ up = up >> tid >> tsi;
+ r.tid = transfer_id(tid);
+ r.tsi = server_id(tsi);
+ }
+
return up;
}
@@ -433,7 +454,9 @@ hyperdex :: pack_size(const region& r)
+ sizeof(uint16_t) /* num_hashes */
+ sizeof(uint8_t) /* num_replicas */
+ sizeof(uint8_t) /* flags */
- + 2 * sizeof(uint64_t) * r.lower_coord.size();
+ + 2 * sizeof(uint64_t) * r.lower_coord.size()
+ + sizeof(uint64_t) /* tid */
+ + sizeof(uint64_t); /* tsi */
for (size_t i = 0; i < r.replicas.size(); ++i)
{
View
3  common/hyperspace.h
@@ -41,6 +41,7 @@
#include "common/server_id.h"
#include "common/space_id.h"
#include "common/subspace_id.h"
+#include "common/transfer_id.h"
#include "common/virtual_server_id.h"
namespace hyperdex
@@ -130,6 +131,8 @@ class region
std::vector<uint64_t> upper_coord;
std::vector<replica> replicas;
bool capture;
+ transfer_id tid;
+ server_id tsi;
};
e::buffer::packer
View
80 common/transfer_id.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2012, Cornell University
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * Neither the name of HyperDex nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef hyperdex_common_transfer_id_h_
+#define hyperdex_common_transfer_id_h_
+
+// C
+#include <stdint.h>
+
+// C++
+#include <iostream>
+
+namespace hyperdex
+{
+
+class transfer_id
+{
+ public:
+ transfer_id() : m_id(0) {}
+ explicit transfer_id(uint64_t id) : m_id(id) {}
+
+ public:
+ uint64_t get() const { return m_id; }
+ uint64_t hash() const { return m_id; }
+
+ private:
+ uint64_t m_id;
+};
+
+inline std::ostream&
+operator << (std::ostream& lhs, const transfer_id& rhs)
+{
+ return lhs << "transfer(" << rhs.get() << ")";
+}
+
+inline bool
+operator < (const transfer_id& lhs, const transfer_id& rhs)
+{
+ return lhs.get() < rhs.get();
+}
+
+inline bool
+operator == (const transfer_id& lhs, const transfer_id& rhs)
+{
+ return lhs.get() == rhs.get();
+}
+
+inline bool
+operator != (const transfer_id& lhs, const transfer_id& rhs)
+{
+ return lhs.get() != rhs.get();
+}
+
+} // namespace hyperdex
+
+#endif // hyperdex_common_transfer_id_h_
View
108 coordinator/initiate-transfer.cc
@@ -0,0 +1,108 @@
+// Copyright (c) 2012, Cornell University
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * Neither the name of HyperDex nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+// HyperDex
+#include "coordinator/coordinator.h"
+#include "coordinator/initiate-transfer.h"
+#include "coordinator/util.h"
+
+using hyperdex::coordinator;
+using hyperdex::region;
+using hyperdex::region_id;
+using hyperdex::server_id;
+using hyperdex::space;
+using hyperdex::transfer_id;
+
+extern "C"
+{
+
+void
+hyperdex_coordinator_initiate_transfer(struct replicant_state_machine_context* ctx,
+ void* obj, const char* data, size_t data_sz)
+{
+ PROTECT_UNINITIALIZED;
+ coordinator* c = static_cast<coordinator*>(obj);
+ uint64_t _rid;
+ uint64_t _sid;
+ e::unpacker up(data, data_sz);
+ up = up >> _rid >> _sid;
+ region_id rid(_rid);
+ server_id sid(_sid);
+
+ if (up.error())
+ {
+ return generate_response(ctx, c, hyperdex::COORD_MALFORMED);
+ }
+
+ bool found = false;
+
+ for (size_t i = 0; i < c->servers.size(); ++i)
+ {
+ if (c->servers[i].first == sid)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ return generate_response(ctx, c, hyperdex::COORD_NOT_FOUND);
+ }
+
+ for (std::list<space>::iterator it = c->spaces.begin(); it != c->spaces.end(); ++it)
+ {
+ for (size_t i = 0; i < it->subspaces.size(); ++i)
+ {
+ for (size_t j = 0; j < it->subspaces[i].regions.size(); ++j)
+ {
+ if (it->subspaces[i].regions[j].id != rid)
+ {
+ continue;
+ }
+
+ region& r(it->subspaces[i].regions[j]);
+
+ if (r.tid != transfer_id())
+ {
+ return generate_response(ctx, c, hyperdex::COORD_TRANSFER_IN_PROGRESS);
+ }
+
+ r.capture = true;
+ r.tid = transfer_id(c->counter);
+ ++c->counter;
+ r.tsi = sid;
+ c->regenerate(ctx);
+ return generate_response(ctx, c, hyperdex::COORD_SUCCESS);
+ }
+ }
+ }
+
+ return generate_response(ctx, c, hyperdex::COORD_NOT_FOUND);
+}
+
+} // extern "C"
View
46 coordinator/initiate-transfer.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2012, Cornell University
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Replicant nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef hyperdex_coordinator_initiate_transfer_h_
+#define hyperdex_coordinator_initiate_transfer_h_
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Replicant */
+#include <replicant_state_machine.h>
+
+extern void
+hyperdex_coordinator_initiate_transfer(struct replicant_state_machine_context* ctx,
+ void* obj, const char* data, size_t data_sz);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+#endif /* hyperdex_coordinator_initiate_transfer_h_ */
View
2  coordinator/symtable.c
@@ -32,6 +32,7 @@
/* HyperDex */
#include "coordinator/add-space.h"
#include "coordinator/get-config.h"
+#include "coordinator/initiate-transfer.h"
#include "coordinator/kill.h"
#include "coordinator/meta.h"
#include "coordinator/register.h"
@@ -47,5 +48,6 @@ struct replicant_state_machine rsm = {
{"rm-space", hyperdex_coordinator_rm_space},
{"register", hyperdex_coordinator_register},
{"kill", hyperdex_coordinator_kill},
+ {"initiate-transfer", hyperdex_coordinator_initiate_transfer},
{NULL, NULL}}
};
View
1  daemon/daemon.cc
@@ -403,6 +403,7 @@ daemon :: register_id(server_id us, const po6::net::location& bind_to)
break;
case COORD_MALFORMED:
case COORD_NOT_FOUND:
+ case COORD_TRANSFER_IN_PROGRESS:
default:
ret = -1;
LOG(ERROR) << "could not register this instance with the coordinator "
View
146 tools/initiate-transfer.cc
@@ -0,0 +1,146 @@
+// Copyright (c) 2012, Cornell University
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * Neither the name of Replicant nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+
+// C
+#include <cstdlib>
+
+// po6
+#include <po6/error.h>
+
+// e
+#include <e/guard.h>
+
+// HyperDex
+#include "client/hyperclient.h"
+#include "client/tool_wrapper.h"
+#include "tools/common.h"
+
+static struct poptOption popts[] = {
+ POPT_AUTOHELP
+ CONNECT_TABLE
+ POPT_TABLEEND
+};
+
+int
+main(int argc, const char* argv[])
+{
+ poptContext poptcon;
+ poptcon = poptGetContext(NULL, argc, argv, popts, POPT_CONTEXT_POSIXMEHARDER);
+ e::guard g = e::makeguard(poptFreeContext, poptcon); g.use_variable();
+ poptSetOtherOptionHelp(poptcon, "[OPTIONS] <region> <server>");
+ int rc;
+
+ while ((rc = poptGetNextOpt(poptcon)) != -1)
+ {
+ switch (rc)
+ {
+ case 'h':
+ if (!check_host())
+ {
+ return EXIT_FAILURE;
+ }
+ break;
+ case 'p':
+ if (!check_port())
+ {
+ return EXIT_FAILURE;
+ }
+ break;
+ case POPT_ERROR_NOARG:
+ case POPT_ERROR_BADOPT:
+ case POPT_ERROR_BADNUMBER:
+ case POPT_ERROR_OVERFLOW:
+ std::cerr << poptStrerror(rc) << " " << poptBadOption(poptcon, 0) << std::endl;
+ return EXIT_FAILURE;
+ case POPT_ERROR_OPTSTOODEEP:
+ case POPT_ERROR_BADQUOTE:
+ case POPT_ERROR_ERRNO:
+ default:
+ std::cerr << "logic error in argument parsing" << std::endl;
+ return EXIT_FAILURE;
+ }
+ }
+
+ const char** args = poptGetArgs(poptcon);
+ size_t num_args = 0;
+
+ while (args && args[num_args])
+ {
+ ++num_args;
+ }
+
+ if (num_args != 2)
+ {
+ std::cerr << "command takes two arguments\n" << std::endl;
+ poptPrintUsage(poptcon, stderr, 0);
+ return EXIT_FAILURE;
+ }
+
+ try
+ {
+ hyperclient h(_connect_host, _connect_port);
+ hyperdex::tool_wrapper t(&h);
+ char* end;
+ end = const_cast<char*>(args[0]);
+ uint64_t rid = strtoull(args[0], &end, 0);
+
+ if (args[0] == '\0' || *end != '\0')
+ {
+ std::cerr << "first argument must be a region identifier" << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ end = const_cast<char*>(args[1]);
+ uint64_t sid = strtoull(args[1], &end, 0);
+
+ if (args[1] == '\0' || *end != '\0')
+ {
+ std::cerr << "first argument must be a region identifier" << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ hyperclient_returncode e = t.initiate_transfer(rid, sid);
+
+ if (e != HYPERCLIENT_SUCCESS)
+ {
+ std::cerr << "could not initiate transfer: " << e << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+ }
+ catch (po6::error& e)
+ {
+ std::cerr << "system error: " << e.what() << std::endl;
+ return EXIT_FAILURE;
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "error: " << e.what() << std::endl;
+ return EXIT_FAILURE;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.