You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2018/05/02 15:42:19 UTC
mesos git commit: Removed unnecessary `get()` accessors.
Repository: mesos
Updated Branches:
refs/heads/master 674db6159 -> eb371a2fa
Removed unnecessary `get()` accessors.
In many cases, containers that have a `get()` accessor also have
a `->` operator that can be used to directly access their held
object. Replace `.get().` with `->` for improved consistency and
readability.
Review: https://reviews.apache.org/r/66885/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/eb371a2f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/eb371a2f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/eb371a2f
Branch: refs/heads/master
Commit: eb371a2fa332d3fc49e14d4bfb60e6d9c294f3fd
Parents: 674db61
Author: James Peach <jp...@apache.org>
Authored: Wed May 2 08:39:24 2018 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed May 2 08:39:24 2018 -0700
----------------------------------------------------------------------
src/cli/resolve.cpp | 2 +-
src/java/jni/org_apache_mesos_Log.cpp | 10 ++--
src/linux/routing/diagnosis/diagnosis.cpp | 2 +-
src/linux/routing/filter/icmp.cpp | 4 +-
src/linux/routing/filter/internal.hpp | 54 ++++++++---------
src/linux/routing/filter/ip.cpp | 12 ++--
src/linux/routing/link/internal.hpp | 8 +--
src/linux/routing/link/link.cpp | 10 ++--
src/linux/routing/link/veth.cpp | 2 +-
src/linux/routing/queueing/internal.hpp | 12 ++--
src/linux/routing/route.cpp | 2 +-
.../mesos/isolators/network/port_mapping.cpp | 62 ++++++++++----------
.../mesos/isolators/windows/cpu.cpp | 6 +-
.../mesos/isolators/windows/mem.cpp | 2 +-
.../containerizer/mesos/isolators/xfs/disk.cpp | 6 +-
.../containerizer/mesos/isolators/xfs/utils.cpp | 6 +-
16 files changed, 100 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/cli/resolve.cpp
----------------------------------------------------------------------
diff --git a/src/cli/resolve.cpp b/src/cli/resolve.cpp
index fe62f9f..7c93d10 100644
--- a/src/cli/resolve.cpp
+++ b/src/cli/resolve.cpp
@@ -118,7 +118,7 @@ int main(int argc, char** argv)
// The future is not satisfied unless the result is Some.
CHECK_SOME(masterInfo.get());
- cout << strings::remove(masterInfo.get().get().pid(), "master@") << endl;
+ cout << strings::remove(masterInfo->get().pid(), "master@") << endl;
return EXIT_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/java/jni/org_apache_mesos_Log.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_Log.cpp b/src/java/jni/org_apache_mesos_Log.cpp
index e5e632c..1ffbacf 100644
--- a/src/java/jni/org_apache_mesos_Log.cpp
+++ b/src/java/jni/org_apache_mesos_Log.cpp
@@ -366,7 +366,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_append
? position.failure().c_str()
: "Discarded future"));
return nullptr;
- } else if (position.get().isNone()) {
+ } else if (position->isNone()) {
// Lost exclusive write promise.
env->ReleaseByteArrayElements(jdata, temp, 0);
clazz = env->FindClass("org/apache/mesos/Log$WriterFailedException");
@@ -378,7 +378,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_append
env->ReleaseByteArrayElements(jdata, temp, 0);
- jobject jposition = convert<Log::Position>(env, position.get().get());
+ jobject jposition = convert<Log::Position>(env, position->get());
return jposition;
}
@@ -430,7 +430,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_truncate
? position.failure().c_str()
: "Discarded future"));
return nullptr;
- } else if (position.get().isNone()) {
+ } else if (position->isNone()) {
// Lost exclusive write promise.
clazz = env->FindClass("org/apache/mesos/Log$WriterFailedException");
env->ThrowNew(
@@ -439,7 +439,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_mesos_Log_00024Writer_truncate
return nullptr;
}
- jobject jposition = convert<Log::Position>(env, position.get().get());
+ jobject jposition = convert<Log::Position>(env, position->get());
return jposition;
}
@@ -497,7 +497,7 @@ JNIEXPORT void JNICALL Java_org_apache_mesos_Log_00024Writer_initialize
// Cancel the pending start. It is likely that we'll retry right
// away but that is safe.
position.discard();
- } else if (position.isReady() && position.get().isSome()) {
+ } else if (position.isReady() && position->isSome()) {
// Started!
break;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/diagnosis/diagnosis.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/diagnosis/diagnosis.cpp b/src/linux/routing/diagnosis/diagnosis.cpp
index 3e80a29..eed8453 100644
--- a/src/linux/routing/diagnosis/diagnosis.cpp
+++ b/src/linux/routing/diagnosis/diagnosis.cpp
@@ -65,7 +65,7 @@ Try<vector<Info>> infos(int family, int states)
}
struct nl_cache* c = nullptr;
- int error = idiagnl_msg_alloc_cache(socket.get().get(), family, states, &c);
+ int error = idiagnl_msg_alloc_cache(socket->get(), family, states, &c);
if (error != 0) {
return Error(nl_geterror(error));
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/filter/icmp.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/icmp.cpp b/src/linux/routing/filter/icmp.cpp
index 68a1c34..b32040f 100644
--- a/src/linux/routing/filter/icmp.cpp
+++ b/src/linux/routing/filter/icmp.cpp
@@ -99,7 +99,7 @@ Try<Nothing> encode<icmp::Classifier>(
}
if (classifier.destinationIP.isSome()) {
- Try<struct in_addr> in = classifier.destinationIP.get().in();
+ Try<struct in_addr> in = classifier.destinationIP->in();
if (in.isError()) {
return Error("Destination IP is not an IPv4 address");
}
@@ -107,7 +107,7 @@ Try<Nothing> encode<icmp::Classifier>(
// To match those IP packets that have the given destination IP.
error = rtnl_u32_add_key(
cls.get(),
- in.get().s_addr,
+ in->s_addr,
htonl(0xffffffff),
16, // Offset from which to start matching.
0);
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/filter/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/internal.hpp b/src/linux/routing/filter/internal.hpp
index b22a818..4be4797 100644
--- a/src/linux/routing/filter/internal.hpp
+++ b/src/linux/routing/filter/internal.hpp
@@ -121,7 +121,7 @@ inline Try<Nothing> attach(
std::string(nl_geterror(error)));
}
- rtnl_mirred_set_ifindex(act, rtnl_link_get_ifindex(link.get().get()));
+ rtnl_mirred_set_ifindex(act, rtnl_link_get_ifindex(link->get()));
rtnl_mirred_set_action(act, TCA_EGRESS_REDIR);
rtnl_mirred_set_policy(act, TC_ACT_STOLEN);
@@ -187,7 +187,7 @@ inline Try<Nothing> attach(
std::string(nl_geterror(error)));
}
- rtnl_mirred_set_ifindex(act, rtnl_link_get_ifindex(link.get().get()));
+ rtnl_mirred_set_ifindex(act, rtnl_link_get_ifindex(link->get()));
rtnl_mirred_set_action(act, TCA_EGRESS_MIRROR);
rtnl_mirred_set_policy(act, TC_ACT_PIPE);
@@ -302,7 +302,7 @@ Result<U32Handle> generateU32Handle(
// parent on the link.
struct nl_cache* c = nullptr;
int error = rtnl_cls_alloc_cache(
- socket.get().get(),
+ socket->get(),
rtnl_link_get_ifindex(link.get()),
filter.parent.get(),
&c);
@@ -338,7 +338,7 @@ Result<U32Handle> generateU32Handle(
// If this filter has a new priority, we need to let the kernel
// decide the handle because we don't know which 'htid' this
// priority will be associated with.
- if (!htids.contains(filter.priority.get().get())) {
+ if (!htids.contains(filter.priority->get())) {
return None();
}
@@ -346,7 +346,7 @@ Result<U32Handle> generateU32Handle(
// means all filters will be in hash bucket 0. Also, kernel assigns
// node id starting from 0x800 by default. Here, we keep the same
// semantics as kernel.
- uint32_t htid = htids[filter.priority.get().get()];
+ uint32_t htid = htids[filter.priority->get()];
for (uint32_t node = 0x800; node <= 0xfff; node++) {
if (!nodes[htid].contains(node)) {
return U32Handle(htid, 0x0, node);
@@ -377,7 +377,7 @@ Try<Netlink<struct rtnl_cls>> encodeFilter(
// Encode the priority.
if (filter.priority.isSome()) {
- rtnl_cls_set_prio(cls.get(), filter.priority.get().get());
+ rtnl_cls_set_prio(cls.get(), filter.priority->get());
}
// Encode the classifier using the classifier specific function.
@@ -396,7 +396,7 @@ Try<Netlink<struct rtnl_cls>> encodeFilter(
// Encode the handle.
if (filter.handle.isSome()) {
- rtnl_tc_set_handle(TC_CAST(cls.get()), filter.handle.get().get());
+ rtnl_tc_set_handle(TC_CAST(cls.get()), filter.handle->get());
} else {
// NOTE: This is a workaround for MESOS-1617. Normally, if the
// user does not specify the handle for a filter, the kernel will
@@ -414,7 +414,7 @@ Try<Netlink<struct rtnl_cls>> encodeFilter(
// If 'handle' is none, let the kernel choose the handle.
if (handle.isSome()) {
- rtnl_tc_set_handle(TC_CAST(cls.get()), handle.get().get());
+ rtnl_tc_set_handle(TC_CAST(cls.get()), handle->get());
}
}
}
@@ -422,9 +422,9 @@ Try<Netlink<struct rtnl_cls>> encodeFilter(
// Set the classid if needed.
if (filter.classid.isSome()) {
if (rtnl_tc_get_kind(TC_CAST(cls.get())) == std::string("u32")) {
- rtnl_u32_set_classid(cls.get(), filter.classid.get().get());
+ rtnl_u32_set_classid(cls.get(), filter.classid->get());
} else if (rtnl_tc_get_kind(TC_CAST(cls.get())) == std::string("basic")) {
- rtnl_basic_set_target(cls.get(), filter.classid.get().get());
+ rtnl_basic_set_target(cls.get(), filter.classid->get());
}
}
@@ -505,7 +505,7 @@ inline Try<std::vector<Netlink<struct rtnl_cls>>> getClses(
// parent on the link.
struct nl_cache* c = nullptr;
int error = rtnl_cls_alloc_cache(
- socket.get().get(),
+ socket->get(),
rtnl_link_get_ifindex(link.get()),
parent.get(),
&c);
@@ -556,7 +556,7 @@ Result<Netlink<struct rtnl_cls>> getCls(
Result<Filter<Classifier>> filter = decodeFilter<Classifier>(cls);
if (filter.isError()) {
return Error("Failed to decode: " + filter.error());
- } else if (filter.isSome() && filter.get().classifier == classifier) {
+ } else if (filter.isSome() && filter->classifier == classifier) {
return cls;
}
}
@@ -631,8 +631,8 @@ Try<bool> create(const std::string& _link, const Filter<Classifier>& filter)
}
int error = rtnl_cls_add(
- socket.get().get(),
- cls.get().get(),
+ socket->get(),
+ cls->get(),
NLM_F_CREATE | NLM_F_EXCL);
if (error != 0) {
@@ -678,7 +678,7 @@ Try<bool> remove(
return Error(socket.error());
}
- int error = rtnl_cls_delete(socket.get().get(), cls.get().get(), 0);
+ int error = rtnl_cls_delete(socket->get(), cls.get().get(), 0);
if (error != 0) {
// TODO(jieyu): Interpret the error code and return false if it
// indicates that the filter is not found.
@@ -716,24 +716,24 @@ Try<bool> update(const std::string& _link, const Filter<Classifier>& filter)
// The kernel does not allow us to update the priority. So if the
// user specifies a priority, we will check to make sure they match.
if (filter.priority.isSome() &&
- filter.priority.get().get() != rtnl_cls_get_prio(oldCls.get().get())) {
+ filter.priority->get() != rtnl_cls_get_prio(oldCls.get().get())) {
return Error(
"The priorities do not match. The old priority is " +
- stringify(rtnl_cls_get_prio(oldCls.get().get())) +
+ stringify(rtnl_cls_get_prio(oldCls->get())) +
" and the new priority is " +
- stringify(filter.priority.get().get()));
+ stringify(filter.priority->get()));
}
// The kernel does not allow us to update the handle. So if the user
// specifies a handle, we will check to make sure they match.
if (filter.handle.isSome() &&
- filter.handle.get().get() !=
- rtnl_tc_get_handle(TC_CAST(oldCls.get().get()))) {
+ filter.handle->get() !=
+ rtnl_tc_get_handle(TC_CAST(oldCls->get()))) {
return Error(
"The handles do not match. The old handle is " +
- stringify(rtnl_tc_get_handle(TC_CAST(oldCls.get().get()))) +
+ stringify(rtnl_tc_get_handle(TC_CAST(oldCls->get()))) +
" and the new handle is " +
- stringify(filter.handle.get().get()));
+ stringify(filter.handle->get()));
}
Try<Netlink<struct rtnl_cls>> newCls = encodeFilter(link.get(), filter);
@@ -743,20 +743,20 @@ Try<bool> update(const std::string& _link, const Filter<Classifier>& filter)
// Set the handle of the new filter to match that of the old one.
rtnl_tc_set_handle(
- TC_CAST(newCls.get().get()),
- rtnl_tc_get_handle(TC_CAST(oldCls.get().get())));
+ TC_CAST(newCls->get()),
+ rtnl_tc_get_handle(TC_CAST(oldCls->get())));
// Set the priority of the new filter to match that of the old one.
rtnl_cls_set_prio(
- newCls.get().get(),
- rtnl_cls_get_prio(oldCls.get().get()));
+ newCls->get(),
+ rtnl_cls_get_prio(oldCls->get()));
Try<Netlink<struct nl_sock>> socket = routing::socket();
if (socket.isError()) {
return Error(socket.error());
}
- int error = rtnl_cls_change(socket.get().get(), newCls.get().get(), 0);
+ int error = rtnl_cls_change(socket->get(), newCls.get().get(), 0);
if (error != 0) {
if (error == -NLE_OBJ_NOTFOUND) {
return false;
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/filter/ip.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/ip.cpp b/src/linux/routing/filter/ip.cpp
index dd8cec7..851e036 100644
--- a/src/linux/routing/filter/ip.cpp
+++ b/src/linux/routing/filter/ip.cpp
@@ -156,7 +156,7 @@ Try<Nothing> encode<ip::Classifier>(
}
if (classifier.destinationIP.isSome()) {
- Try<struct in_addr> in = classifier.destinationIP.get().in();
+ Try<struct in_addr> in = classifier.destinationIP->in();
if (in.isError()) {
return Error(in.error());
}
@@ -164,7 +164,7 @@ Try<Nothing> encode<ip::Classifier>(
// To match those IP packets that have the given destination IP.
error = rtnl_u32_add_key(
cls.get(),
- in.get().s_addr,
+ in->s_addr,
htonl(0xffffffff),
16,
0);
@@ -187,8 +187,8 @@ Try<Nothing> encode<ip::Classifier>(
// | Source Port | X | X |
// +--------+--------+--------+--------+
// Offset: 20 21 22 23
- uint32_t value = ((uint32_t) classifier.sourcePorts.get().begin()) << 16;
- uint32_t mask = ((uint32_t) classifier.sourcePorts.get().mask()) << 16;
+ uint32_t value = ((uint32_t) classifier.sourcePorts->begin()) << 16;
+ uint32_t mask = ((uint32_t) classifier.sourcePorts->mask()) << 16;
// To match IP packets that have the given source ports.
error = rtnl_u32_add_key(
@@ -211,8 +211,8 @@ Try<Nothing> encode<ip::Classifier>(
// | X | X | Dest. Port |
// +--------+--------+--------+--------+
// Offset: 20 21 22 23
- uint32_t value = (uint32_t) classifier.destinationPorts.get().begin();
- uint32_t mask = (uint32_t) classifier.destinationPorts.get().mask();
+ uint32_t value = (uint32_t) classifier.destinationPorts->begin();
+ uint32_t mask = (uint32_t) classifier.destinationPorts->mask();
// To match IP packets that have the given destination ports.
error = rtnl_u32_add_key(
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/link/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/link/internal.hpp b/src/linux/routing/link/internal.hpp
index 1206407..38100ef 100644
--- a/src/linux/routing/link/internal.hpp
+++ b/src/linux/routing/link/internal.hpp
@@ -64,7 +64,7 @@ inline Result<Netlink<struct rtnl_link>> get(const std::string& link)
// Dump all the netlink link objects from kernel. Note that the flag
// AF_UNSPEC means all available families.
struct nl_cache* c = nullptr;
- int error = rtnl_link_alloc_cache(socket.get().get(), AF_UNSPEC, &c);
+ int error = rtnl_link_alloc_cache(socket->get(), AF_UNSPEC, &c);
if (error != 0) {
return Error(nl_geterror(error));
}
@@ -91,7 +91,7 @@ inline Result<Netlink<struct rtnl_link>> get(int index)
// Dump all the netlink link objects from kernel. Note that the flag
// AF_UNSPEC means all available families.
struct nl_cache* c = nullptr;
- int error = rtnl_link_alloc_cache(socket.get().get(), AF_UNSPEC, &c);
+ int error = rtnl_link_alloc_cache(socket->get(), AF_UNSPEC, &c);
if (error != 0) {
return Error(nl_geterror(error));
}
@@ -117,7 +117,7 @@ inline Result<bool> test(const std::string& _link, unsigned int flags)
return None();
}
- return flags == (rtnl_link_get_flags(link.get().get()) & flags);
+ return flags == (rtnl_link_get_flags(link->get()) & flags);
}
@@ -137,7 +137,7 @@ inline Try<bool> set(const std::string& _link, unsigned int flags)
memset(&ifr, 0, sizeof(ifr));
// Get the existing flags and take a bit-wise OR.
- ifr.ifr_flags = (rtnl_link_get_flags(link.get().get()) | flags);
+ ifr.ifr_flags = (rtnl_link_get_flags(link->get()) | flags);
strncpy(ifr.ifr_name, _link.c_str(), IFNAMSIZ);
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/link/link.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/link/link.cpp b/src/linux/routing/link/link.cpp
index 5388a3d..9dc30c5 100644
--- a/src/linux/routing/link/link.cpp
+++ b/src/linux/routing/link/link.cpp
@@ -132,7 +132,7 @@ Try<bool> remove(const string& _link)
return Error(socket.error());
}
- int error = rtnl_link_delete(socket.get().get(), link.get().get());
+ int error = rtnl_link_delete(socket->get(), link.get().get());
if (error != 0) {
if (error == -NLE_OBJ_NOTFOUND || error == -NLE_NODEV) {
return false;
@@ -217,7 +217,7 @@ Result<int> index(const string& _link)
return None();
}
- return rtnl_link_get_ifindex(link.get().get());
+ return rtnl_link_get_ifindex(link->get());
}
@@ -230,7 +230,7 @@ Result<string> name(int index)
return None();
}
- return rtnl_link_get_name(link.get().get());
+ return rtnl_link_get_name(link->get());
}
@@ -308,7 +308,7 @@ Result<unsigned int> mtu(const string& _link)
return None();
}
- return rtnl_link_get_mtu(link.get().get());
+ return rtnl_link_get_mtu(link->get());
}
@@ -396,7 +396,7 @@ Result<hashmap<string, uint64_t>> statistics(const string& _link)
for (size_t i = 0; i < size; i++) {
rtnl_link_stat2str(stats[i], buf, 32);
- results[buf] = rtnl_link_get_stat(link.get().get(), stats[i]);
+ results[buf] = rtnl_link_get_stat(link->get(), stats[i]);
}
return results;
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/link/veth.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/link/veth.cpp b/src/linux/routing/link/veth.cpp
index e12af9f..6aeb95e 100644
--- a/src/linux/routing/link/veth.cpp
+++ b/src/linux/routing/link/veth.cpp
@@ -43,7 +43,7 @@ Try<bool> create(
}
int error = rtnl_link_veth_add(
- socket.get().get(),
+ socket->get(),
veth.c_str(),
peer.c_str(),
(pid.isNone() ? getpid() : pid.get()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/queueing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/queueing/internal.hpp b/src/linux/routing/queueing/internal.hpp
index 9fe522e..a7b460b 100644
--- a/src/linux/routing/queueing/internal.hpp
+++ b/src/linux/routing/queueing/internal.hpp
@@ -96,7 +96,7 @@ Try<Netlink<struct rtnl_qdisc>> encodeDiscipline(
rtnl_tc_set_parent(TC_CAST(qdisc.get()), discipline.parent.get());
if (discipline.handle.isSome()) {
- rtnl_tc_set_handle(TC_CAST(qdisc.get()), discipline.handle.get().get());
+ rtnl_tc_set_handle(TC_CAST(qdisc.get()), discipline.handle->get());
}
int error = rtnl_tc_set_kind(TC_CAST(qdisc.get()), discipline.kind.c_str());
@@ -132,7 +132,7 @@ inline Try<std::vector<Netlink<struct rtnl_qdisc>>> getQdiscs(
// Dump all the queueing discipline from kernel.
struct nl_cache* c = nullptr;
- int error = rtnl_qdisc_alloc_cache(socket.get().get(), &c);
+ int error = rtnl_qdisc_alloc_cache(socket->get(), &c);
if (error != 0) {
return Error(
"Failed to get queueing discipline info from kernel: " +
@@ -241,8 +241,8 @@ Try<bool> create(
// The flag NLM_F_EXCL tells libnl that if the qdisc already exists,
// this function should return error.
int error = rtnl_qdisc_add(
- socket.get().get(),
- qdisc.get().get(),
+ socket->get(),
+ qdisc->get(),
NLM_F_CREATE | NLM_F_EXCL);
if (error != 0) {
@@ -285,7 +285,7 @@ inline Try<bool> remove(
return Error(socket.error());
}
- int error = rtnl_qdisc_delete(socket.get().get(), qdisc.get().get());
+ int error = rtnl_qdisc_delete(socket->get(), qdisc.get().get());
if (error != 0) {
// TODO(jieyu): Interpret the error code and return false if it
// indicates that the queueing discipline is not found.
@@ -326,7 +326,7 @@ inline Result<hashmap<std::string, uint64_t>> statistics(
for (size_t i = 0; i <= static_cast<size_t>(RTNL_TC_STATS_MAX); i++) {
if (rtnl_tc_stat2str(static_cast<rtnl_tc_stat>(i), name, sizeof(name))) {
results[name] = rtnl_tc_get_stat(
- TC_CAST(qdisc.get().get()),
+ TC_CAST(qdisc->get()),
static_cast<rtnl_tc_stat>(i));
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/linux/routing/route.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/route.cpp b/src/linux/routing/route.cpp
index ba39eac..bdf29a9 100644
--- a/src/linux/routing/route.cpp
+++ b/src/linux/routing/route.cpp
@@ -54,7 +54,7 @@ Try<vector<Rule>> table()
// Dump all the routes (for IPv4) from kernel.
struct nl_cache* c = nullptr;
- int error = rtnl_route_alloc_cache(socket.get().get(), AF_INET, 0, &c);
+ int error = rtnl_route_alloc_cache(socket->get(), AF_INET, 0, &c);
if (error != 0) {
return Error(nl_geterror(error));
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
index 96e1a2b..3f51542 100644
--- a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
@@ -1091,8 +1091,8 @@ int PortMappingStatistics::execute()
}
// We consider all sockets that have non-zero rtt value.
- if (info.tcpInfo.isSome() && info.tcpInfo.get().tcpi_rtt != 0) {
- RTTs.push_back(info.tcpInfo.get().tcpi_rtt);
+ if (info.tcpInfo.isSome() && info.tcpInfo->tcpi_rtt != 0) {
+ RTTs.push_back(info.tcpInfo->tcpi_rtt);
}
}
@@ -1412,14 +1412,14 @@ Try<Isolator*> PortMappingIsolatorProcess::create(const Flags& flags)
// Get 'ports' resource from 'resources' flag. These ports will be
// treated as non-ephemeral ports.
IntervalSet<uint16_t> nonEphemeralPorts;
- if (resources.get().ports().isSome()) {
+ if (resources->ports().isSome()) {
Try<IntervalSet<uint16_t>> ports = rangesToIntervalSet<uint16_t>(
- resources.get().ports().get());
+ resources->ports().get());
if (ports.isError()) {
return Error(
"Invalid ports resource '" +
- stringify(resources.get().ports().get()) +
+ stringify(resources->ports().get()) +
"': " + ports.error());
}
@@ -1429,14 +1429,14 @@ Try<Isolator*> PortMappingIsolatorProcess::create(const Flags& flags)
// Get 'ephemeral_ports' resource from 'resources' flag. These ports
// will be allocated to each container as ephemeral ports.
IntervalSet<uint16_t> ephemeralPorts;
- if (resources.get().ephemeral_ports().isSome()) {
+ if (resources->ephemeral_ports().isSome()) {
Try<IntervalSet<uint16_t>> ports = rangesToIntervalSet<uint16_t>(
- resources.get().ephemeral_ports().get());
+ resources->ephemeral_ports().get());
if (ports.isError()) {
return Error(
"Invalid ephemeral ports resource '" +
- stringify(resources.get().ephemeral_ports().get()) +
+ stringify(resources->ephemeral_ports().get()) +
"': " + ports.error());
}
@@ -1632,10 +1632,10 @@ Try<Isolator*> PortMappingIsolatorProcess::create(const Flags& flags)
} else {
// Convert host link speed to Bytes/s for comparason.
if (hostLinkSpeed.get() * 1000000 / 8 <
- flags.egress_rate_limit_per_container.get().bytes()) {
+ flags.egress_rate_limit_per_container->bytes()) {
return Error(
"The given egress traffic limit for containers " +
- stringify(flags.egress_rate_limit_per_container.get().bytes()) +
+ stringify(flags.egress_rate_limit_per_container->bytes()) +
" Bytes/s is greater than the host link speed " +
stringify(hostLinkSpeed.get() * 1000000 / 8) + " Bytes/s");
}
@@ -1733,7 +1733,7 @@ Try<Isolator*> PortMappingIsolatorProcess::create(const Flags& flags)
if (egressParentHandle.get() != EGRESS_ROOT) {
// TODO(cwang): This is just a guess, we do not know if this
// handle is available or not.
- hostTxFqCodelHandle = Handle(egressParentHandle.get().primary() + 1, 0);
+ hostTxFqCodelHandle = Handle(egressParentHandle->primary() + 1, 0);
}
// Prepare a fq_codel queueing discipline on host public interface
@@ -2390,7 +2390,7 @@ PortMappingIsolatorProcess::_recover(pid_t pid)
" detected on egress of " + eth0);
}
- flowIds[sourcePorts.get()] = classid.get().secondary();
+ flowIds[sourcePorts.get()] = classid->secondary();
}
}
@@ -2426,8 +2426,8 @@ PortMappingIsolatorProcess::_recover(pid_t pid)
}
Interval<uint16_t> ports =
- (Bound<uint16_t>::closed(sourcePorts.get().begin()),
- Bound<uint16_t>::closed(sourcePorts.get().end()));
+ (Bound<uint16_t>::closed(sourcePorts->begin()),
+ Bound<uint16_t>::closed(sourcePorts->end()));
if (managedNonEphemeralPorts.contains(ports)) {
nonEphemeralPorts += ports;
@@ -2933,16 +2933,16 @@ void PortMappingIsolatorProcess::_update(
LOG(ERROR) << "Failed to start a process for updating container "
<< containerId << ": "
<< (status.isFailed() ? status.failure() : "discarded");
- } else if (status.get().isNone()) {
+ } else if (status->isNone()) {
++metrics.updating_container_ip_filters_errors;
LOG(ERROR) << "The process for updating container " << containerId
<< " is not expected to be reaped elsewhere";
- } else if (status.get().get() != 0) {
+ } else if (status->get() != 0) {
++metrics.updating_container_ip_filters_errors;
LOG(ERROR) << "The process for updating container " << containerId << " "
- << WSTRINGIFY(status.get().get());
+ << WSTRINGIFY(status->get());
} else {
LOG(INFO) << "The process for updating container " << containerId
<< " finished successfully";
@@ -3036,8 +3036,8 @@ Future<Nothing> PortMappingIsolatorProcess::update(
}
Interval<uint16_t> ports =
- (Bound<uint16_t>::closed(sourcePorts.get().begin()),
- Bound<uint16_t>::closed(sourcePorts.get().end()));
+ (Bound<uint16_t>::closed(sourcePorts->begin()),
+ Bound<uint16_t>::closed(sourcePorts->end()));
// Skip the ephemeral ports.
if (ports == info->ephemeralPorts) {
@@ -3114,7 +3114,7 @@ Future<Nothing> PortMappingIsolatorProcess::update(
return Failure("Failed to launch update subcommand: " + s.error());
}
- return s.get().status()
+ return s->status()
.onAny(defer(
PID<PortMappingIsolatorProcess>(this),
&PortMappingIsolatorProcess::_update,
@@ -3171,42 +3171,42 @@ Future<ResourceStatistics> PortMappingIsolatorProcess::usage(
// | | | |
// +----------+ +----------+
- Option<uint64_t> rx_packets = stat.get().get("tx_packets");
+ Option<uint64_t> rx_packets = stat->get("tx_packets");
if (rx_packets.isSome()) {
result.set_net_rx_packets(rx_packets.get());
}
- Option<uint64_t> rx_bytes = stat.get().get("tx_bytes");
+ Option<uint64_t> rx_bytes = stat->get("tx_bytes");
if (rx_bytes.isSome()) {
result.set_net_rx_bytes(rx_bytes.get());
}
- Option<uint64_t> rx_errors = stat.get().get("tx_errors");
+ Option<uint64_t> rx_errors = stat->get("tx_errors");
if (rx_errors.isSome()) {
result.set_net_rx_errors(rx_errors.get());
}
- Option<uint64_t> rx_dropped = stat.get().get("tx_dropped");
+ Option<uint64_t> rx_dropped = stat->get("tx_dropped");
if (rx_dropped.isSome()) {
result.set_net_rx_dropped(rx_dropped.get());
}
- Option<uint64_t> tx_packets = stat.get().get("rx_packets");
+ Option<uint64_t> tx_packets = stat->get("rx_packets");
if (tx_packets.isSome()) {
result.set_net_tx_packets(tx_packets.get());
}
- Option<uint64_t> tx_bytes = stat.get().get("rx_bytes");
+ Option<uint64_t> tx_bytes = stat->get("rx_bytes");
if (tx_bytes.isSome()) {
result.set_net_tx_bytes(tx_bytes.get());
}
- Option<uint64_t> tx_errors = stat.get().get("rx_errors");
+ Option<uint64_t> tx_errors = stat->get("rx_errors");
if (tx_errors.isSome()) {
result.set_net_tx_errors(tx_errors.get());
}
- Option<uint64_t> tx_dropped = stat.get().get("rx_dropped");
+ Option<uint64_t> tx_dropped = stat->get("rx_dropped");
if (tx_dropped.isSome()) {
result.set_net_tx_dropped(tx_dropped.get());
}
@@ -3244,7 +3244,7 @@ Future<ResourceStatistics> PortMappingIsolatorProcess::usage(
// writing to its end of the pipe and never exit because the pipe
// has limited buffer size, but we have been careful to send very
// few bytes so this shouldn't be a problem.
- return s.get().status()
+ return s->status()
.then(defer(
PID<PortMappingIsolatorProcess>(this),
&PortMappingIsolatorProcess::_usage,
@@ -3286,7 +3286,7 @@ Future<ResourceStatistics> PortMappingIsolatorProcess::__usage(
CHECK_READY(out);
// NOTE: It's possible the subprocess has no output.
- if (out.get().empty()) {
+ if (out->empty()) {
return result;
}
@@ -4079,7 +4079,7 @@ string PortMappingIsolatorProcess::scripts(Info* info)
script << "tc class add dev " << eth0 << " parent "
<< CONTAINER_TX_HTB_HANDLE << " classid "
<< CONTAINER_TX_HTB_CLASS_ID << " htb rate "
- << egressRateLimitPerContainer.get().bytes() * 8 << "bit\n";
+ << egressRateLimitPerContainer->bytes() * 8 << "bit\n";
// Packets are buffered at the leaf qdisc if we send them faster
// than the HTB rate limit and may be dropped when the queue is
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/slave/containerizer/mesos/isolators/windows/cpu.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/windows/cpu.cpp b/src/slave/containerizer/mesos/isolators/windows/cpu.cpp
index 104e35d..0c8a1df 100644
--- a/src/slave/containerizer/mesos/isolators/windows/cpu.cpp
+++ b/src/slave/containerizer/mesos/isolators/windows/cpu.cpp
@@ -212,14 +212,14 @@ Future<ResourceStatistics> WindowsCpuIsolatorProcess::usage(
return result;
}
- result.set_processes(info.get().ActiveProcesses);
+ result.set_processes(info->ActiveProcesses);
// The reported time fields are in 100-nanosecond ticks.
result.set_cpus_user_time_secs(
- Nanoseconds(info.get().TotalUserTime.QuadPart * 100).secs());
+ Nanoseconds(info->TotalUserTime.QuadPart * 100).secs());
result.set_cpus_system_time_secs(
- Nanoseconds(info.get().TotalKernelTime.QuadPart * 100).secs());
+ Nanoseconds(info->TotalKernelTime.QuadPart * 100).secs());
return result;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/slave/containerizer/mesos/isolators/windows/mem.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/windows/mem.cpp b/src/slave/containerizer/mesos/isolators/windows/mem.cpp
index eb6c93e..8b45752 100644
--- a/src/slave/containerizer/mesos/isolators/windows/mem.cpp
+++ b/src/slave/containerizer/mesos/isolators/windows/mem.cpp
@@ -210,7 +210,7 @@ Future<ResourceStatistics> WindowsMemIsolatorProcess::usage(
const Try<Bytes> mem_total_bytes =
os::get_job_mem(infos[containerId].pid.get());
if (mem_total_bytes.isSome()) {
- result.set_mem_total_bytes(mem_total_bytes.get().bytes());
+ result.set_mem_total_bytes(mem_total_bytes->bytes());
}
return result;
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/slave/containerizer/mesos/isolators/xfs/disk.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/xfs/disk.cpp b/src/slave/containerizer/mesos/isolators/xfs/disk.cpp
index db11f9a..362996b 100644
--- a/src/slave/containerizer/mesos/isolators/xfs/disk.cpp
+++ b/src/slave/containerizer/mesos/isolators/xfs/disk.cpp
@@ -140,16 +140,16 @@ Try<Isolator*> XfsDiskIsolatorProcess::create(const Flags& flags)
flags.xfs_project_range + "'");
}
- if (projects.get().type() != Value::RANGES) {
+ if (projects->type() != Value::RANGES) {
return Error(
"Invalid XFS project resource type " +
- mesos::Value_Type_Name(projects.get().type()) +
+ mesos::Value_Type_Name(projects->type()) +
", expecting " +
mesos::Value_Type_Name(Value::RANGES));
}
Try<IntervalSet<prid_t>> totalProjectIds =
- getIntervalSet(projects.get().ranges());
+ getIntervalSet(projects->ranges());
if (totalProjectIds.isError()) {
return Error(totalProjectIds.error());
http://git-wip-us.apache.org/repos/asf/mesos/blob/eb371a2f/src/slave/containerizer/mesos/isolators/xfs/utils.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/xfs/utils.cpp b/src/slave/containerizer/mesos/isolators/xfs/utils.cpp
index cc14254..b691c76 100644
--- a/src/slave/containerizer/mesos/isolators/xfs/utils.cpp
+++ b/src/slave/containerizer/mesos/isolators/xfs/utils.cpp
@@ -155,7 +155,7 @@ static Try<Nothing> setProjectQuota(
quota.d_blk_softlimit = BasicBlocks(softLimit).blocks();
if (::quotactl(QCMD(Q_XSETQLIM, PRJQUOTA),
- devname.get().c_str(),
+ devname->c_str(),
projectId,
reinterpret_cast<caddr_t>("a)) == -1) {
return ErrnoError("Failed to set quota for project ID " +
@@ -230,7 +230,7 @@ Result<QuotaInfo> getProjectQuota(
// date.
if (::quotactl(QCMD(Q_XGETQUOTA, PRJQUOTA),
- devname.get().c_str(),
+ devname->c_str(),
projectId,
reinterpret_cast<caddr_t>("a)) == -1) {
return ErrnoError("Failed to get quota for project ID " +
@@ -429,7 +429,7 @@ Try<bool> isQuotaEnabled(const string& path)
// because we are getting global information rather than information for
// a specific identity (eg. a projectId).
if (::quotactl(QCMD(Q_XGETQSTATV, 0),
- devname.get().c_str(),
+ devname->c_str(),
0, // id
reinterpret_cast<caddr_t>(&statv)) == -1) {
// ENOSYS means that quotas are not enabled at all.