You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2018/02/21 13:33:42 UTC
[1/4] mesos git commit: Removed some redundant `get` calls.
Repository: mesos
Updated Branches:
refs/heads/master e649b41d1 -> 49c642e98
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 613a33b..81aa0d7 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -307,8 +307,8 @@ protected:
EXIT(EXIT_FAILURE) << "Failed to detect a master: " << _master.failure();
}
- if (_master.get().isSome()) {
- master = _master.get().get();
+ if (_master->isSome()) {
+ master = _master->get();
} else {
master = None();
}
@@ -333,8 +333,8 @@ protected:
connected = false;
if (master.isSome()) {
- LOG(INFO) << "New master detected at " << master.get().pid();
- link(master.get().pid());
+ LOG(INFO) << "New master detected at " << master->pid();
+ link(master->pid());
// Cancel the pending registration timer to avoid spurious attempts
// at reregistration. `Clock::cancel` is idempotent, so this call
@@ -393,7 +393,7 @@ protected:
return;
}
- LOG(INFO) << "Authenticating with master " << master.get().pid();
+ LOG(INFO) << "Authenticating with master " << master->pid();
CHECK_SOME(credential);
@@ -428,7 +428,7 @@ protected:
// --> '~Authenticatee()' is invoked by 'AuthenticateeProcess'.
// TODO(vinod): Consider using 'Shared' to 'Owned' upgrade.
authenticating =
- authenticatee->authenticate(master.get().pid(), self(), credential.get())
+ authenticatee->authenticate(master->pid(), self(), credential.get())
.onAny(defer(self(), &Self::_authenticate));
delay(flags.authentication_timeout,
@@ -464,7 +464,7 @@ protected:
if (reauthenticate || !future.isReady()) {
LOG(INFO)
- << "Failed to authenticate with master " << master.get().pid() << ": "
+ << "Failed to authenticate with master " << master->pid() << ": "
<< (reauthenticate ? "master changed" :
(future.isFailed() ? future.failure() : "future discarded"));
@@ -493,14 +493,12 @@ protected:
}
if (!future.get()) {
- LOG(ERROR) << "Master " << master.get().pid()
- << " refused authentication";
+ LOG(ERROR) << "Master " << master->pid() << " refused authentication";
error("Master refused authentication");
return;
}
- LOG(INFO) << "Successfully authenticated with master "
- << master.get().pid();
+ LOG(INFO) << "Successfully authenticated with master " << master->pid();
authenticated = true;
authenticating = None();
@@ -740,11 +738,11 @@ protected:
return;
}
- if (master.isNone() || from != master.get().pid()) {
+ if (master.isNone() || from != master->pid()) {
LOG(WARNING)
<< "Ignoring framework registered message because it was sent "
<< "from '" << from << "' instead of the leading master '"
- << (master.isSome() ? UPID(master.get().pid()) : UPID()) << "'";
+ << (master.isSome() ? UPID(master->pid()) : UPID()) << "'";
return;
}
@@ -782,11 +780,11 @@ protected:
return;
}
- if (master.isNone() || from != master.get().pid()) {
+ if (master.isNone() || from != master->pid()) {
LOG(WARNING)
<< "Ignoring framework re-registered message because it was sent "
<< "from '" << from << "' instead of the leading master '"
- << (master.isSome() ? UPID(master.get().pid()) : UPID()) << "'";
+ << (master.isSome() ? UPID(master->pid()) : UPID()) << "'";
return;
}
@@ -821,7 +819,7 @@ protected:
return;
}
- VLOG(1) << "Sending SUBSCRIBE call to " << master.get().pid();
+ VLOG(1) << "Sending SUBSCRIBE call to " << master->pid();
Call call;
call.set_type(Call::SUBSCRIBE);
@@ -834,7 +832,7 @@ protected:
call.mutable_framework_id()->CopyFrom(framework.id());
}
- send(master.get().pid(), call);
+ send(master->pid(), call);
// Bound the maximum backoff by 'REGISTRATION_RETRY_INTERVAL_MAX'.
maxBackoff =
@@ -880,10 +878,10 @@ protected:
CHECK_SOME(master);
- if (from != master.get().pid()) {
+ if (from != master->pid()) {
VLOG(1) << "Ignoring resource offers message because it was sent "
<< "from '" << from << "' instead of the leading master '"
- << master.get().pid() << "'";
+ << master->pid() << "'";
return;
}
@@ -937,10 +935,10 @@ protected:
CHECK_SOME(master);
- if (from != master.get().pid()) {
+ if (from != master->pid()) {
VLOG(1) << "Ignoring rescind offer message because it was sent "
<< "from '" << from << "' instead of the leading master '"
- << master.get().pid() << "'";
+ << master->pid() << "'";
return;
}
@@ -979,10 +977,10 @@ protected:
CHECK_SOME(master);
- if (from != master.get().pid()) {
+ if (from != master->pid()) {
VLOG(1) << "Ignoring status update message because it was sent "
<< "from '" << from << "' instead of the leading master '"
- << master.get().pid() << "'";
+ << master->pid() << "'";
return;
}
}
@@ -1046,7 +1044,7 @@ protected:
CHECK_SOME(master);
VLOG(2) << "Sending ACK for status update " << update
- << " to " << master.get().pid();
+ << " to " << master->pid();
Call call;
@@ -1060,7 +1058,7 @@ protected:
acknowledge->set_uuid(update.uuid());
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
}
}
@@ -1081,10 +1079,10 @@ protected:
CHECK_SOME(master);
- if (from != master.get().pid()) {
+ if (from != master->pid()) {
VLOG(1) << "Ignoring lost agent message because it was sent "
<< "from '" << from << "' instead of the leading master '"
- << master.get().pid() << "'";
+ << master->pid() << "'";
return;
}
@@ -1121,10 +1119,10 @@ protected:
}
CHECK_SOME(master);
- if (from != master.get().pid()) {
+ if (from != master->pid()) {
VLOG(1) << "Ignoring lost executor message because it was sent "
<< "from '" << from << "' instead of the leading master '"
- << master.get().pid() << "'";
+ << master->pid() << "'";
return;
}
@@ -1202,7 +1200,7 @@ protected:
call.set_type(Call::TEARDOWN);
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
synchronized (mutex) {
@@ -1228,7 +1226,7 @@ protected:
DeactivateFrameworkMessage message;
message.mutable_framework_id()->MergeFrom(framework.id());
CHECK_SOME(master);
- send(master.get().pid(), message);
+ send(master->pid(), message);
}
synchronized (mutex) {
@@ -1253,7 +1251,7 @@ protected:
kill->mutable_task_id()->CopyFrom(taskId);
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
void requestResources(const vector<Request>& requests)
@@ -1275,7 +1273,7 @@ protected:
}
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
void launchTasks(const vector<OfferID>& offerIds,
@@ -1386,7 +1384,7 @@ protected:
accept->mutable_filters()->CopyFrom(filters);
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
void declineOffer(
@@ -1417,7 +1415,7 @@ protected:
decline->mutable_filters()->CopyFrom(filters);
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
void reviveOffers()
@@ -1434,7 +1432,7 @@ protected:
call.set_type(Call::REVIVE);
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
void suppressOffers()
@@ -1451,7 +1449,7 @@ protected:
call.set_type(Call::SUPPRESS);
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
void acknowledgeStatusUpdate(
@@ -1484,7 +1482,7 @@ protected:
VLOG(2) << "Sending ACK for status update " << status.uuid()
<< " of task " << status.task_id()
<< " on agent " << status.slave_id()
- << " to " << master.get().pid();
+ << " to " << master->pid();
Call call;
@@ -1497,7 +1495,7 @@ protected:
acknowledge->mutable_task_id()->CopyFrom(status.task_id());
acknowledge->set_uuid(status.uuid());
- send(master.get().pid(), call);
+ send(master->pid(), call);
} else {
VLOG(2) << "Received ACK for status update"
<< (status.has_uuid() ? " " + status.uuid() : "")
@@ -1553,7 +1551,7 @@ protected:
message->set_data(data);
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
}
@@ -1581,7 +1579,7 @@ protected:
}
CHECK_SOME(master);
- send(master.get().pid(), call);
+ send(master->pid(), call);
}
private:
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index 07d2b37..ecef916 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -473,7 +473,7 @@ protected:
master = None();
latest = None();
} else {
- const UPID& upid = future.get().get().pid();
+ const UPID& upid = future.get()->pid();
latest = future.get();
string scheme = "http";
@@ -718,7 +718,7 @@ protected:
if (event->isError()) {
error("Failed to de-serialize event: " + event->error());
} else {
- receive(event.get().get(), false);
+ receive(event->get(), false);
}
read();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/container_loggers/lib_logrotate.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/lib_logrotate.cpp b/src/slave/container_loggers/lib_logrotate.cpp
index bc13e6a..575ed6e 100644
--- a/src/slave/container_loggers/lib_logrotate.cpp
+++ b/src/slave/container_loggers/lib_logrotate.cpp
@@ -209,7 +209,7 @@ public:
// ownership of the FDs. See the NOTE above.
if (::pipe(pipefd) == -1) {
os::close(outfds.write.get());
- os::killtree(outProcess.get().pid(), SIGKILL);
+ os::killtree(outProcess->pid(), SIGKILL);
return Failure(ErrnoError("Failed to create pipe").message);
}
@@ -224,7 +224,7 @@ public:
os::close(outfds.write.get());
os::close(errfds.read);
os::close(errfds.write.get());
- os::killtree(outProcess.get().pid(), SIGKILL);
+ os::killtree(outProcess->pid(), SIGKILL);
return Failure("Failed to cloexec: " + cloexec.error());
}
@@ -250,7 +250,7 @@ public:
if (errProcess.isError()) {
os::close(outfds.write.get());
os::close(errfds.write.get());
- os::killtree(outProcess.get().pid(), SIGKILL);
+ os::killtree(outProcess->pid(), SIGKILL);
return Failure("Failed to create logger process: " + errProcess.error());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/containerizer.cpp b/src/slave/containerizer/containerizer.cpp
index fa1d24a..59f107a 100644
--- a/src/slave/containerizer/containerizer.cpp
+++ b/src/slave/containerizer/containerizer.cpp
@@ -148,7 +148,7 @@ Try<Resources> Containerizer::resources(const Flags& flags)
<< "' ; defaulting to DEFAULT_MEM";
mem = DEFAULT_MEM;
} else {
- Bytes total = mem_.get().total;
+ Bytes total = mem_->total;
if (total >= Gigabytes(2)) {
mem = total - Gigabytes(1); // Leave 1GB free.
} else {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 7585178..5136289 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -149,7 +149,7 @@ Option<ContainerID> parse(const Docker::Container& container)
// Check if id is a valid UUID.
if (containerId.isSome()) {
- Try<id::UUID> uuid = id::UUID::fromString(containerId.get().value());
+ Try<id::UUID> uuid = id::UUID::fromString(containerId->value());
if (uuid.isError()) {
return None();
}
@@ -659,7 +659,7 @@ Try<Nothing> DockerContainerizerProcess::unmountPersistentVolumes(
vector<string> unmountErrors;
foreach (const fs::MountInfoTable::Entry& entry,
- adaptor::reverse(table.get().entries)) {
+ adaptor::reverse(table->entries)) {
// TODO(tnachen): We assume there is only one docker container
// running per container Id and no other mounts will have the
// container Id name. We might need to revisit if this is no
@@ -967,8 +967,8 @@ Future<Nothing> DockerContainerizerProcess::_recover(
const ContainerID& containerId = executor.latest.get();
Option<RunState> run = executor.runs.get(containerId);
CHECK_SOME(run);
- CHECK_SOME(run.get().id);
- CHECK_EQ(containerId, run.get().id.get());
+ CHECK_SOME(run->id);
+ CHECK_EQ(containerId, run->id.get());
// We need the pid so the reaper can monitor the executor so skip this
// executor if it's not present. We will also skip this executor if the
@@ -977,11 +977,11 @@ Future<Nothing> DockerContainerizerProcess::_recover(
// immediately. Both of these two cases are safe to skip because the
// slave will try to wait on the container which will return `None()`
// and everything will get cleaned up.
- if (run.get().forkedPid.isNone() || run.get().libprocessPid.isNone()) {
+ if (run->forkedPid.isNone() || run->libprocessPid.isNone()) {
continue;
}
- if (run.get().completed) {
+ if (run->completed) {
VLOG(1) << "Skipping recovery of executor '" << executor.id
<< "' of framework " << framework.id
<< " because its latest run "
@@ -1032,7 +1032,7 @@ Future<Nothing> DockerContainerizerProcess::_recover(
// by another process or two processes respectively after the agent
// host reboots we will still reap an irrelevant process, but that
// should be highly unlikely.
- pid_t pid = run.get().forkedPid.get();
+ pid_t pid = run->forkedPid.get();
// Create a TCP socket.
int_fd socket = ::socket(AF_INET, SOCK_STREAM, 0);
@@ -1044,7 +1044,7 @@ Future<Nothing> DockerContainerizerProcess::_recover(
Try<Nothing, SocketError> connect = process::network::connect(
socket,
- run.get().libprocessPid->address);
+ run->libprocessPid->address);
if (connect.isSome()) {
container->status.set(process::reap(pid));
@@ -1060,8 +1060,8 @@ Future<Nothing> DockerContainerizerProcess::_recover(
shutdown(socket, SHUT_RDWR);
close(socket);
- container->status.future().get()
- .onAny(defer(self(), &Self::reaped, containerId));
+ container->status.future()
+ ->onAny(defer(self(), &Self::reaped, containerId));
if (pids.containsValue(pid)) {
// This should (almost) never occur. There is the
@@ -1615,7 +1615,7 @@ Future<pid_t> DockerContainerizerProcess::launchExecutorProcess(
return Failure("Failed to fork executor: " + s.error());
}
- return s.get().pid();
+ return s->pid();
}));
}
@@ -1658,8 +1658,8 @@ Future<Nothing> DockerContainerizerProcess::reapExecutor(
// And finally watch for when the container gets reaped.
container->status.set(process::reap(pid));
- container->status.future().get()
- .onAny(defer(self(), &Self::reaped, containerId));
+ container->status.future()
+ ->onAny(defer(self(), &Self::reaped, containerId));
return Nothing();
}
@@ -1960,7 +1960,7 @@ Future<ResourceStatistics> DockerContainerizerProcess::usage(
const Resources& resource = container->resources;
const Option<Bytes> mem = resource.mem();
if (mem.isSome()) {
- result.set_mem_limit_bytes(mem.get().bytes());
+ result.set_mem_limit_bytes(mem->bytes());
}
const Option<double> cpus = resource.cpus();
@@ -2072,15 +2072,15 @@ Try<ResourceStatistics> DockerContainerizerProcess::cgroupsStatistics(
memStats.error());
}
- if (!memStats.get().contains("rss")) {
+ if (!memStats->contains("rss")) {
return Error("cgroups memory stats does not contain 'rss' data");
}
ResourceStatistics result;
result.set_timestamp(Clock::now().secs());
- result.set_cpus_system_time_secs(cpuAcctStat.get().system.secs());
- result.set_cpus_user_time_secs(cpuAcctStat.get().user.secs());
- result.set_mem_rss_bytes(memStats.get().at("rss"));
+ result.set_cpus_system_time_secs(cpuAcctStat->system.secs());
+ result.set_cpus_user_time_secs(cpuAcctStat->user.secs());
+ result.set_mem_rss_bytes(memStats->at("rss"));
// Add the cpu.stat information only if CFS is enabled.
if (flags.cgroups_enable_cfs) {
@@ -2112,17 +2112,17 @@ Try<ResourceStatistics> DockerContainerizerProcess::cgroupsStatistics(
return Error("Failed to read cpu.stat: " + stat.error());
}
- Option<uint64_t> nr_periods = stat.get().get("nr_periods");
+ Option<uint64_t> nr_periods = stat->get("nr_periods");
if (nr_periods.isSome()) {
result.set_cpus_nr_periods(nr_periods.get());
}
- Option<uint64_t> nr_throttled = stat.get().get("nr_throttled");
+ Option<uint64_t> nr_throttled = stat->get("nr_throttled");
if (nr_throttled.isSome()) {
result.set_cpus_nr_throttled(nr_throttled.get());
}
- Option<uint64_t> throttled_time = stat.get().get("throttled_time");
+ Option<uint64_t> throttled_time = stat->get("throttled_time");
if (throttled_time.isSome()) {
result.set_cpus_throttled_time_secs(
Nanoseconds(throttled_time.get()).secs());
@@ -2398,8 +2398,8 @@ void DockerContainerizerProcess::__destroy(
// Status must be ready since we did a Docker::kill.
CHECK_READY(container->status.future());
- container->status.future().get()
- .onAny(defer(self(), &Self::___destroy, containerId, killed, lambda::_1));
+ container->status.future()
+ ->onAny(defer(self(), &Self::___destroy, containerId, killed, lambda::_1));
}
@@ -2443,8 +2443,8 @@ void DockerContainerizerProcess::____destroy(
ContainerTermination termination;
- if (status.isReady() && status.get().isSome()) {
- termination.set_status(status.get().get());
+ if (status.isReady() && status->isSome()) {
+ termination.set_status(status->get());
}
termination.set_message(
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/fetcher.cpp b/src/slave/containerizer/fetcher.cpp
index 8b26e88..a49411b 100644
--- a/src/slave/containerizer/fetcher.cpp
+++ b/src/slave/containerizer/fetcher.cpp
@@ -205,7 +205,7 @@ Result<string> Fetcher::uriToLocalPath(
return Error("File URI only supports absolute paths");
}
- if (frameworksHome.isNone() || frameworksHome.get().empty()) {
+ if (frameworksHome.isNone() || frameworksHome->empty()) {
return Error("A relative path was passed for the resource but the "
"Mesos framework home was not specified. "
"Please either provide this config option "
@@ -483,14 +483,14 @@ Future<Nothing> FetcherProcess::_fetch(
const Option<Future<shared_ptr<Cache::Entry>>>& entry,
entries) {
if (entry.isSome()) {
- if (entry.get().isReady()) {
- result[uri] = entry.get().get();
+ if (entry->isReady()) {
+ result[uri] = entry->get();
} else {
LOG(WARNING)
<< "Reverting to fetching directly into the sandbox for '"
<< uri.value()
<< "', due to failure to fetch through the cache, "
- << "with error: " << entry.get().failure();
+ << "with error: " << entry->failure();
result[uri] = None();
}
@@ -658,10 +658,11 @@ Try<list<Path>> FetcherProcess::cacheFiles() const
flags.fetcher_cache_dir + "' with error: " + find.error());
}
- transform(find.get().begin(),
- find.get().end(),
- std::back_inserter(result),
- [](const string& path) { return Path(path); });
+ transform(
+ find->begin(),
+ find->end(),
+ std::back_inserter(result),
+ [](const string& path) { return Path(path); });
return result;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index cd1e9ae..a61ed5b 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -339,7 +339,7 @@ Try<MesosContainerizer*> MesosContainerizer::create(
return Error("Failed to create provisioner: " + _provisioner.error());
}
- Shared<Provisioner> provisioner = _provisioner.get().share();
+ Shared<Provisioner> provisioner = _provisioner->share();
// Create the isolators.
//
@@ -677,7 +677,7 @@ Future<Nothing> MesosContainerizerProcess::recover(
list<ContainerState> recoverable;
if (state.isSome()) {
// Gather the latest run of checkpointed executors.
- foreachvalue (const FrameworkState& framework, state.get().frameworks) {
+ foreachvalue (const FrameworkState& framework, state->frameworks) {
foreachvalue (const ExecutorState& executor, framework.executors) {
if (executor.info.isNone()) {
LOG(WARNING) << "Skipping recovery of executor '" << executor.id
@@ -697,18 +697,18 @@ Future<Nothing> MesosContainerizerProcess::recover(
const ContainerID& containerId = executor.latest.get();
Option<RunState> run = executor.runs.get(containerId);
CHECK_SOME(run);
- CHECK_SOME(run.get().id);
+ CHECK_SOME(run->id);
// We need the pid so the reaper can monitor the executor so
// skip this executor if it's not present. This is not an
// error because the slave will try to wait on the container
// which will return a failed ContainerTermination and
// everything will get cleaned up.
- if (!run.get().forkedPid.isSome()) {
+ if (!run->forkedPid.isSome()) {
continue;
}
- if (run.get().completed) {
+ if (run->completed) {
VLOG(1) << "Skipping recovery of executor '" << executor.id
<< "' of framework " << framework.id
<< " because its latest run "
@@ -737,7 +737,7 @@ Future<Nothing> MesosContainerizerProcess::recover(
// directory to be non-existent.
const string& directory = paths::getExecutorRunPath(
flags.work_dir,
- state.get().id,
+ state->id,
framework.id,
executor.id,
containerId);
@@ -747,8 +747,8 @@ Future<Nothing> MesosContainerizerProcess::recover(
ContainerState executorRunState =
protobuf::slave::createContainerState(
executorInfo,
- run.get().id.get(),
- run.get().forkedPid.get(),
+ run->id.get(),
+ run->forkedPid.get(),
directory);
recoverable.push_back(executorRunState);
@@ -2198,12 +2198,12 @@ Future<ResourceStatistics> _usage(
if (resources.isSome()) {
// Set the resource allocations.
- Option<Bytes> mem = resources.get().mem();
+ Option<Bytes> mem = resources->mem();
if (mem.isSome()) {
- result.set_mem_limit_bytes(mem.get().bytes());
+ result.set_mem_limit_bytes(mem->bytes());
}
- Option<double> cpus = resources.get().cpus();
+ Option<double> cpus = resources->cpus();
if (cpus.isSome()) {
result.set_cpus_limit(cpus.get());
}
@@ -2503,8 +2503,8 @@ void MesosContainerizerProcess::___destroy(
// be) and continue the destroy.
CHECK_SOME(container->status);
- container->status.get()
- .onAny(defer(self(), &Self::____destroy, containerId, termination));
+ container->status
+ ->onAny(defer(self(), &Self::____destroy, containerId, termination));
}
@@ -2810,7 +2810,7 @@ void MesosContainerizerProcess::limited(
if (future.isReady()) {
LOG_BASED_ON_CLASS(containers_.at(containerId)->containerClass())
<< "Container " << containerId << " has reached its limit for resource "
- << future.get().resources() << " and will be terminated";
+ << future->resources() << " and will be terminated";
termination = ContainerTermination();
termination->set_state(TaskState::TASK_FAILED);
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index ba77404..44cbf5c 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -1316,8 +1316,10 @@ void IOSwitchboardServerProcess::heartbeatLoop()
message.set_type(agent::ProcessIO::CONTROL);
message.mutable_control()->set_type(
agent::ProcessIO::Control::HEARTBEAT);
- message.mutable_control()->mutable_heartbeat()
- ->mutable_interval()->set_nanoseconds(heartbeatInterval.get().ns());
+ message.mutable_control()
+ ->mutable_heartbeat()
+ ->mutable_interval()
+ ->set_nanoseconds(heartbeatInterval->ns());
foreach (HttpConnection& connection, outputConnections) {
connection.send(message);
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp
index fc763bd..75fab0f 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp
@@ -145,17 +145,17 @@ Future<ResourceStatistics> CpuSubsystem::usage(
return Failure("Failed to read 'cpu.stat': " + stat.error());
}
- Option<uint64_t> nr_periods = stat.get().get("nr_periods");
+ Option<uint64_t> nr_periods = stat->get("nr_periods");
if (nr_periods.isSome()) {
result.set_cpus_nr_periods(nr_periods.get());
}
- Option<uint64_t> nr_throttled = stat.get().get("nr_throttled");
+ Option<uint64_t> nr_throttled = stat->get("nr_throttled");
if (nr_throttled.isSome()) {
result.set_cpus_nr_throttled(nr_throttled.get());
}
- Option<uint64_t> throttled_time = stat.get().get("throttled_time");
+ Option<uint64_t> throttled_time = stat->get("throttled_time");
if (throttled_time.isSome()) {
result.set_cpus_throttled_time_secs(
Nanoseconds(throttled_time.get()).secs());
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp
index ffa0d3b..3be419a 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp
@@ -71,7 +71,7 @@ Future<ResourceStatistics> CpuacctSubsystem::usage(
return Failure("Failed to get number of processes: " + pids.error());
}
- result.set_processes(pids.get().size());
+ result.set_processes(pids->size());
Try<set<pid_t>> tids = cgroups::threads(hierarchy, cgroup);
@@ -79,7 +79,7 @@ Future<ResourceStatistics> CpuacctSubsystem::usage(
return Failure("Failed to get number of threads: " + tids.error());
}
- result.set_threads(tids.get().size());
+ result.set_threads(tids->size());
}
// Get the number of clock ticks, used for cpu accounting.
@@ -99,8 +99,8 @@ Future<ResourceStatistics> CpuacctSubsystem::usage(
// TODO(bmahler): Add namespacing to cgroups to enforce the expected
// structure, e.g., cgroups::cpuacct::stat.
- Option<uint64_t> user = stat.get().get("user");
- Option<uint64_t> system = stat.get().get("system");
+ Option<uint64_t> user = stat->get("user");
+ Option<uint64_t> system = stat->get("system");
if (user.isSome() && system.isSome()) {
result.set_cpus_user_time_secs((double) user.get() / (double) ticks);
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/isolators/cgroups/subsystems/memory.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/memory.cpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/memory.cpp
index 99e824a..50348d6 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/memory.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/memory.cpp
@@ -323,7 +323,7 @@ Future<ResourceStatistics> MemorySubsystem::usage(
return Failure("Failed to parse 'memory.usage_in_bytes': " + usage.error());
}
- result.set_mem_total_bytes(usage.get().bytes());
+ result.set_mem_total_bytes(usage->bytes());
if (flags.cgroups_limit_swap) {
Try<Bytes> usage = cgroups::memory::memsw_usage_in_bytes(hierarchy, cgroup);
@@ -333,7 +333,7 @@ Future<ResourceStatistics> MemorySubsystem::usage(
"Failed to parse 'memory.memsw.usage_in_bytes': " + usage.error());
}
- result.set_mem_total_memsw_bytes(usage.get().bytes());
+ result.set_mem_total_memsw_bytes(usage->bytes());
}
// TODO(bmahler): Add namespacing to cgroups to enforce the expected
@@ -347,7 +347,7 @@ Future<ResourceStatistics> MemorySubsystem::usage(
return Failure("Failed to read 'memory.stat': " + stat.error());
}
- Option<uint64_t> total_cache = stat.get().get("total_cache");
+ Option<uint64_t> total_cache = stat->get("total_cache");
if (total_cache.isSome()) {
// TODO(chzhcn): mem_file_bytes is deprecated in 0.23.0 and will
// be removed in 0.24.0.
@@ -355,7 +355,7 @@ Future<ResourceStatistics> MemorySubsystem::usage(
result.set_mem_cache_bytes(total_cache.get());
}
- Option<uint64_t> total_rss = stat.get().get("total_rss");
+ Option<uint64_t> total_rss = stat->get("total_rss");
if (total_rss.isSome()) {
// TODO(chzhcn): mem_anon_bytes is deprecated in 0.23.0 and will
// be removed in 0.24.0.
@@ -363,17 +363,17 @@ Future<ResourceStatistics> MemorySubsystem::usage(
result.set_mem_rss_bytes(total_rss.get());
}
- Option<uint64_t> total_mapped_file = stat.get().get("total_mapped_file");
+ Option<uint64_t> total_mapped_file = stat->get("total_mapped_file");
if (total_mapped_file.isSome()) {
result.set_mem_mapped_file_bytes(total_mapped_file.get());
}
- Option<uint64_t> total_swap = stat.get().get("total_swap");
+ Option<uint64_t> total_swap = stat->get("total_swap");
if (total_swap.isSome()) {
result.set_mem_swap_bytes(total_swap.get());
}
- Option<uint64_t> total_unevictable = stat.get().get("total_unevictable");
+ Option<uint64_t> total_unevictable = stat->get("total_unevictable");
if (total_unevictable.isSome()) {
result.set_mem_unevictable_bytes(total_unevictable.get());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index 8966569..c60c23f 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -1338,14 +1338,14 @@ Future<Nothing> NetworkCniIsolatorProcess::_attach(
plugin + "': " + parse.error());
}
- if (parse.get().has_ip4()) {
- LOG(INFO) << "Got assigned IPv4 address '" << parse.get().ip4().ip()
+ if (parse->has_ip4()) {
+ LOG(INFO) << "Got assigned IPv4 address '" << parse->ip4().ip()
<< "' from CNI network '" << networkName
<< "' for container " << containerId;
}
- if (parse.get().has_ip6()) {
- LOG(INFO) << "Got assigned IPv6 address '" << parse.get().ip6().ip()
+ if (parse->has_ip6()) {
+ LOG(INFO) << "Got assigned IPv6 address '" << parse->ip6().ip()
<< "' from CNI network '" << networkName
<< "' for container " << containerId;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/isolators/posix/disk.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/posix/disk.cpp b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
index 7f2708c..a3bb746 100644
--- a/src/slave/containerizer/mesos/isolators/posix/disk.cpp
+++ b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
@@ -501,8 +501,8 @@ protected:
void finalize()
{
foreach (const Owned<Entry>& entry, entries) {
- if (entry->du.isSome() && entry->du.get().status().isPending()) {
- os::killtree(entry->du.get().pid(), SIGKILL);
+ if (entry->du.isSome() && entry->du->status().isPending()) {
+ os::killtree(entry->du->pid(), SIGKILL);
}
entry->promise.fail("DiskUsageCollector is destroyed");
@@ -599,9 +599,9 @@ private:
entry->du = s.get();
- await(s.get().status(),
- io::read(s.get().out().get()),
- io::read(s.get().err().get()))
+ await(s->status(),
+ io::read(s->out().get()),
+ io::read(s->err().get()))
.onAny(defer(self(), &Self::_schedule, lambda::_1));
}
@@ -622,9 +622,9 @@ private:
entry->promise.fail(
"Failed to perform 'du': " +
(status.isFailed() ? status.failure() : "discarded"));
- } else if (status.get().isNone()) {
+ } else if (status->isNone()) {
entry->promise.fail("Failed to reap the status of 'du'");
- } else if (status.get().get() != 0) {
+ } else if (status->get() != 0) {
const Future<string>& error = std::get<2>(future.get());
if (!error.isReady()) {
entry->promise.fail(
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/isolators/volume/image.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/volume/image.cpp b/src/slave/containerizer/mesos/isolators/volume/image.cpp
index 8ca3d55..631553e 100644
--- a/src/slave/containerizer/mesos/isolators/volume/image.cpp
+++ b/src/slave/containerizer/mesos/isolators/volume/image.cpp
@@ -217,7 +217,7 @@ Future<Option<ContainerLaunchInfo>> VolumeImageIsolatorProcess::_prepare(
continue;
}
- sources.push_back(future.get().rootfs);
+ sources.push_back(future->rootfs);
}
if (!messages.empty()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.cpp b/src/slave/containerizer/mesos/launcher.cpp
index 0e37cd2..2fe47d3 100644
--- a/src/slave/containerizer/mesos/launcher.cpp
+++ b/src/slave/containerizer/mesos/launcher.cpp
@@ -137,13 +137,13 @@ Try<pid_t> SubprocessLauncher::fork(
return Error("Failed to fork a child process: " + child.error());
}
- LOG(INFO) << "Forked child with pid '" << child.get().pid()
+ LOG(INFO) << "Forked child with pid '" << child->pid()
<< "' for container '" << containerId << "'";
// Store the pid (session id and process group id).
- pids.put(containerId, child.get().pid());
+ pids.put(containerId, child->pid());
- return child.get().pid();
+ return child->pid();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/linux_launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/linux_launcher.cpp b/src/slave/containerizer/mesos/linux_launcher.cpp
index daba093..de4aff4 100644
--- a/src/slave/containerizer/mesos/linux_launcher.cpp
+++ b/src/slave/containerizer/mesos/linux_launcher.cpp
@@ -139,7 +139,7 @@ Try<Launcher*> LinuxLauncher::create(const Flags& flags)
return Error(
"Failed to get the list of attached subsystems for hierarchy " +
freezerHierarchy.get());
- } else if (subsystems.get().size() != 1) {
+ } else if (subsystems->size() != 1) {
return Error(
"Unexpected subsystems found attached to the hierarchy " +
freezerHierarchy.get());
@@ -574,7 +574,7 @@ Try<pid_t> LinuxLauncherProcess::fork(
Container container;
container.id = containerId;
- container.pid = child.get().pid();
+ container.pid = child->pid();
containers.put(container.id, container);
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/appc/cache.cpp b/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
index 0cd444b..0daa483 100644
--- a/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
+++ b/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
@@ -96,11 +96,11 @@ Try<Nothing> Cache::add(const string& imageId)
}
map<string, string> labels;
- foreach (const spec::ImageManifest::Label& label, manifest.get().labels()) {
+ foreach (const spec::ImageManifest::Label& label, manifest->labels()) {
labels.insert({label.name(), label.value()});
}
- imageIds.put(Key(manifest.get().name(), labels), imageId);
+ imageIds.put(Key(manifest->name(), labels), imageId);
VLOG(1) << "Added image with id '" << imageId << "' to cache";
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/backends/bind.cpp b/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
index d6cdc93..6ad97f9 100644
--- a/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
+++ b/src/slave/containerizer/mesos/provisioner/backends/bind.cpp
@@ -190,7 +190,7 @@ Future<bool> BindBackendProcess::destroy(const string& rootfs)
return Failure("Failed to read mount table: " + mountTable.error());
}
- foreach (const fs::MountInfoTable::Entry& entry, mountTable.get().entries) {
+ foreach (const fs::MountInfoTable::Entry& entry, mountTable->entries) {
// TODO(xujyan): If MS_REC was used in 'provision()' we would need
// to check `strings::startsWith(entry.target, rootfs)` here to
// unmount all nested mounts.
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/backends/copy.cpp b/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
index 69faa03..c48e93f 100644
--- a/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
+++ b/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
@@ -323,7 +323,7 @@ Future<bool> CopyBackendProcess::destroy(const string& rootfs)
return Failure("Failed to create 'rm' subprocess: " + s.error());
}
- return s.get().status()
+ return s->status()
.then([](const Option<int>& status) -> Future<bool> {
if (status.isNone()) {
return Failure("Failed to reap subprocess to destroy rootfs");
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/provisioner/docker/metadata_manager.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/docker/metadata_manager.cpp b/src/slave/containerizer/mesos/provisioner/docker/metadata_manager.cpp
index e1939a4..98c8fc7 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/metadata_manager.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/metadata_manager.cpp
@@ -268,7 +268,7 @@ Future<Nothing> MetadataManagerProcess::recover()
return Failure("Unexpected empty images file '" + storedImagesPath + "'");
}
- foreach (const Image& image, images.get().images()) {
+ foreach (const Image& image, images->images()) {
const string imageReference = stringify(image.reference());
if (storedImages.contains(imageReference)) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/containerizer/mesos/provisioner/docker/store.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/docker/store.cpp b/src/slave/containerizer/mesos/provisioner/docker/store.cpp
index 7b6ddb1..c308bb0 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/store.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/store.cpp
@@ -288,7 +288,7 @@ Future<Image> StoreProcess::_get(
// layer exists for a cached image.
bool layerMissed = false;
- foreach (const string& layerId, image.get().layer_ids()) {
+ foreach (const string& layerId, image->layer_ids()) {
const string rootfsPath = paths::getImageLayerRootfsPath(
flags.docker_store_dir,
layerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index 43292ea..b95bb25 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -584,7 +584,7 @@ int main(int argc, char** argv)
LOG(WARNING) << "Failed to stat jwt secret key file '"
<< flags.jwt_secret_key.get()
<< "': " << permissions.error();
- } else if (permissions.get().others.rwx) {
+ } else if (permissions->others.rwx) {
LOG(WARNING) << "Permissions on executor secret key file '"
<< flags.jwt_secret_key.get()
<< "' are too open; it is recommended that your"
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/qos_controllers/load.cpp
----------------------------------------------------------------------
diff --git a/src/slave/qos_controllers/load.cpp b/src/slave/qos_controllers/load.cpp
index a241ef3..fa10eca 100644
--- a/src/slave/qos_controllers/load.cpp
+++ b/src/slave/qos_controllers/load.cpp
@@ -80,16 +80,16 @@ public:
bool overloaded = false;
if (loadThreshold5Min.isSome()) {
- if (load.get().five > loadThreshold5Min.get()) {
- LOG(INFO) << "System 5 minutes load average " << load.get().five
+ if (load->five > loadThreshold5Min.get()) {
+ LOG(INFO) << "System 5 minutes load average " << load->five
<< " exceeds threshold " << loadThreshold5Min.get();
overloaded = true;
}
}
if (loadThreshold15Min.isSome()) {
- if (load.get().fifteen > loadThreshold15Min.get()) {
- LOG(INFO) << "System 15 minutes load average " << load.get().fifteen
+ if (load->fifteen > loadThreshold15Min.get()) {
+ LOG(INFO) << "System 15 minutes load average " << load->fifteen
<< " exceeds threshold " << loadThreshold15Min.get();
overloaded = true;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index c5ec62c..e2facb3 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -342,7 +342,7 @@ void Slave::initialize()
LOG(WARNING) << "Failed to stat jwt secret key file '"
<< flags.jwt_secret_key.get()
<< "': " << permissions.error();
- } else if (permissions.get().others.rwx) {
+ } else if (permissions->others.rwx) {
LOG(WARNING) << "Permissions on executor secret key file '"
<< flags.jwt_secret_key.get()
<< "' are too open; it is recommended that your"
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/slave/validation.cpp
----------------------------------------------------------------------
diff --git a/src/slave/validation.cpp b/src/slave/validation.cpp
index 5d751d2..09f1fc7 100644
--- a/src/slave/validation.cpp
+++ b/src/slave/validation.cpp
@@ -383,14 +383,14 @@ Option<Error> validate(
// General resource validation first.
error = Resources::validate(call.launch_container().resources());
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error = common::validation::validateGpus(
call.launch_container().resources());
if (error.isSome()) {
- return Error("Invalid GPU resources: " + error.get().message);
+ return Error("Invalid GPU resources: " + error->message);
}
// Because standalone containers are launched outside of the master's
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/state/in_memory.cpp
----------------------------------------------------------------------
diff --git a/src/state/in_memory.cpp b/src/state/in_memory.cpp
index f6852e0..b5d91c3 100644
--- a/src/state/in_memory.cpp
+++ b/src/state/in_memory.cpp
@@ -56,8 +56,7 @@ public:
{
const Option<Entry>& option = entries.get(entry.name());
- if (option.isSome() &&
- id::UUID::fromBytes(option.get().uuid()).get() != uuid) {
+ if (option.isSome() && id::UUID::fromBytes(option->uuid()).get() != uuid) {
return false;
}
@@ -73,7 +72,7 @@ public:
return false;
}
- if (id::UUID::fromBytes(option.get().uuid()).get() !=
+ if (id::UUID::fromBytes(option->uuid()).get() !=
id::UUID::fromBytes(entry.uuid()).get()) {
return false;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/state/leveldb.cpp
----------------------------------------------------------------------
diff --git a/src/state/leveldb.cpp b/src/state/leveldb.cpp
index 50d0c7c..55eab61 100644
--- a/src/state/leveldb.cpp
+++ b/src/state/leveldb.cpp
@@ -163,8 +163,8 @@ Future<bool> LevelDBStorageProcess::set(
return Failure(option.error());
}
- if (option.get().isSome()) {
- if (id::UUID::fromBytes(option.get().get().uuid()).get() != uuid) {
+ if (option->isSome()) {
+ if (id::UUID::fromBytes(option.get()->uuid()).get() != uuid) {
return false;
}
}
@@ -198,11 +198,11 @@ Future<bool> LevelDBStorageProcess::expunge(const Entry& entry)
return Failure(option.error());
}
- if (option.get().isNone()) {
+ if (option->isNone()) {
return false;
}
- if (id::UUID::fromBytes(option.get().get().uuid()).get() !=
+ if (id::UUID::fromBytes(option.get()->uuid()).get() !=
id::UUID::fromBytes(entry.uuid()).get()) {
return false;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/state/log.cpp
----------------------------------------------------------------------
diff --git a/src/state/log.cpp b/src/state/log.cpp
index 48d1037..1b2d727 100644
--- a/src/state/log.cpp
+++ b/src/state/log.cpp
@@ -267,8 +267,7 @@ Future<Nothing> LogStorageProcess::_start(
return start(); // TODO(benh): Don't try again forever?
}
- VLOG(2) << "Writer got elected at position "
- << position.get().identity();
+ VLOG(2) << "Writer got elected at position " << position->identity();
// Now read and apply log entries. Since 'start' can be called
// multiple times (i.e., since we reset 'starting' after getting a
@@ -343,14 +342,14 @@ Future<Nothing> LogStorageProcess::apply(const list<Log::Entry>& entries)
CHECK_SOME(snapshot);
- Try<Snapshot> patched = snapshot.get().patch(operation.diff());
+ Try<Snapshot> patched = snapshot->patch(operation.diff());
if (patched.isError()) {
return Failure("Failed to apply the diff: " + patched.error());
}
// Replace the snapshot with the patched snapshot.
- snapshots.put(patched.get().entry.name(), patched.get());
+ snapshots.put(patched->entry.name(), patched.get());
break;
}
@@ -455,7 +454,7 @@ Future<Option<Entry>> LogStorageProcess::_get(const string& name)
return None();
}
- return snapshot.get().entry;
+ return snapshot->entry;
}
@@ -486,19 +485,17 @@ Future<bool> LogStorageProcess::__set(
// Check the version first (if we've already got a snapshot).
if (snapshot.isSome() &&
- id::UUID::fromBytes(snapshot.get().entry.uuid()).get() != uuid) {
+ id::UUID::fromBytes(snapshot->entry.uuid()).get() != uuid) {
return false;
}
// Check if we should try to compute a diff.
- if (snapshot.isSome() && snapshot.get().diffs < diffsBetweenSnapshots) {
+ if (snapshot.isSome() && snapshot->diffs < diffsBetweenSnapshots) {
// Keep metrics for the time to calculate diffs.
metrics.diff.start();
// Construct the diff of the last snapshot.
- Try<svn::Diff> diff = svn::diff(
- snapshot.get().entry.value(),
- entry.value());
+ Try<svn::Diff> diff = svn::diff(snapshot->entry.value(), entry.value());
Duration elapsed = metrics.diff.stop();
@@ -508,17 +505,17 @@ Future<bool> LogStorageProcess::__set(
}
VLOG(1) << "Created an SVN diff in " << elapsed
- << " of size " << Bytes(diff.get().data.size()) << " which is "
- << (diff.get().data.size() / (double) entry.value().size()) * 100.0
+ << " of size " << Bytes(diff->data.size()) << " which is "
+ << (diff->data.size() / (double) entry.value().size()) * 100.0
<< "% the original size (" << Bytes(entry.value().size()) << ")";
// Only write the diff if it provides a reduction in size.
- if (diff.get().data.size() < entry.value().size()) {
+ if (diff->data.size() < entry.value().size()) {
// Append a diff operation.
Operation operation;
operation.set_type(Operation::DIFF);
operation.mutable_diff()->mutable_entry()->CopyFrom(entry);
- operation.mutable_diff()->mutable_entry()->set_value(diff.get().data);
+ operation.mutable_diff()->mutable_entry()->set_value(diff->data);
string value;
if (!operation.SerializeToString(&value)) {
@@ -529,7 +526,7 @@ Future<bool> LogStorageProcess::__set(
.then(defer(self(),
&Self::___set,
entry,
- snapshot.get().diffs + 1,
+ snapshot->diffs + 1,
lambda::_1));
}
}
@@ -569,7 +566,7 @@ Future<bool> LogStorageProcess::___set(
// use the returned position (i.e., do nothing).
if (diffs > 0) {
CHECK(snapshots.contains(entry.name()));
- position = snapshots.get(entry.name()).get().position;
+ position = snapshots.get(entry.name())->position;
}
Snapshot snapshot(position.get(), entry, diffs);
@@ -606,7 +603,7 @@ Future<bool> LogStorageProcess::__expunge(const Entry& entry)
}
// Check the version first.
- if (id::UUID::fromBytes(snapshot.get().entry.uuid()).get() !=
+ if (id::UUID::fromBytes(snapshot->entry.uuid()).get() !=
id::UUID::fromBytes(entry.uuid()).get()) {
return false;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/state/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/state/zookeeper.cpp b/src/state/zookeeper.cpp
index f992fb9..7a25e5e 100644
--- a/src/state/zookeeper.cpp
+++ b/src/state/zookeeper.cpp
@@ -323,9 +323,9 @@ void ZooKeeperStorageProcess::connected(int64_t sessionId, bool reconnect)
// Authenticate if necessary (and we are connected for the first
// time, or after a session expiration).
if (auth.isSome()) {
- LOG(INFO) << "Authenticating with ZooKeeper using " << auth.get().scheme;
+ LOG(INFO) << "Authenticating with ZooKeeper using " << auth->scheme;
- int code = zk->authenticate(auth.get().scheme, auth.get().credentials);
+ int code = zk->authenticate(auth->scheme, auth->credentials);
if (code != ZOK) { // TODO(benh): Authentication retries?
error = "Failed to authenticate with ZooKeeper: " + zk->message(code);
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index c6383c4..31906eb 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -815,7 +815,7 @@ TEST_P(MasterAPITest, SetLoggingLevel)
{
// Default principal 2 is not allowed to set the logging level.
- mesos::ACL::SetLogLevel* acl = flags.acls.get().add_set_log_level();
+ mesos::ACL::SetLogLevel* acl = flags.acls->add_set_log_level();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_level()->set_type(mesos::ACL::Entity::NONE);
}
@@ -1396,7 +1396,7 @@ TEST_P(MasterAPITest, UpdateAndGetMaintenanceSchedule)
{
// Default principal 2 is not allowed to update any maintenance schedule.
mesos::ACL::UpdateMaintenanceSchedule* acl =
- flags.acls.get().add_update_maintenance_schedules();
+ flags.acls->add_update_maintenance_schedules();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
@@ -1404,7 +1404,7 @@ TEST_P(MasterAPITest, UpdateAndGetMaintenanceSchedule)
{
// Default principal 2 is not allowed to view any maintenance schedule.
mesos::ACL::GetMaintenanceSchedule* acl =
- flags.acls.get().add_get_maintenance_schedules();
+ flags.acls->add_get_maintenance_schedules();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
@@ -1515,7 +1515,7 @@ TEST_P(MasterAPITest, GetMaintenanceStatus)
{
// Default principal 2 is not allowed to view any maintenance status.
mesos::ACL::GetMaintenanceStatus* acl =
- flags.acls.get().add_get_maintenance_statuses();
+ flags.acls->add_get_maintenance_statuses();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
@@ -1606,16 +1606,14 @@ TEST_P(MasterAPITest, StartAndStopMaintenance)
{
// Default principal 2 is not allowed to start maintenance in any machine.
- mesos::ACL::StartMaintenance* acl =
- flags.acls.get().add_start_maintenances();
+ mesos::ACL::StartMaintenance* acl = flags.acls->add_start_maintenances();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
{
// Default principal 2 is not allowed to stop maintenance in any machine.
- mesos::ACL::StopMaintenance* acl =
- flags.acls.get().add_stop_maintenances();
+ mesos::ACL::StopMaintenance* acl = flags.acls->add_stop_maintenances();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
@@ -1865,21 +1863,21 @@ TEST_P(MasterAPITest, GetAgentsFiltering)
const string roleMuggle = "muggle";
{
- mesos::ACL::ViewRole* acl = flags.acls.get().add_view_roles();
+ mesos::ACL::ViewRole* acl = flags.acls->add_view_roles();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
acl->mutable_roles()->add_values(roleSuperhero);
- acl = flags.acls.get().add_view_roles();
+ acl = flags.acls->add_view_roles();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
acl->mutable_roles()->set_type(mesos::ACL::Entity::NONE);
}
{
- mesos::ACL::ViewRole* acl = flags.acls.get().add_view_roles();
+ mesos::ACL::ViewRole* acl = flags.acls->add_view_roles();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_roles()->add_values(roleMuggle);
- acl = flags.acls.get().add_view_roles();
+ acl = flags.acls->add_view_roles();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_roles()->set_type(mesos::ACL::Entity::NONE);
}
@@ -2080,7 +2078,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(MasterAPITest, GetRecoveredAgents)
// This forces the authorizer to be initialized.
{
- mesos::ACL::ViewRole* acl = masterFlags.acls.get().add_view_roles();
+ mesos::ACL::ViewRole* acl = masterFlags.acls->add_view_roles();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
acl->mutable_roles()->set_type(mesos::ACL::Entity::ANY);
}
@@ -3046,10 +3044,10 @@ TEST_P(MasterAPITest, FrameworksEvent)
AWAIT_READY(event);
{
- EXPECT_EQ(v1::master::Event::FRAMEWORK_ADDED, event.get().get().type());
+ EXPECT_EQ(v1::master::Event::FRAMEWORK_ADDED, event.get()->type());
const v1::master::Response::GetFrameworks::Framework& framework =
- event.get().get().framework_added().framework();
+ event.get()->framework_added().framework();
EXPECT_EQ(frameworkInfo, framework.framework_info());
EXPECT_TRUE(framework.active());
@@ -3082,10 +3080,10 @@ TEST_P(MasterAPITest, FrameworksEvent)
AWAIT_READY(event);
{
- EXPECT_EQ(v1::master::Event::FRAMEWORK_UPDATED, event.get().get().type());
+ EXPECT_EQ(v1::master::Event::FRAMEWORK_UPDATED, event.get()->type());
const v1::master::Response::GetFrameworks::Framework& framework =
- event.get().get().framework_updated().framework();
+ event.get()->framework_updated().framework();
EXPECT_EQ(frameworkInfo, framework.framework_info());
}
@@ -3112,10 +3110,10 @@ TEST_P(MasterAPITest, FrameworksEvent)
AWAIT_READY(event);
{
- EXPECT_EQ(v1::master::Event::FRAMEWORK_REMOVED, event.get().get().type());
+ EXPECT_EQ(v1::master::Event::FRAMEWORK_REMOVED, event.get()->type());
const v1::FrameworkID& frameworkId_ =
- event.get().get().framework_removed().framework_info().id();
+ event.get()->framework_removed().framework_info().id();
EXPECT_EQ(frameworkId, frameworkId_);
}
@@ -3993,8 +3991,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(MasterAPITest,
{
// Default principal is not allowed to mark agents as gone.
- mesos::ACL::MarkAgentGone* acl =
- masterFlags.acls.get().add_mark_agents_gone();
+ mesos::ACL::MarkAgentGone* acl = masterFlags.acls->add_mark_agents_gone();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
acl->mutable_agents()->set_type(mesos::ACL::Entity::NONE);
@@ -5577,8 +5574,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
{
// Default principal is not allowed to launch nested container sessions.
mesos::ACL::LaunchNestedContainerSessionUnderParentWithUser* acl =
- flags.acls.get()
- .add_launch_nested_container_sessions_under_parent_with_user();
+ flags.acls->add_launch_nested_container_sessions_under_parent_with_user();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
acl->mutable_users()->set_type(mesos::ACL::Entity::NONE);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/cluster.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cluster.cpp b/src/tests/cluster.cpp
index 84e2e3a..97dde00 100644
--- a/src/tests/cluster.cpp
+++ b/src/tests/cluster.cpp
@@ -534,7 +534,7 @@ Try<process::Owned<Slave>> Slave::create(
LOG(WARNING) << "Failed to stat jwt secret key file '"
<< flags.jwt_secret_key.get()
<< "': " << permissions.error();
- } else if (permissions.get().others.rwx) {
+ } else if (permissions->others.rwx) {
LOG(WARNING) << "Permissions on executor secret key file '"
<< flags.jwt_secret_key.get()
<< "' are too open; it is recommended that your"
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/containerizer/cni_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cni_isolator_tests.cpp b/src/tests/containerizer/cni_isolator_tests.cpp
index b8eb80f..0197123 100644
--- a/src/tests/containerizer/cni_isolator_tests.cpp
+++ b/src/tests/containerizer/cni_isolator_tests.cpp
@@ -1081,8 +1081,8 @@ TEST_F(CniIsolatorTest, ROOT_VerifyResolverConfig)
echo ' }'
echo '}'
)~",
- hostNetwork.get().address(),
- hostNetwork.get().prefix());
+ hostNetwork->address(),
+ hostNetwork->prefix());
ASSERT_SOME(mockPlugin);
@@ -1209,8 +1209,8 @@ TEST_F(CniIsolatorTest, ROOT_INTERNET_VerifyResolverConfig)
echo ' }'
echo '}'
)~",
- hostNetwork.get().address(),
- hostNetwork.get().prefix());
+ hostNetwork->address(),
+ hostNetwork->prefix());
ASSERT_SOME(mockPlugin);
@@ -1793,7 +1793,7 @@ TEST_F(CniIsolatorPortMapperTest, ROOT_INTERNET_CURL_PortMapper)
AWAIT_READY(statusKilled);
- EXPECT_EQ(TASK_KILLED, statusKilled.get().state());
+ EXPECT_EQ(TASK_KILLED, statusKilled->state());
AWAIT_READY(gcSchedule);
@@ -1897,8 +1897,8 @@ TEST_P(DefaultContainerDNSCniTest, ROOT_VerifyDefaultDNS)
echo ' }'
echo '}'
)~",
- hostNetwork.get().address(),
- hostNetwork.get().prefix());
+ hostNetwork->address(),
+ hostNetwork->prefix());
ASSERT_SOME(mockPlugin);
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/containerizer/docker_containerizer_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/docker_containerizer_tests.cpp b/src/tests/containerizer/docker_containerizer_tests.cpp
index d1e6570..97335e1 100644
--- a/src/tests/containerizer/docker_containerizer_tests.cpp
+++ b/src/tests/containerizer/docker_containerizer_tests.cpp
@@ -4437,7 +4437,7 @@ TEST_F(DockerContainerizerTest, ROOT_DOCKER_Non_Root_Sandbox)
ASSERT_SOME(slave);
AWAIT_READY(slaveRegisteredMessage);
- SlaveID slaveId = slaveRegisteredMessage.get().slave_id();
+ SlaveID slaveId = slaveRegisteredMessage->slave_id();
FrameworkInfo framework;
framework.set_name("default");
@@ -5093,13 +5093,13 @@ TEST_F(
ASSERT_SOME(ip);
- if (protocol.get().value == "IPv4") {
- EXPECT_EQ(ip.get().value, containerIPv4.get());
+ if (protocol->value == "IPv4") {
+ EXPECT_EQ(ip->value, containerIPv4.get());
} else {
- EXPECT_EQ(ip.get().value, containerIPv6.get());
+ EXPECT_EQ(ip->value, containerIPv6.get());
}
- LOG(INFO) << "IP: " << ip.get().value;
+ LOG(INFO) << "IP: " << ip->value;
}
ASSERT_TRUE(exists(docker, containerId.get()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/containerizer/environment_secret_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/environment_secret_isolator_tests.cpp b/src/tests/containerizer/environment_secret_isolator_tests.cpp
index 9728587..7a516e5 100644
--- a/src/tests/containerizer/environment_secret_isolator_tests.cpp
+++ b/src/tests/containerizer/environment_secret_isolator_tests.cpp
@@ -119,11 +119,11 @@ TEST_F(EnvironmentSecretIsolatorTest, ResolveSecret)
driver.launchTasks(offers.get()[0].id(), {task});
AWAIT_READY(statusStarting);
- EXPECT_EQ(TASK_STARTING, statusStarting.get().state());
+ EXPECT_EQ(TASK_STARTING, statusStarting->state());
AWAIT_READY(statusRunning);
- EXPECT_EQ(TASK_RUNNING, statusRunning.get().state());
+ EXPECT_EQ(TASK_RUNNING, statusRunning->state());
AWAIT_READY(statusFinished);
- EXPECT_EQ(TASK_FINISHED, statusFinished.get().state());
+ EXPECT_EQ(TASK_FINISHED, statusFinished->state());
driver.stop();
driver.join();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/default_executor_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/default_executor_tests.cpp b/src/tests/default_executor_tests.cpp
index c349237..316ec7e 100644
--- a/src/tests/default_executor_tests.cpp
+++ b/src/tests/default_executor_tests.cpp
@@ -2661,14 +2661,14 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
v1::FrameworkID frameworkId(subscribed->framework_id());
v1::Resources individualResources =
- v1::Resources::parse("cpus:0.1;mem:32;disk:32").get()
- .pushReservation(
+ v1::Resources::parse("cpus:0.1;mem:32;disk:32")
+ ->pushReservation(
v1::createDynamicReservationInfo(
frameworkInfo.roles(0), frameworkInfo.principal()));
v1::Resources totalResources =
- v1::Resources::parse("cpus:0.3;mem:96;disk:96").get()
- .pushReservation(
+ v1::Resources::parse("cpus:0.3;mem:96;disk:96")
+ ->pushReservation(
v1::createDynamicReservationInfo(
frameworkInfo.roles(0), frameworkInfo.principal()));
@@ -2878,14 +2878,14 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
v1::FrameworkID frameworkId(subscribed->framework_id());
v1::Resources individualResources =
- v1::Resources::parse("cpus:0.1;mem:32;disk:32").get()
- .pushReservation(
+ v1::Resources::parse("cpus:0.1;mem:32;disk:32")
+ ->pushReservation(
v1::createDynamicReservationInfo(
frameworkInfo.roles(0), frameworkInfo.principal()));
v1::Resources totalResources =
- v1::Resources::parse("cpus:0.3;mem:96;disk:96").get()
- .pushReservation(
+ v1::Resources::parse("cpus:0.3;mem:96;disk:96")
+ ->pushReservation(
v1::createDynamicReservationInfo(
frameworkInfo.roles(0), frameworkInfo.principal()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/environment.cpp
----------------------------------------------------------------------
diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp
index 931e647..e1aa020 100644
--- a/src/tests/environment.cpp
+++ b/src/tests/environment.cpp
@@ -385,7 +385,7 @@ public:
std::cerr
<< "-------------------------------------------------------------\n"
<< "We cannot run any overlay backend tests because:\n"
- << dtypeError.get().message << "\n"
+ << dtypeError->message << "\n"
<< "-------------------------------------------------------------\n";
return;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/health_check_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/health_check_tests.cpp b/src/tests/health_check_tests.cpp
index 1893c85..948bf17 100644
--- a/src/tests/health_check_tests.cpp
+++ b/src/tests/health_check_tests.cpp
@@ -2034,18 +2034,18 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
{offers->front().id()}, {LAUNCH_GROUP(executor, taskGroup)});
AWAIT_READY(statusRunning);
- EXPECT_EQ(TASK_STARTING, statusStarting.get().state());
+ EXPECT_EQ(TASK_STARTING, statusStarting->state());
AWAIT_READY(statusRunning);
- EXPECT_EQ(TASK_RUNNING, statusRunning.get().state());
+ EXPECT_EQ(TASK_RUNNING, statusRunning->state());
AWAIT_READY(statusHealthy);
- EXPECT_EQ(TASK_RUNNING, statusHealthy.get().state());
+ EXPECT_EQ(TASK_RUNNING, statusHealthy->state());
EXPECT_EQ(
TaskStatus::REASON_TASK_HEALTH_CHECK_STATUS_UPDATED,
statusHealthy->reason());
- EXPECT_TRUE(statusHealthy.get().has_healthy());
- EXPECT_TRUE(statusHealthy.get().healthy());
+ EXPECT_TRUE(statusHealthy->has_healthy());
+ EXPECT_TRUE(statusHealthy->healthy());
Future<hashset<ContainerID>> containerIds = containerizer->containers();
@@ -2170,18 +2170,18 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
{offers->front().id()}, {LAUNCH_GROUP(executor, taskGroup)});
AWAIT_READY(statusStarting);
- EXPECT_EQ(TASK_STARTING, statusStarting.get().state());
+ EXPECT_EQ(TASK_STARTING, statusStarting->state());
AWAIT_READY(statusRunning);
- EXPECT_EQ(TASK_RUNNING, statusRunning.get().state());
+ EXPECT_EQ(TASK_RUNNING, statusRunning->state());
AWAIT_READY(statusHealthy);
- EXPECT_EQ(TASK_RUNNING, statusHealthy.get().state());
+ EXPECT_EQ(TASK_RUNNING, statusHealthy->state());
EXPECT_EQ(
TaskStatus::REASON_TASK_HEALTH_CHECK_STATUS_UPDATED,
statusHealthy->reason());
- EXPECT_TRUE(statusHealthy.get().has_healthy());
- EXPECT_TRUE(statusHealthy.get().healthy());
+ EXPECT_TRUE(statusHealthy->has_healthy());
+ EXPECT_TRUE(statusHealthy->healthy());
Future<hashset<ContainerID>> containerIds = containerizer->containers();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/master_maintenance_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_maintenance_tests.cpp b/src/tests/master_maintenance_tests.cpp
index 2a06258..f3fb224 100644
--- a/src/tests/master_maintenance_tests.cpp
+++ b/src/tests/master_maintenance_tests.cpp
@@ -734,8 +734,7 @@ TEST_F(MasterMaintenanceTest, BringDownMachines)
{
// Default principal 2 is not allowed to start maintenance in any machine.
- mesos::ACL::StartMaintenance* acl =
- flags.acls.get().add_start_maintenances();
+ mesos::ACL::StartMaintenance* acl = flags.acls->add_start_maintenances();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
@@ -852,8 +851,7 @@ TEST_F(MasterMaintenanceTest, BringUpMachines)
{
// Default principal 2 is not allowed to stop maintenance in any machine.
- mesos::ACL::StopMaintenance* acl =
- flags.acls.get().add_stop_maintenances();
+ mesos::ACL::StopMaintenance* acl = flags.acls->add_stop_maintenances();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
@@ -995,7 +993,7 @@ TEST_F(MasterMaintenanceTest, MachineStatus)
{
// Default principal 2 is not allowed to view any maintenance status.
mesos::ACL::GetMaintenanceStatus* acl =
- flags.acls.get().add_get_maintenance_statuses();
+ flags.acls->add_get_maintenance_statuses();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_machines()->set_type(mesos::ACL::Entity::NONE);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 3705fa7..07422bf 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -2402,7 +2402,7 @@ TEST_F(MasterTest, SlavesEndpointFiltering)
master::Flags flags = CreateMasterFlags();
{
- mesos::ACL::ViewRole* acl = flags.acls.get().add_view_roles();
+ mesos::ACL::ViewRole* acl = flags.acls->add_view_roles();
acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL_2.principal());
acl->mutable_roles()->set_type(mesos::ACL::Entity::NONE);
}
@@ -7950,7 +7950,7 @@ TEST_F(MasterTest, MultiRoleSchedulerUnsubscribeFromRole)
JSON::Array {
JSON::Object {
{ "name", "foo" },
- { "frameworks", JSON::Array { frameworkId.get().value() } }
+ { "frameworks", JSON::Array { frameworkId->value() } }
}
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index f088cfd..1416682 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -1444,9 +1444,8 @@ inline mesos::slave::ContainerConfig createContainerConfig(
if (taskInfo.isSome()) {
containerConfig.mutable_task_info()->CopyFrom(taskInfo.get());
- if (taskInfo.get().has_container()) {
- containerConfig.mutable_container_info()
- ->CopyFrom(taskInfo.get().container());
+ if (taskInfo->has_container()) {
+ containerConfig.mutable_container_info()->CopyFrom(taskInfo->container());
}
} else {
if (executorInfo.has_container()) {
@@ -2194,7 +2193,7 @@ inline void createDockerIPv6UserNetwork()
AWAIT_READY(err);
ASSERT_SOME(s->status().get());
- ASSERT_EQ(s->status().get().get(), 0)
+ ASSERT_EQ(s->status()->get(), 0)
<< "Unable to create the Docker IPv6 network "
<< DOCKER_IPv6_NETWORK
<< " : " << err.get();
@@ -2226,7 +2225,7 @@ inline void removeDockerIPv6UserNetwork()
AWAIT_READY(err);
ASSERT_SOME(s->status().get());
- ASSERT_EQ(s->status().get().get(), 0)
+ ASSERT_EQ(s->status()->get(), 0)
<< "Unable to delete the Docker IPv6 network "
<< DOCKER_IPv6_NETWORK
<< " : " << err.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/scheduler_http_api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_http_api_tests.cpp b/src/tests/scheduler_http_api_tests.cpp
index 02cfe54..64c0006 100644
--- a/src/tests/scheduler_http_api_tests.cpp
+++ b/src/tests/scheduler_http_api_tests.cpp
@@ -664,7 +664,7 @@ TEST_P(SchedulerHttpApiTest, UpdateHttpToPidSchedulerAndBack)
driver.start();
AWAIT_READY(frameworkId);
- ASSERT_NE("", frameworkId.get().value());
+ ASSERT_NE("", frameworkId->value());
frameworkInfo.mutable_id()->CopyFrom(evolve(frameworkId.get()));
@@ -692,9 +692,9 @@ TEST_P(SchedulerHttpApiTest, UpdateHttpToPidSchedulerAndBack)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
AWAIT_EXPECT_RESPONSE_HEADER_EQ("chunked", "Transfer-Encoding", response);
- ASSERT_EQ(Response::PIPE, response.get().type);
+ ASSERT_EQ(Response::PIPE, response->type);
- Option<Pipe::Reader> reader = response.get().reader;
+ Option<Pipe::Reader> reader = response->reader;
ASSERT_SOME(reader);
auto deserializer = lambda::bind(
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/slave_authorization_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_authorization_tests.cpp b/src/tests/slave_authorization_tests.cpp
index 2b3bbbc..ea391f1 100644
--- a/src/tests/slave_authorization_tests.cpp
+++ b/src/tests/slave_authorization_tests.cpp
@@ -622,7 +622,7 @@ TYPED_TEST(SlaveAuthorizerTest, AuthorizeRunTaskOnAgent)
AWAIT_READY(frameworkId);
AWAIT_READY(offers);
- ASSERT_FALSE(offers.get().empty());
+ ASSERT_FALSE(offers->empty());
Offer offer = offers.get()[0];
@@ -731,7 +731,7 @@ TEST_F(ExecutorAuthorizationTest, RunTaskGroup)
AWAIT_READY(frameworkId);
AWAIT_READY(offers);
- ASSERT_FALSE(offers.get().empty());
+ ASSERT_FALSE(offers->empty());
Offer offer = offers.get()[0];
@@ -1080,8 +1080,7 @@ TEST_F(ExecutorAuthorizationTest, FailedApiCalls)
containerId.mutable_parent()->CopyFrom(executorSubscribed->container_id());
http::Headers headers;
- headers["Authorization"] =
- "Bearer " + authenticationToken.get().value().data();
+ headers["Authorization"] = "Bearer " + authenticationToken->value().data();
// Since the executor library has already been initialized with a valid
// authentication token, we use an HTTP helper function to send the
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index b80d864..e253317 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -2231,8 +2231,7 @@ TEST_F(SlaveTest, HTTPExecutorBadAuthentication)
->CopyFrom(containerId);
process::http::Headers headers;
- headers["Authorization"] =
- "Bearer " + authenticationToken.get().value().data();
+ headers["Authorization"] = "Bearer " + authenticationToken->value().data();
Future<Response> response = process::http::post(
slavePid,
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/uri/fetchers/copy.cpp
----------------------------------------------------------------------
diff --git a/src/uri/fetchers/copy.cpp b/src/uri/fetchers/copy.cpp
index 17f69be..4f482cc 100644
--- a/src/uri/fetchers/copy.cpp
+++ b/src/uri/fetchers/copy.cpp
@@ -117,9 +117,9 @@ Future<Nothing> CopyFetcherPlugin::fetch(
}
return await(
- s.get().status(),
- io::read(s.get().out().get()),
- io::read(s.get().err().get()))
+ s->status(),
+ io::read(s->out().get()),
+ io::read(s->err().get()))
.then([](const tuple<
Future<Option<int>>,
Future<string>,
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/uri/fetchers/curl.cpp
----------------------------------------------------------------------
diff --git a/src/uri/fetchers/curl.cpp b/src/uri/fetchers/curl.cpp
index e18573d..43584aa 100644
--- a/src/uri/fetchers/curl.cpp
+++ b/src/uri/fetchers/curl.cpp
@@ -126,9 +126,9 @@ Future<Nothing> CurlFetcherPlugin::fetch(
}
return await(
- s.get().status(),
- io::read(s.get().out().get()),
- io::read(s.get().err().get()))
+ s->status(),
+ io::read(s->out().get()),
+ io::read(s->err().get()))
.then([](const tuple<
Future<Option<int>>,
Future<string>,
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/uri/fetchers/docker.cpp
----------------------------------------------------------------------
diff --git a/src/uri/fetchers/docker.cpp b/src/uri/fetchers/docker.cpp
index 91db13b..21f8eb1 100644
--- a/src/uri/fetchers/docker.cpp
+++ b/src/uri/fetchers/docker.cpp
@@ -125,9 +125,9 @@ static Future<http::Response> curl(
}
return await(
- s.get().status(),
- io::read(s.get().out().get()),
- io::read(s.get().err().get()))
+ s->status(),
+ io::read(s->out().get()),
+ io::read(s->err().get()))
.then([](const tuple<
Future<Option<int>>,
Future<string>,
@@ -240,9 +240,9 @@ static Future<int> download(
}
return await(
- s.get().status(),
- io::read(s.get().out().get()),
- io::read(s.get().err().get()))
+ s->status(),
+ io::read(s->out().get()),
+ io::read(s->err().get()))
.then([=](const tuple<
Future<Option<int>>,
Future<string>,
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/usage/usage.cpp
----------------------------------------------------------------------
diff --git a/src/usage/usage.cpp b/src/usage/usage.cpp
index 01c29f0..8414ac2 100644
--- a/src/usage/usage.cpp
+++ b/src/usage/usage.cpp
@@ -54,7 +54,7 @@ Try<ResourceStatistics> usage(pid_t pid, bool mem, bool cpus)
if (mem) {
if (tree.process.rss.isSome()) {
statistics.set_mem_rss_bytes(
- statistics.mem_rss_bytes() + tree.process.rss.get().bytes());
+ statistics.mem_rss_bytes() + tree.process.rss->bytes());
}
}
@@ -63,12 +63,10 @@ Try<ResourceStatistics> usage(pid_t pid, bool mem, bool cpus)
if (cpus) {
if (tree.process.utime.isSome() && tree.process.stime.isSome()) {
statistics.set_cpus_user_time_secs(
- statistics.cpus_user_time_secs() +
- tree.process.utime.get().secs());
+ statistics.cpus_user_time_secs() + tree.process.utime->secs());
statistics.set_cpus_system_time_secs(
- statistics.cpus_system_time_secs() +
- tree.process.stime.get().secs());
+ statistics.cpus_system_time_secs() + tree.process.stime->secs());
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/watcher/whitelist_watcher.cpp
----------------------------------------------------------------------
diff --git a/src/watcher/whitelist_watcher.cpp b/src/watcher/whitelist_watcher.cpp
index 3a556c5..df4b54e 100644
--- a/src/watcher/whitelist_watcher.cpp
+++ b/src/watcher/whitelist_watcher.cpp
@@ -65,7 +65,7 @@ void WhitelistWatcher::initialize()
// 'whitelist' which represented "accept all nodes" was the string
// value '*' rather than 'None'. For backwards compatibility we
// still check for '*'. Can be removed after 0.23.
- if (path.isSome() && path.get().string() == "*") {
+ if (path.isSome() && path->string() == "*") {
LOG(WARNING)
<< "Explicitly specifying '*' for the whitelist in order to "
<< "\"accept all\" is deprecated and will be removed in a future "
@@ -73,7 +73,7 @@ void WhitelistWatcher::initialize()
<< "\"accept all\" agents";
}
- if (path.isNone() || path.get().string() == "*") { // Accept all nodes.
+ if (path.isNone() || path->string() == "*") { // Accept all nodes.
VLOG(1) << "No whitelist given";
if (lastWhitelist.isSome()) {
subscriber(None());
@@ -93,14 +93,14 @@ void WhitelistWatcher::watch()
Option<hashset<string>> whitelist;
CHECK_SOME(path);
- Try<string> read = os::read(path.get().string());
+ Try<string> read = os::read(path->string());
if (read.isError()) {
LOG(ERROR) << "Error reading whitelist file: " << read.error() << ". "
<< "Retrying";
whitelist = lastWhitelist;
- } else if (read.get().empty()) {
- VLOG(1) << "Empty whitelist file " << path.get().string();
+ } else if (read->empty()) {
+ VLOG(1) << "Empty whitelist file " << path->string();
whitelist = hashset<string>();
} else {
hashset<string> hostnames;
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/zookeeper/contender.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/contender.cpp b/src/zookeeper/contender.cpp
index fa49647..daf1c6e 100644
--- a/src/zookeeper/contender.cpp
+++ b/src/zookeeper/contender.cpp
@@ -204,7 +204,7 @@ void LeaderContenderProcess::cancel()
return;
}
- LOG(INFO) << "Now cancelling the membership: " << candidacy.get().id();
+ LOG(INFO) << "Now cancelling the membership: " << candidacy->id();
group->cancel(candidacy.get())
.onAny(defer(self(), &Self::cancelled, lambda::_1));
@@ -214,7 +214,7 @@ void LeaderContenderProcess::cancel()
void LeaderContenderProcess::cancelled(const Future<bool>& result)
{
CHECK_READY(candidacy);
- LOG(INFO) << "Membership cancelled: " << candidacy.get().id();
+ LOG(INFO) << "Membership cancelled: " << candidacy->id();
// Can be called as a result of either withdraw() or server side
// expiration.
@@ -265,7 +265,7 @@ void LeaderContenderProcess::joined()
return;
}
- LOG(INFO) << "New candidate (id='" << candidacy.get().id()
+ LOG(INFO) << "New candidate (id='" << candidacy->id()
<< "') has entered the contest for leadership";
// Transition to 'watching' state.
@@ -275,7 +275,7 @@ void LeaderContenderProcess::joined()
if (contending.get()->set(watching.get()->future())) {
// Continue to watch that our membership is not removed (if the
// client still cares about it).
- candidacy.get().cancelled()
+ candidacy->cancelled()
.onAny(defer(self(), &Self::cancelled, lambda::_1));
}
}
[3/4] mesos git commit: Removed some redundant `get` calls in
libprocess.
Posted by bb...@apache.org.
Removed some redundant `get` calls in libprocess.
Review: https://reviews.apache.org/r/65161/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0d96c616
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0d96c616
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0d96c616
Branch: refs/heads/master
Commit: 0d96c6167f9a12bfeeff87a65057f8af6a2fc443
Parents: e65fa46
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Feb 21 14:24:52 2018 +0100
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Wed Feb 21 14:26:56 2018 +0100
----------------------------------------------------------------------
3rdparty/libprocess/include/process/gmock.hpp | 7 +-
3rdparty/libprocess/include/process/gtest.hpp | 26 ++--
3rdparty/libprocess/include/process/system.hpp | 20 +--
3rdparty/libprocess/src/http.cpp | 2 +-
3rdparty/libprocess/src/http_proxy.cpp | 4 +-
3rdparty/libprocess/src/metrics/metrics.cpp | 20 +--
3rdparty/libprocess/src/openssl.cpp | 16 +--
3rdparty/libprocess/src/process.cpp | 10 +-
3rdparty/libprocess/src/ssl/utilities.cpp | 9 +-
3rdparty/libprocess/src/subprocess_posix.hpp | 2 +-
3rdparty/libprocess/src/tests/benchmarks.cpp | 4 +-
3rdparty/libprocess/src/tests/collect_tests.cpp | 6 +-
3rdparty/libprocess/src/tests/future_tests.cpp | 2 +-
3rdparty/libprocess/src/tests/http_tests.cpp | 66 ++++-----
3rdparty/libprocess/src/tests/metrics_tests.cpp | 41 +++---
3rdparty/libprocess/src/tests/process_tests.cpp | 4 +-
3rdparty/libprocess/src/tests/reap_tests.cpp | 10 +-
3rdparty/libprocess/src/tests/ssl_tests.cpp | 66 ++++-----
.../libprocess/src/tests/statistics_tests.cpp | 18 +--
.../libprocess/src/tests/subprocess_tests.cpp | 142 +++++++++----------
3rdparty/libprocess/src/tests/system_tests.cpp | 6 +-
.../libprocess/src/tests/timeseries_tests.cpp | 2 +-
22 files changed, 233 insertions(+), 250 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/include/process/gmock.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gmock.hpp b/3rdparty/libprocess/include/process/gmock.hpp
index 231efcd..b5ead1c 100644
--- a/3rdparty/libprocess/include/process/gmock.hpp
+++ b/3rdparty/libprocess/include/process/gmock.hpp
@@ -401,10 +401,9 @@ MATCHER_P4(UnionHttpMatcher, message, unionType, path, deserializer, "")
return false;
}
- return (testing::Matcher<unionType_type>(unionType).Matches(
- message_.get().type()) &&
- testing::Matcher<std::string>(path).Matches(
- event.request->url.path));
+ return (
+ testing::Matcher<unionType_type>(unionType).Matches(message_->type()) &&
+ testing::Matcher<std::string>(path).Matches(event.request->url.path));
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/include/process/gtest.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gtest.hpp b/3rdparty/libprocess/include/process/gtest.hpp
index 307cbfe..dd4c9bd 100644
--- a/3rdparty/libprocess/include/process/gtest.hpp
+++ b/3rdparty/libprocess/include/process/gtest.hpp
@@ -423,15 +423,15 @@ inline ::testing::AssertionResult AwaitAssertResponseStatusEq(
AwaitAssertReady(actualExpr, durationExpr, actual, duration);
if (result) {
- if (expected == actual.get().status) {
+ if (expected == actual->status) {
return ::testing::AssertionSuccess();
} else {
return ::testing::AssertionFailure()
- << "Value of: (" << actualExpr << ").get().status\n"
- << " Actual: " << ::testing::PrintToString(actual.get().status) << "\n"
- << "Expected: " << expectedExpr << "\n"
- << "Which is: " << ::testing::PrintToString(expected) << "\n"
- << " Body: " << ::testing::PrintToString(actual.get().body);
+ << "Value of: (" << actualExpr << ")->status\n"
+ << " Actual: " << ::testing::PrintToString(actual->status) << "\n"
+ << "Expected: " << expectedExpr << "\n"
+ << "Which is: " << ::testing::PrintToString(expected) << "\n"
+ << " Body: " << ::testing::PrintToString(actual->body);
}
}
@@ -473,14 +473,14 @@ inline ::testing::AssertionResult AwaitAssertResponseBodyEq(
AwaitAssertReady(actualExpr, durationExpr, actual, duration);
if (result) {
- if (expected == actual.get().body) {
+ if (expected == actual->body) {
return ::testing::AssertionSuccess();
} else {
return ::testing::AssertionFailure()
- << "Value of: (" << actualExpr << ").get().body\n"
- << " Actual: " << ::testing::PrintToString(actual.get().body) << "\n"
- << "Expected: " << expectedExpr << "\n"
- << "Which is: " << ::testing::PrintToString(expected);
+ << "Value of: (" << actualExpr << ")->body\n"
+ << " Actual: " << ::testing::PrintToString(actual->body) << "\n"
+ << "Expected: " << expectedExpr << "\n"
+ << "Which is: " << ::testing::PrintToString(expected);
}
}
@@ -524,7 +524,7 @@ inline ::testing::AssertionResult AwaitAssertResponseHeaderEq(
AwaitAssertReady(actualExpr, durationExpr, actual, duration);
if (result) {
- const Option<std::string> value = actual.get().headers.get(key);
+ const Option<std::string> value = actual->headers.get(key);
if (value.isNone()) {
return ::testing::AssertionFailure()
<< "Response does not contain header '" << key << "'";
@@ -532,7 +532,7 @@ inline ::testing::AssertionResult AwaitAssertResponseHeaderEq(
return ::testing::AssertionSuccess();
} else {
return ::testing::AssertionFailure()
- << "Value of: (" << actualExpr << ").get().headers[" << keyExpr << "]\n"
+ << "Value of: (" << actualExpr << ")->headers[" << keyExpr << "]\n"
<< " Actual: " << ::testing::PrintToString(value.get()) << "\n"
<< "Expected: " << expectedExpr << "\n"
<< "Which is: " << ::testing::PrintToString(expected);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/include/process/system.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/system.hpp b/3rdparty/libprocess/include/process/system.hpp
index 21bd330..6bd815d 100644
--- a/3rdparty/libprocess/include/process/system.hpp
+++ b/3rdparty/libprocess/include/process/system.hpp
@@ -103,7 +103,7 @@ private:
{
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- return load.get().one;
+ return load->one;
}
return Failure("Failed to get loadavg: " + load.error());
}
@@ -113,7 +113,7 @@ private:
{
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- return load.get().five;
+ return load->five;
}
return Failure("Failed to get loadavg: " + load.error());
}
@@ -123,7 +123,7 @@ private:
{
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- return load.get().fifteen;
+ return load->fifteen;
}
return Failure("Failed to get loadavg: " + load.error());
}
@@ -143,7 +143,7 @@ private:
{
Try<os::Memory> memory = os::memory();
if (memory.isSome()) {
- return static_cast<double>(memory.get().total.bytes());
+ return static_cast<double>(memory->total.bytes());
}
return Failure("Failed to get memory: " + memory.error());
}
@@ -153,7 +153,7 @@ private:
{
Try<os::Memory> memory = os::memory();
if (memory.isSome()) {
- return static_cast<double>(memory.get().free.bytes());
+ return static_cast<double>(memory->free.bytes());
}
return Failure("Failed to get memory: " + memory.error());
}
@@ -164,9 +164,9 @@ private:
JSON::Object object;
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- object.values["avg_load_1min"] = load.get().one;
- object.values["avg_load_5min"] = load.get().five;
- object.values["avg_load_15min"] = load.get().fifteen;
+ object.values["avg_load_1min"] = load->one;
+ object.values["avg_load_5min"] = load->five;
+ object.values["avg_load_15min"] = load->fifteen;
}
Try<long> cpus = os::cpus();
@@ -176,8 +176,8 @@ private:
Try<os::Memory> memory = os::memory();
if (memory.isSome()) {
- object.values["mem_total_bytes"] = memory.get().total.bytes();
- object.values["mem_free_bytes"] = memory.get().free.bytes();
+ object.values["mem_total_bytes"] = memory->total.bytes();
+ object.values["mem_free_bytes"] = memory->free.bytes();
}
return http::OK(object, request.url.query.get("jsonp"));
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index 76a65e0..63dd2c1 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -292,7 +292,7 @@ bool Request::acceptsEncoding(const string& encoding) const
// then the server SHOULD use the "identity" content-coding...
Option<string> accept = headers.get("Accept-Encoding");
- if (accept.isNone() || accept.get().empty()) {
+ if (accept.isNone() || accept->empty()) {
return false;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/http_proxy.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http_proxy.cpp b/3rdparty/libprocess/src/http_proxy.cpp
index f584238..25d6379 100644
--- a/3rdparty/libprocess/src/http_proxy.cpp
+++ b/3rdparty/libprocess/src/http_proxy.cpp
@@ -257,12 +257,12 @@ void HttpProxy::stream(
if (chunk.isReady()) {
std::ostringstream out;
- if (chunk.get().empty()) {
+ if (chunk->empty()) {
// Finished reading.
out << "0\r\n" << "\r\n";
finished = true;
} else {
- out << std::hex << chunk.get().size() << "\r\n";
+ out << std::hex << chunk->size() << "\r\n";
out << chunk.get();
out << "\r\n";
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/metrics/metrics.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/metrics/metrics.cpp b/3rdparty/libprocess/src/metrics/metrics.cpp
index f795418..3a5bd3d 100644
--- a/3rdparty/libprocess/src/metrics/metrics.cpp
+++ b/3rdparty/libprocess/src/metrics/metrics.cpp
@@ -86,7 +86,7 @@ MetricsProcess* MetricsProcess::create(
<< "Failed to parse LIBPROCESS_METRICS_SNAPSHOT_ENDPOINT_RATE_LIMIT "
<< "'" << limit.get() << "'"
<< " (format is <number of requests>/<interval duration>)"
- << (reason.isSome() ? ": " + reason.get().message : "");
+ << (reason.isSome() ? ": " + reason->message : "");
}
}
@@ -239,15 +239,15 @@ Future<map<string, double>> MetricsProcess::__snapshot(
Option<Statistics<double>> statistics_ = statistics.get(key).get();
if (statistics_.isSome()) {
- snapshot[key + "/count"] = static_cast<double>(statistics_.get().count);
- snapshot[key + "/min"] = statistics_.get().min;
- snapshot[key + "/max"] = statistics_.get().max;
- snapshot[key + "/p50"] = statistics_.get().p50;
- snapshot[key + "/p90"] = statistics_.get().p90;
- snapshot[key + "/p95"] = statistics_.get().p95;
- snapshot[key + "/p99"] = statistics_.get().p99;
- snapshot[key + "/p999"] = statistics_.get().p999;
- snapshot[key + "/p9999"] = statistics_.get().p9999;
+ snapshot[key + "/count"] = static_cast<double>(statistics_->count);
+ snapshot[key + "/min"] = statistics_->min;
+ snapshot[key + "/max"] = statistics_->max;
+ snapshot[key + "/p50"] = statistics_->p50;
+ snapshot[key + "/p90"] = statistics_->p90;
+ snapshot[key + "/p95"] = statistics_->p95;
+ snapshot[key + "/p99"] = statistics_->p99;
+ snapshot[key + "/p999"] = statistics_->p999;
+ snapshot[key + "/p9999"] = statistics_->p9999;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/openssl.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/openssl.cpp b/3rdparty/libprocess/src/openssl.cpp
index f2fe90b..a4d5036 100644
--- a/3rdparty/libprocess/src/openssl.cpp
+++ b/3rdparty/libprocess/src/openssl.cpp
@@ -541,13 +541,11 @@ void reinitialize()
if (ssl_flags->verify_cert) {
// Set CA locations.
if (ssl_flags->ca_file.isSome() || ssl_flags->ca_dir.isSome()) {
- const char* ca_file = ssl_flags->ca_file.isSome()
- ? ssl_flags->ca_file.get().c_str()
- : nullptr;
+ const char* ca_file =
+ ssl_flags->ca_file.isSome() ? ssl_flags->ca_file->c_str() : nullptr;
- const char* ca_dir = ssl_flags->ca_dir.isSome()
- ? ssl_flags->ca_dir.get().c_str()
- : nullptr;
+ const char* ca_dir =
+ ssl_flags->ca_dir.isSome() ? ssl_flags->ca_dir->c_str() : nullptr;
if (SSL_CTX_load_verify_locations(ctx, ca_file, ca_dir) != 1) {
unsigned long error = ERR_get_error();
@@ -614,7 +612,7 @@ void reinitialize()
// Set certificate chain.
if (SSL_CTX_use_certificate_chain_file(
ctx,
- ssl_flags->cert_file.get().c_str()) != 1) {
+ ssl_flags->cert_file->c_str()) != 1) {
unsigned long error = ERR_get_error();
EXIT(EXIT_FAILURE)
<< "Could not load cert file '" << ssl_flags->cert_file.get() << "' "
@@ -623,9 +621,7 @@ void reinitialize()
// Set private key.
if (SSL_CTX_use_PrivateKey_file(
- ctx,
- ssl_flags->key_file.get().c_str(),
- SSL_FILETYPE_PEM) != 1) {
+ ctx, ssl_flags->key_file->c_str(), SSL_FILETYPE_PEM) != 1) {
unsigned long error = ERR_get_error();
EXIT(EXIT_FAILURE)
<< "Could not load key file '" << ssl_flags->key_file.get() << "' "
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 42e7adf..a3a96a3 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -903,7 +903,7 @@ void on_accept(const Future<Socket>& socket)
StreamingRequestDecoder* decoder = new StreamingRequestDecoder();
- socket.get().recv(data, size)
+ socket->recv(data, size)
.onAny(lambda::bind(
&internal::decode_recv,
lambda::_1,
@@ -1588,7 +1588,7 @@ void SocketManager::link(
return;
}
socket = create.get();
- int_fd s = socket.get().get();
+ int_fd s = socket->get();
CHECK(sockets.count(s) == 0);
sockets.emplace(s, socket.get());
@@ -1903,7 +1903,7 @@ void SocketManager::send_connect(
}
CHECK_SOME(poll_socket);
- Future<Nothing> connect = poll_socket.get().connect(message.to.address);
+ Future<Nothing> connect = poll_socket->connect(message.to.address);
connect.onAny(lambda::bind(
// TODO(benh): with C++14 we can use lambda instead of
// `std::bind` and capture `message` with a `std::move`.
@@ -2454,7 +2454,7 @@ long ProcessManager::init_threads()
Option<string> value = os::getenv(env_var);
if (value.isSome()) {
constexpr long maxval = 1024;
- Try<long> number = numify<long>(value.get().c_str());
+ Try<long> number = numify<long>(value->c_str());
if (number.isSome() && number.get() > 0L && number.get() <= maxval) {
VLOG(1) << "Overriding default number of worker threads "
<< num_worker_threads << ", using the value "
@@ -2684,7 +2684,7 @@ void ProcessManager::handle(
foreach (const Owned<firewall::FirewallRule>& rule, firewallRules) {
Option<Response> rejection = rule->apply(socket, *request);
if (rejection.isSome()) {
- VLOG(1) << "Returning '"<< rejection.get().status << "' for '"
+ VLOG(1) << "Returning '" << rejection->status << "' for '"
<< request->url.path << "' (firewall rule forbids request)";
// TODO(arojas): Get rid of the duplicated code to return an
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/ssl/utilities.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/ssl/utilities.cpp b/3rdparty/libprocess/src/ssl/utilities.cpp
index 9b1d622..4d3727d 100644
--- a/3rdparty/libprocess/src/ssl/utilities.cpp
+++ b/3rdparty/libprocess/src/ssl/utilities.cpp
@@ -192,7 +192,7 @@ Try<X509*> generate_x509(
name,
"CN",
MBSTRING_ASC,
- reinterpret_cast<const unsigned char*>(hostname.get().c_str()),
+ reinterpret_cast<const unsigned char*>(hostname->c_str()),
-1,
-1,
0) != 1) {
@@ -238,7 +238,7 @@ Try<X509*> generate_x509(
return Error("Failed to create alternative name: ASN1_STRING_new");
}
- Try<in_addr> in = ip.get().in();
+ Try<in_addr> in = ip->in();
if (in.isError()) {
ASN1_STRING_free(alt_name_str);
@@ -256,10 +256,7 @@ Try<X509*> generate_x509(
// For `iPAddress` we hand over a binary value as part of the
// specification.
- if (ASN1_STRING_set(
- alt_name_str,
- &in.get().s_addr,
- sizeof(in_addr_t)) == 0) {
+ if (ASN1_STRING_set(alt_name_str, &in->s_addr, sizeof(in_addr_t)) == 0) {
ASN1_STRING_free(alt_name_str);
GENERAL_NAME_free(alt_name);
sk_GENERAL_NAME_pop_free(alt_name_stack, GENERAL_NAME_free);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/subprocess_posix.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/subprocess_posix.hpp b/3rdparty/libprocess/src/subprocess_posix.hpp
index 25eb44a..007058b 100644
--- a/3rdparty/libprocess/src/subprocess_posix.hpp
+++ b/3rdparty/libprocess/src/subprocess_posix.hpp
@@ -225,7 +225,7 @@ inline Try<pid_t> cloneChild(
if (environment.isSome()) {
// NOTE: We add 1 to the size for a `nullptr` terminator.
- envp = new char*[environment.get().size() + 1];
+ envp = new char*[environment->size() + 1];
size_t index = 0;
foreachpair (
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/benchmarks.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/benchmarks.cpp b/3rdparty/libprocess/src/tests/benchmarks.cpp
index 48b5f5c..1368375 100644
--- a/3rdparty/libprocess/src/tests/benchmarks.cpp
+++ b/3rdparty/libprocess/src/tests/benchmarks.cpp
@@ -131,7 +131,7 @@ private:
if (messageSize.isError()) {
return http::BadRequest("Invalid 'messageSize': " + messageSize.error());
}
- message = string(messageSize.get().bytes(), '1');
+ message = string(messageSize->bytes(), '1');
Try<size_t> numify_ = numify<size_t>(parameters["requests"].get());
if (numify_.isError()) {
@@ -279,7 +279,7 @@ TEST(ProcessTest, Process_BENCHMARK_ClientServer)
Try<Duration> elapsed = Duration::parse(response.body);
ASSERT_SOME(elapsed);
- double throughput = numRequests / elapsed.get().secs();
+ double throughput = numRequests / elapsed->secs();
cout << "Client " << i << ": " << throughput << " rpcs / sec" << endl;
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/collect_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/collect_tests.cpp b/3rdparty/libprocess/src/tests/collect_tests.cpp
index 7c2ba90..2b16f43 100644
--- a/3rdparty/libprocess/src/tests/collect_tests.cpp
+++ b/3rdparty/libprocess/src/tests/collect_tests.cpp
@@ -33,7 +33,7 @@ TEST(CollectTest, Ready)
Future<list<int>> collect = process::collect(empty);
AWAIT_READY(collect);
- EXPECT_TRUE(collect.get().empty());
+ EXPECT_TRUE(collect->empty());
Promise<int> promise1;
Promise<int> promise2;
@@ -168,7 +168,7 @@ TEST(AwaitTest, Success)
list<Future<int>> empty;
Future<list<Future<int>>> future = process::await(empty);
AWAIT_ASSERT_READY(future);
- EXPECT_TRUE(future.get().empty());
+ EXPECT_TRUE(future->empty());
Promise<int> promise1;
Promise<int> promise2;
@@ -191,7 +191,7 @@ TEST(AwaitTest, Success)
AWAIT_ASSERT_READY(future);
- EXPECT_EQ(futures.size(), future.get().size());
+ EXPECT_EQ(futures.size(), future->size());
// We expect them to be returned in the same order as the
// future list that was passed in.
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/future_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/future_tests.cpp b/3rdparty/libprocess/src/tests/future_tests.cpp
index bd98154..0ecbb31 100644
--- a/3rdparty/libprocess/src/tests/future_tests.cpp
+++ b/3rdparty/libprocess/src/tests/future_tests.cpp
@@ -641,7 +641,7 @@ TEST(FutureTest, Select)
AWAIT_READY(future);
AWAIT_READY(future.get());
- EXPECT_EQ(42, future.get().get());
+ EXPECT_EQ(42, future->get());
futures.erase(promise1.future());
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index a60f6b1..4a7e81e 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -635,26 +635,26 @@ TEST_P(HTTPTest, PathParse)
http::path::parse(pattern, "/books/0304827484/chapters/3");
ASSERT_SOME(parse);
- EXPECT_EQ(4u, parse.get().size());
- EXPECT_SOME_EQ("books", parse.get().get("books"));
- EXPECT_SOME_EQ("0304827484", parse.get().get("isbn"));
- EXPECT_SOME_EQ("chapters", parse.get().get("chapters"));
- EXPECT_SOME_EQ("3", parse.get().get("chapter"));
+ EXPECT_EQ(4u, parse->size());
+ EXPECT_SOME_EQ("books", parse->get("books"));
+ EXPECT_SOME_EQ("0304827484", parse->get("isbn"));
+ EXPECT_SOME_EQ("chapters", parse->get("chapters"));
+ EXPECT_SOME_EQ("3", parse->get("chapter"));
parse = http::path::parse(pattern, "/books/0304827484");
ASSERT_SOME(parse);
- EXPECT_EQ(2u, parse.get().size());
- EXPECT_SOME_EQ("books", parse.get().get("books"));
- EXPECT_SOME_EQ("0304827484", parse.get().get("isbn"));
+ EXPECT_EQ(2u, parse->size());
+ EXPECT_SOME_EQ("books", parse->get("books"));
+ EXPECT_SOME_EQ("0304827484", parse->get("isbn"));
parse = http::path::parse(pattern, "/books/0304827484/chapters");
ASSERT_SOME(parse);
- EXPECT_EQ(3u, parse.get().size());
- EXPECT_SOME_EQ("books", parse.get().get("books"));
- EXPECT_SOME_EQ("0304827484", parse.get().get("isbn"));
- EXPECT_SOME_EQ("chapters", parse.get().get("chapters"));
+ EXPECT_EQ(3u, parse->size());
+ EXPECT_SOME_EQ("books", parse->get("books"));
+ EXPECT_SOME_EQ("0304827484", parse->get("isbn"));
+ EXPECT_SOME_EQ("chapters", parse->get("chapters"));
parse = http::path::parse(pattern, "/foo/0304827484/chapters");
@@ -776,11 +776,11 @@ TEST_P(HTTPTest, StreamingGetComplete)
// The response should be ready since the headers were sent.
AWAIT_READY(response);
- EXPECT_SOME_EQ("chunked", response.get().headers.get("Transfer-Encoding"));
- ASSERT_EQ(http::Response::PIPE, response.get().type);
- ASSERT_SOME(response.get().reader);
+ EXPECT_SOME_EQ("chunked", response->headers.get("Transfer-Encoding"));
+ ASSERT_EQ(http::Response::PIPE, response->type);
+ ASSERT_SOME(response->reader);
- http::Pipe::Reader reader = response.get().reader.get();
+ http::Pipe::Reader reader = response->reader.get();
// There is no data to read yet.
Future<string> read = reader.read();
@@ -818,11 +818,11 @@ TEST_P(HTTPTest, StreamingGetFailure)
// The response should be ready since the headers were sent.
AWAIT_READY(response);
- EXPECT_SOME_EQ("chunked", response.get().headers.get("Transfer-Encoding"));
- ASSERT_EQ(http::Response::PIPE, response.get().type);
- ASSERT_SOME(response.get().reader);
+ EXPECT_SOME_EQ("chunked", response->headers.get("Transfer-Encoding"));
+ ASSERT_EQ(http::Response::PIPE, response->type);
+ ASSERT_SOME(response->reader);
- http::Pipe::Reader reader = response.get().reader.get();
+ http::Pipe::Reader reader = response->reader.get();
// There is no data to read yet.
Future<string> read = reader.read();
@@ -1734,24 +1734,24 @@ TEST(URLTest, ParseUrls)
{
Try<http::URL> url = URL::parse("https://auth.docker.com");
EXPECT_SOME(url);
- EXPECT_SOME_EQ("https", url.get().scheme);
- EXPECT_SOME_EQ(443, url.get().port);
- EXPECT_SOME_EQ("auth.docker.com", url.get().domain);
- EXPECT_EQ("/", url.get().path);
+ EXPECT_SOME_EQ("https", url->scheme);
+ EXPECT_SOME_EQ(443, url->port);
+ EXPECT_SOME_EQ("auth.docker.com", url->domain);
+ EXPECT_EQ("/", url->path);
url = URL::parse("http://docker.com/");
EXPECT_SOME(url);
- EXPECT_SOME_EQ("http", url.get().scheme);
- EXPECT_SOME_EQ(80, url.get().port);
- EXPECT_SOME_EQ("docker.com", url.get().domain);
- EXPECT_EQ("/", url.get().path);
+ EXPECT_SOME_EQ("http", url->scheme);
+ EXPECT_SOME_EQ(80, url->port);
+ EXPECT_SOME_EQ("docker.com", url->domain);
+ EXPECT_EQ("/", url->path);
url = URL::parse("http://registry.docker.com:1234/abc/1");
EXPECT_SOME(url);
- EXPECT_SOME_EQ("http", url.get().scheme);
- EXPECT_SOME_EQ(1234, url.get().port);
- EXPECT_SOME_EQ("registry.docker.com", url.get().domain);
- EXPECT_EQ("/abc/1", url.get().path);
+ EXPECT_SOME_EQ("http", url->scheme);
+ EXPECT_SOME_EQ(1234, url->port);
+ EXPECT_SOME_EQ("registry.docker.com", url->domain);
+ EXPECT_EQ("/abc/1", url->path);
// Missing scheme.
EXPECT_ERROR(URL::parse("mesos.com"));
@@ -1843,7 +1843,7 @@ TEST_F(HttpAuthenticationTest, Unauthorized)
EXPECT_EQ(
authentication.unauthorized->headers.get("WWW-Authenticate"),
- response.get().headers.get("WWW-Authenticate"));
+ response->headers.get("WWW-Authenticate"));
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/metrics_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/metrics_tests.cpp b/3rdparty/libprocess/src/tests/metrics_tests.cpp
index 5a5a2e5..f2bd99b 100644
--- a/3rdparty/libprocess/src/tests/metrics_tests.cpp
+++ b/3rdparty/libprocess/src/tests/metrics_tests.cpp
@@ -190,17 +190,17 @@ TEST_F(MetricsTest, Statistics)
Option<Statistics<double>> statistics = counter.statistics();
EXPECT_SOME(statistics);
- EXPECT_EQ(11u, statistics.get().count);
+ EXPECT_EQ(11u, statistics->count);
- EXPECT_DOUBLE_EQ(0.0, statistics.get().min);
- EXPECT_DOUBLE_EQ(10.0, statistics.get().max);
+ EXPECT_DOUBLE_EQ(0.0, statistics->min);
+ EXPECT_DOUBLE_EQ(10.0, statistics->max);
- EXPECT_DOUBLE_EQ(5.0, statistics.get().p50);
- EXPECT_DOUBLE_EQ(9.0, statistics.get().p90);
- EXPECT_DOUBLE_EQ(9.5, statistics.get().p95);
- EXPECT_DOUBLE_EQ(9.9, statistics.get().p99);
- EXPECT_DOUBLE_EQ(9.99, statistics.get().p999);
- EXPECT_DOUBLE_EQ(9.999, statistics.get().p9999);
+ EXPECT_DOUBLE_EQ(5.0, statistics->p50);
+ EXPECT_DOUBLE_EQ(9.0, statistics->p90);
+ EXPECT_DOUBLE_EQ(9.5, statistics->p95);
+ EXPECT_DOUBLE_EQ(9.9, statistics->p99);
+ EXPECT_DOUBLE_EQ(9.99, statistics->p999);
+ EXPECT_DOUBLE_EQ(9.999, statistics->p9999);
AWAIT_READY(metrics::remove(counter));
}
@@ -235,11 +235,10 @@ TEST_F(MetricsTest, THREADSAFE_Snapshot)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- Try<JSON::Object> responseJSON =
- JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
- map<string, JSON::Value> values = responseJSON.get().values;
+ map<string, JSON::Value> values = responseJSON->values;
EXPECT_EQ(1u, values.count("test/counter"));
EXPECT_DOUBLE_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
@@ -270,10 +269,10 @@ TEST_F(MetricsTest, THREADSAFE_Snapshot)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- responseJSON = JSON::parse<JSON::Object>(response.get().body);
+ responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
- values = responseJSON.get().values;
+ values = responseJSON->values;
EXPECT_EQ(0u, values.count("test/counter"));
EXPECT_EQ(0u, values.count("test/gauge"));
EXPECT_EQ(0u, values.count("test/gauge_fail"));
@@ -387,14 +386,13 @@ TEST_F(MetricsTest, THREADSAFE_SnapshotTimeout)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- Try<JSON::Object> responseJSON =
- JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
// We can't use simple JSON equality testing here as initializing
// libprocess adds metrics to the system. We want to only check if
// the metrics from this test are correctly handled.
- map<string, JSON::Value> values = responseJSON.get().values;
+ map<string, JSON::Value> values = responseJSON->values;
EXPECT_EQ(1u, values.count("test/counter"));
EXPECT_DOUBLE_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
@@ -422,10 +420,10 @@ TEST_F(MetricsTest, THREADSAFE_SnapshotTimeout)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- responseJSON = JSON::parse<JSON::Object>(response.get().body);
+ responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
- values = responseJSON.get().values;
+ values = responseJSON->values;
ASSERT_SOME(responseJSON);
EXPECT_EQ(0u, values.count("test/counter"));
@@ -477,8 +475,7 @@ TEST_F(MetricsTest, SnapshotStatistics)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
- Try<JSON::Object> responseJSON =
- JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
@@ -486,7 +483,7 @@ TEST_F(MetricsTest, SnapshotStatistics)
hashmap<string, double> responseValues;
foreachpair (const string& key,
const JSON::Value& value,
- responseJSON.get().values) {
+ responseJSON->values) {
if (value.is<JSON::Number>()) {
// "test/counter/count" is an integer, everything else is a double.
JSON::Number number = value.as<JSON::Number>();
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index 96b1675..2f8a823 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -1576,7 +1576,7 @@ TEST(ProcessTest, Async)
EXPECT_EQ("42", async(&itoa2, &i).get());
// Non-void function that returns a future.
- EXPECT_EQ("42", async(&itoa1, &i).get().get());
+ EXPECT_EQ("42", async(&itoa1, &i)->get());
}
@@ -1622,7 +1622,7 @@ TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, Provide)
AWAIT_READY(response);
- ASSERT_EQ(LOREM_IPSUM, response.get().body);
+ ASSERT_EQ(LOREM_IPSUM, response->body);
terminate(server);
wait(server);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/reap_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/reap_tests.cpp b/3rdparty/libprocess/src/tests/reap_tests.cpp
index f8a8593..953806b 100644
--- a/3rdparty/libprocess/src/tests/reap_tests.cpp
+++ b/3rdparty/libprocess/src/tests/reap_tests.cpp
@@ -58,8 +58,8 @@ TEST(ReapTest, NonChildProcess)
Fork(Exec(SLEEP_COMMAND(10))),
Exec("exit 0"))();
ASSERT_SOME(tree);
- ASSERT_EQ(1u, tree.get().children.size());
- pid_t grandchild = tree.get().children.front();
+ ASSERT_EQ(1u, tree->children.size());
+ pid_t grandchild = tree->children.front();
// Reap the grandchild process.
Future<Option<int>> status = process::reap(grandchild);
@@ -83,10 +83,10 @@ TEST(ReapTest, NonChildProcess)
AWAIT_READY(status);
// The status is None because pid is not an immediate child.
- ASSERT_NONE(status.get()) << status.get().get();
+ ASSERT_NONE(status.get()) << status->get();
// Reap the child as well to clean up after ourselves.
- status = process::reap(tree.get().process.pid);
+ status = process::reap(tree->process.pid);
// Now advance time until the child is reaped.
while (status.isPending()) {
@@ -151,7 +151,7 @@ TEST(ReapTest, TerminatedChildProcess)
const Result<os::Process> process = os::process(child);
ASSERT_SOME(process) << "Process " << child << " reaped unexpectedly";
- if (process.get().zombie) {
+ if (process->zombie) {
break;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/ssl_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/ssl_tests.cpp b/3rdparty/libprocess/src/tests/ssl_tests.cpp
index 71f2df8..24fe220 100644
--- a/3rdparty/libprocess/src/tests/ssl_tests.cpp
+++ b/3rdparty/libprocess/src/tests/ssl_tests.cpp
@@ -250,7 +250,7 @@ TEST_F(SSLTest, SSLSocket)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -279,7 +279,7 @@ TEST_F(SSLTest, NonSSLSocket)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -310,7 +310,7 @@ TEST_F(SSLTest, NoVerifyBadCA)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -342,7 +342,7 @@ TEST_F(SSLTest, RequireBadCA)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -370,7 +370,7 @@ TEST_F(SSLTest, VerifyBadCA)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -400,7 +400,7 @@ TEST_F(SSLTest, VerifyCertificate)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -436,7 +436,7 @@ TEST_P(SSLTest, RequireCertificate)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -508,7 +508,7 @@ TEST_F(SSLTest, ProtocolMismatch)
if (server_protocol == client_protocol) {
// If the protocols are the same, it is valid.
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -518,7 +518,7 @@ TEST_F(SSLTest, ProtocolMismatch)
AWAIT_ASSERT_READY(await_subprocess(client.get(), 0));
} else {
// If the protocols are NOT the same, it is invalid.
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -560,7 +560,7 @@ TEST_F(SSLTest, ECDHESupport)
launch_client(client_environment, server.get(), true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -589,7 +589,7 @@ TEST_F(SSLTest, ValidDowngrade)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -618,7 +618,7 @@ TEST_F(SSLTest, NoValidDowngrade)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -659,7 +659,7 @@ TEST_F(SSLTest, ValidDowngradeEachProtocol)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -706,7 +706,7 @@ TEST_F(SSLTest, NoValidDowngradeEachProtocol)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -728,9 +728,9 @@ TEST_F(SSLTest, PeerAddress)
Socket client = client_create.get();
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
- const Try<Address> server_address = server.get().address();
+ const Try<Address> server_address = server->address();
ASSERT_SOME(server_address);
const Future<Nothing> connect = client.connect(server_address.get());
@@ -738,7 +738,7 @@ TEST_F(SSLTest, PeerAddress)
AWAIT_ASSERT_READY(socket);
AWAIT_ASSERT_READY(connect);
- const Try<Address> socket_address = socket.get().address();
+ const Try<Address> socket_address = socket->address();
ASSERT_SOME(socket_address);
// Ensure the client thinks its peer is the server.
@@ -747,7 +747,7 @@ TEST_F(SSLTest, PeerAddress)
// Ensure the client has an address, and that the server thinks its
// peer is the client.
ASSERT_SOME(client.address());
- ASSERT_SOME_EQ(client.address().get(), socket.get().peer());
+ ASSERT_SOME_EQ(client.address().get(), socket->peer());
}
@@ -760,16 +760,14 @@ TEST_F(SSLTest, HTTPSGet)
{"LIBPROCESS_SSL_CERT_FILE", certificate_path().string()}});
ASSERT_SOME(server);
- ASSERT_SOME(server.get().address());
- ASSERT_SOME(server.get().address().get().hostname());
+ ASSERT_SOME(server->address());
+ ASSERT_SOME(server->address()->hostname());
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
// Create URL from server hostname and port.
const http::URL url(
- "https",
- server.get().address().get().hostname().get(),
- server.get().address().get().port);
+ "https", server->address()->hostname().get(), server->address()->port);
// Send GET request.
Future<http::Response> response = http::get(url);
@@ -787,7 +785,7 @@ TEST_F(SSLTest, HTTPSGet)
AWAIT_ASSERT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
- ASSERT_EQ(data, response.get().body);
+ ASSERT_EQ(data, response->body);
}
@@ -800,16 +798,14 @@ TEST_F(SSLTest, HTTPSPost)
{"LIBPROCESS_SSL_CERT_FILE", certificate_path().string()}});
ASSERT_SOME(server);
- ASSERT_SOME(server.get().address());
- ASSERT_SOME(server.get().address().get().hostname());
+ ASSERT_SOME(server->address());
+ ASSERT_SOME(server->address()->hostname());
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
// Create URL from server hostname and port.
const http::URL url(
- "https",
- server.get().address().get().hostname().get(),
- server.get().address().get().port);
+ "https", server->address()->hostname().get(), server->address()->port);
// Send POST request.
Future<http::Response> response =
@@ -828,7 +824,7 @@ TEST_F(SSLTest, HTTPSPost)
AWAIT_ASSERT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
- ASSERT_EQ(data, response.get().body);
+ ASSERT_EQ(data, response->body);
}
@@ -902,10 +898,10 @@ TEST_F(SSLTest, ShutdownThenSend)
{"LIBPROCESS_SSL_CERT_FILE", certificate_path().string()}});
ASSERT_SOME(server);
- ASSERT_SOME(server.get().address());
- ASSERT_SOME(server.get().address().get().hostname());
+ ASSERT_SOME(server->address());
+ ASSERT_SOME(server->address()->hostname());
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
Clock::settle();
EXPECT_TRUE(socket.isPending());
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/statistics_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/statistics_tests.cpp b/3rdparty/libprocess/src/tests/statistics_tests.cpp
index 144b510..a2a780b 100644
--- a/3rdparty/libprocess/src/tests/statistics_tests.cpp
+++ b/3rdparty/libprocess/src/tests/statistics_tests.cpp
@@ -57,15 +57,15 @@ TEST(StatisticsTest, Statistics)
EXPECT_SOME(statistics);
- EXPECT_EQ(11u, statistics.get().count);
+ EXPECT_EQ(11u, statistics->count);
- EXPECT_DOUBLE_EQ(-5.0, statistics.get().min);
- EXPECT_DOUBLE_EQ(5.0, statistics.get().max);
+ EXPECT_DOUBLE_EQ(-5.0, statistics->min);
+ EXPECT_DOUBLE_EQ(5.0, statistics->max);
- EXPECT_DOUBLE_EQ(0.0, statistics.get().p50);
- EXPECT_DOUBLE_EQ(4.0, statistics.get().p90);
- EXPECT_DOUBLE_EQ(4.5, statistics.get().p95);
- EXPECT_DOUBLE_EQ(4.9, statistics.get().p99);
- EXPECT_DOUBLE_EQ(4.99, statistics.get().p999);
- EXPECT_DOUBLE_EQ(4.999, statistics.get().p9999);
+ EXPECT_DOUBLE_EQ(0.0, statistics->p50);
+ EXPECT_DOUBLE_EQ(4.0, statistics->p90);
+ EXPECT_DOUBLE_EQ(4.5, statistics->p95);
+ EXPECT_DOUBLE_EQ(4.9, statistics->p99);
+ EXPECT_DOUBLE_EQ(4.99, statistics->p999);
+ EXPECT_DOUBLE_EQ(4.999, statistics->p9999);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/subprocess_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/subprocess_tests.cpp b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
index ead5ded..be99bd6 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -62,14 +62,14 @@ void run_subprocess(const lambda::function<Try<Subprocess>()>& createSubprocess)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
// Check process exited cleanly.
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -240,13 +240,13 @@ TEST_F(SubprocessTest, Status)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Exit 1.
s = subprocess("exit 1");
@@ -255,47 +255,47 @@ TEST_F(SubprocessTest, Status)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(1, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(1, s->status());
// SIGTERM.
s = subprocess(SLEEP_COMMAND(60));
ASSERT_SOME(s);
- kill(s.get().pid(), SIGTERM);
+ kill(s->pid(), SIGTERM);
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WTERMSIG_EQ(SIGTERM, s.get().status());
+ AWAIT_EXPECT_WTERMSIG_EQ(SIGTERM, s->status());
// SIGKILL.
s = subprocess(SLEEP_COMMAND(60));
ASSERT_SOME(s);
- kill(s.get().pid(), SIGKILL);
+ kill(s->pid(), SIGKILL);
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WTERMSIG_EQ(SIGKILL, s.get().status());
+ AWAIT_EXPECT_WTERMSIG_EQ(SIGKILL, s->status());
}
@@ -309,18 +309,18 @@ TEST_F(SubprocessTest, PipeOutput)
Subprocess::FD(STDERR_FILENO));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Standard error.
s = subprocess(
@@ -330,18 +330,18 @@ TEST_F(SubprocessTest, PipeOutput)
Subprocess::PIPE());
ASSERT_SOME(s);
- ASSERT_SOME(s.get().err());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().err().get()));
+ ASSERT_SOME(s->err());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->err().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -354,21 +354,21 @@ TEST_F(SubprocessTest, PipeInput)
Subprocess::FD(STDERR_FILENO));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().in());
- ASSERT_SOME(os::write(s.get().in().get(), "hello\n"));
+ ASSERT_SOME(s->in());
+ ASSERT_SOME(os::write(s->in().get(), "hello\n"));
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -393,22 +393,22 @@ TEST_F(SubprocessTest, PipeRedirect)
ASSERT_SOME(fd);
ASSERT_SOME(os::nonblock(fd.get()));
- ASSERT_SOME(s.get().out());
- ASSERT_SOME(os::nonblock(s.get().out().get()));
- AWAIT_READY(io::redirect(s.get().out().get(), fd.get()));
+ ASSERT_SOME(s->out());
+ ASSERT_SOME(os::nonblock(s->out().get()));
+ AWAIT_READY(io::redirect(s->out().get(), fd.get()));
// Close our copy of the fd.
EXPECT_SOME(os::close(fd.get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Now make sure all the data is there!
Try<string> read = os::read(path);
@@ -433,13 +433,13 @@ TEST_F(SubprocessTest, PathOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
Try<string> read = os::read(out);
ASSERT_SOME(read);
@@ -456,13 +456,13 @@ TEST_F(SubprocessTest, PathOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
read = os::read(err);
ASSERT_SOME(read);
@@ -483,18 +483,18 @@ TEST_F(SubprocessTest, PathInput)
Subprocess::FD(STDERR_FILENO));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -522,13 +522,13 @@ TEST_F(SubprocessTest, FdOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
Try<string> read = os::read(out);
ASSERT_SOME(read);
@@ -553,13 +553,13 @@ TEST_F(SubprocessTest, FdOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
read = os::read(err);
ASSERT_SOME(read);
@@ -585,18 +585,18 @@ TEST_F(SubprocessTest, FdInput)
ASSERT_SOME(os::close(inFd.get()));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -608,13 +608,13 @@ TEST_F(SubprocessTest, Default)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
#endif // __WINDOWS__
@@ -695,13 +695,13 @@ TEST_F(SubprocessTest, Flags)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Parse the output and make sure that it matches the flags we
// specified in the beginning.
@@ -753,18 +753,18 @@ TEST_F(SubprocessTest, Environment)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Multiple key-value pairs.
environment.clear();
@@ -779,18 +779,18 @@ TEST_F(SubprocessTest, Environment)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello world\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello world\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -808,18 +808,18 @@ TEST_F(SubprocessTest, EnvironmentWithSpaces)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello world\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello world\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -837,18 +837,18 @@ TEST_F(SubprocessTest, EnvironmentWithSpacesAndQuotes)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("\"hello world\"\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("\"hello world\"\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -869,18 +869,18 @@ TEST_F(SubprocessTest, EnvironmentOverride)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("goodbye\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("goodbye\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
#endif // __WINDOWS__
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/system_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/system_tests.cpp b/3rdparty/libprocess/src/tests/system_tests.cpp
index 6beb973..17f2881 100644
--- a/3rdparty/libprocess/src/tests/system_tests.cpp
+++ b/3rdparty/libprocess/src/tests/system_tests.cpp
@@ -43,11 +43,9 @@ TEST(SystemTest, DISABLED_Metrics)
AWAIT_READY(response);
- EXPECT_SOME_EQ(
- "application/json",
- response.get().headers.get("Content-Type"));
+ EXPECT_SOME_EQ("application/json", response->headers.get("Content-Type"));
- Try<JSON::Object> parse = JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> parse = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(parse);
JSON::Object stats = parse.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/timeseries_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/timeseries_tests.cpp b/3rdparty/libprocess/src/tests/timeseries_tests.cpp
index 4177fb6..381e646 100644
--- a/3rdparty/libprocess/src/tests/timeseries_tests.cpp
+++ b/3rdparty/libprocess/src/tests/timeseries_tests.cpp
@@ -49,7 +49,7 @@ TEST(TimeSeriesTest, Set)
const Option<TimeSeries<int>::Value> latest = series.latest();
ASSERT_SOME(latest);
- ASSERT_EQ(1, latest.get().data);
+ ASSERT_EQ(1, latest->data);
}
[4/4] mesos git commit: Removed some redundant `get` calls in stout.
Posted by bb...@apache.org.
Removed some redundant `get` calls in stout.
Review: https://reviews.apache.org/r/65160/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e65fa462
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e65fa462
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e65fa462
Branch: refs/heads/master
Commit: e65fa4621aefc9e6d6311c5708fa4ba5300b632d
Parents: e649b41
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Feb 21 14:24:44 2018 +0100
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Wed Feb 21 14:26:56 2018 +0100
----------------------------------------------------------------------
3rdparty/stout/include/stout/flags/flags.hpp | 2 +-
3rdparty/stout/include/stout/ip.hpp | 4 +-
3rdparty/stout/include/stout/json.hpp | 4 +-
3rdparty/stout/include/stout/os.hpp | 2 +-
3rdparty/stout/include/stout/os/linux.hpp | 29 ++++----
3rdparty/stout/include/stout/os/osx.hpp | 4 +-
.../stout/include/stout/os/posix/bootid.hpp | 2 +-
3rdparty/stout/include/stout/os/posix/fork.hpp | 4 +-
.../stout/include/stout/os/posix/killtree.hpp | 15 ++--
3rdparty/stout/include/stout/os/posix/shell.hpp | 2 +-
3rdparty/stout/include/stout/os/posix/which.hpp | 6 +-
3rdparty/stout/include/stout/os/pstree.hpp | 2 +-
3rdparty/stout/include/stout/posix/os.hpp | 8 +--
3rdparty/stout/include/stout/protobuf.hpp | 6 +-
3rdparty/stout/include/stout/result.hpp | 6 +-
3rdparty/stout/include/stout/try.hpp | 2 +-
3rdparty/stout/tests/ip_tests.cpp | 10 +--
3rdparty/stout/tests/os/filesystem_tests.cpp | 14 ++--
3rdparty/stout/tests/os/process_tests.cpp | 50 ++++++-------
3rdparty/stout/tests/os/systems_tests.cpp | 14 ++--
3rdparty/stout/tests/os_tests.cpp | 76 ++++++++++----------
3rdparty/stout/tests/proc_tests.cpp | 22 +++---
3rdparty/stout/tests/some_tests.cpp | 12 ++--
23 files changed, 148 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/flags.hpp b/3rdparty/stout/include/stout/flags/flags.hpp
index 4de093d..eba847a 100644
--- a/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/stout/include/stout/flags/flags.hpp
@@ -510,7 +510,7 @@ inline void FlagsBase::add(const Flag& flag)
flags_[flag.name.value] = flag;
if (flag.alias.isSome()) {
- aliases[flag.alias.get().value] = flag.name.value;
+ aliases[flag.alias->value] = flag.name.value;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/ip.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/ip.hpp b/3rdparty/stout/include/stout/ip.hpp
index b4abcb9..5da2118 100644
--- a/3rdparty/stout/include/stout/ip.hpp
+++ b/3rdparty/stout/include/stout/ip.hpp
@@ -580,7 +580,7 @@ inline Try<IP::Network> IP::Network::create(
switch (address.family()) {
case AF_INET: {
- uint32_t mask = ntohl(netmask.in().get().s_addr);
+ uint32_t mask = ntohl(netmask.in()->s_addr);
if (((~mask + 1) & (~mask)) != 0) {
return Error("IPv4 netmask is not valid");
}
@@ -691,7 +691,7 @@ struct hash<net::IP>
switch (ip.family()) {
case AF_INET:
- boost::hash_combine(seed, htonl(ip.in().get().s_addr));
+ boost::hash_combine(seed, htonl(ip.in()->s_addr));
return seed;
case AF_INET6: {
in6_addr in6 = ip.in6().get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/json.hpp b/3rdparty/stout/include/stout/json.hpp
index 7484f4a..102cd99 100644
--- a/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/stout/include/stout/json.hpp
@@ -919,11 +919,11 @@ Try<T> parse(const std::string& s)
return Error(value.error());
}
- if (!value.get().is<T>()) {
+ if (!value->is<T>()) {
return Error("Unexpected JSON type parsed");
}
- return value.get().as<T>();
+ return value->as<T>();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os.hpp b/3rdparty/stout/include/stout/os.hpp
index c366ad0..aee0418 100644
--- a/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/stout/include/stout/os.hpp
@@ -174,7 +174,7 @@ inline Try<std::string> sysname()
return Error(info.error());
}
- return info.get().sysname;
+ return info->sysname;
}
#endif // __WINDOWS__
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/linux.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/linux.hpp b/3rdparty/stout/include/stout/os/linux.hpp
index 50352c9..4b0a807 100644
--- a/3rdparty/stout/include/stout/os/linux.hpp
+++ b/3rdparty/stout/include/stout/os/linux.hpp
@@ -199,23 +199,24 @@ inline Result<Process> process(pid_t pid)
// These are similar reports:
// http://lkml.indiana.edu/hypermail/linux/kernel/1207.1/01388.html
// https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023214
- Try<Duration> utime = Duration::create(status.get().utime / (double) ticks);
- Try<Duration> stime = Duration::create(status.get().stime / (double) ticks);
+ Try<Duration> utime = Duration::create(status->utime / (double)ticks);
+ Try<Duration> stime = Duration::create(status->stime / (double)ticks);
- // The command line from 'status.get().comm' is only "arg0" from
- // "argv" (i.e., the canonical executable name). To get the entire
- // command line we grab '/proc/[pid]/cmdline'.
+ // The command line from 'status->comm' is only "arg0" from "argv"
+ // (i.e., the canonical executable name). To get the entire command
+ // line we grab '/proc/[pid]/cmdline'.
Result<std::string> cmdline = proc::cmdline(pid);
- return Process(status.get().pid,
- status.get().ppid,
- status.get().pgrp,
- status.get().session,
- Bytes(status.get().rss * pageSize),
- utime.isSome() ? utime.get() : Option<Duration>::none(),
- stime.isSome() ? stime.get() : Option<Duration>::none(),
- cmdline.isSome() ? cmdline.get() : status.get().comm,
- status.get().state == 'Z');
+ return Process(
+ status->pid,
+ status->ppid,
+ status->pgrp,
+ status->session,
+ Bytes(status->rss * pageSize),
+ utime.isSome() ? utime.get() : Option<Duration>::none(),
+ stime.isSome() ? stime.get() : Option<Duration>::none(),
+ cmdline.isSome() ? cmdline.get() : status->comm,
+ status->state == 'Z');
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/osx.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/osx.hpp b/3rdparty/stout/include/stout/os/osx.hpp
index 504af3e..f45bab4 100644
--- a/3rdparty/stout/include/stout/os/osx.hpp
+++ b/3rdparty/stout/include/stout/os/osx.hpp
@@ -46,7 +46,7 @@ inline Result<Process> process(pid_t pid)
if (processes.isError()) {
return Error("Failed to get process via sysctl: " + processes.error());
- } else if (processes.get().size() != 1) {
+ } else if (processes->size() != 1) {
return None();
}
@@ -75,7 +75,7 @@ inline Result<Process> process(pid_t pid)
Try<std::string> args = os::sysctl(CTL_KERN, KERN_PROCARGS2, pid).string();
if (args.isSome()) {
- int argc = *((int*) args.get().data());
+ int argc = *((int*) args->data());
if (argc > 0) {
// Now grab the arguments.
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/posix/bootid.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/bootid.hpp b/3rdparty/stout/include/stout/os/posix/bootid.hpp
index 7ea5e46..98dd26f 100644
--- a/3rdparty/stout/include/stout/os/posix/bootid.hpp
+++ b/3rdparty/stout/include/stout/os/posix/bootid.hpp
@@ -48,7 +48,7 @@ inline Try<std::string> bootId()
if (boot_time.isError()) {
return Error(boot_time.error());
}
- return stringify(boot_time.get().tv_sec);
+ return stringify(boot_time->tv_sec);
#else
return Error("Not implemented");
#endif
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/posix/fork.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/fork.hpp b/3rdparty/stout/include/stout/os/posix/fork.hpp
index a29967d..098224e 100644
--- a/3rdparty/stout/include/stout/os/posix/fork.hpp
+++ b/3rdparty/stout/include/stout/os/posix/fork.hpp
@@ -368,7 +368,7 @@ private:
// Execute or wait.
if (exec.isSome()) {
// Execute the command (via '/bin/sh -c command').
- const char* command = exec.get().command.c_str();
+ const char* command = exec->command.c_str();
execlp("sh", "sh", "-c", command, (char*) nullptr);
EXIT(EXIT_FAILURE)
<< "Failed to execute '" << command << "': " << os::strerror(errno);
@@ -406,7 +406,7 @@ private:
None(),
None(),
None(),
- self.isSome() ? self.get().command : "",
+ self.isSome() ? self->command : "",
false);
std::list<ProcessTree> children;
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/posix/killtree.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/killtree.hpp b/3rdparty/stout/include/stout/os/posix/killtree.hpp
index 9f18a48..8d17673 100644
--- a/3rdparty/stout/include/stout/os/posix/killtree.hpp
+++ b/3rdparty/stout/include/stout/os/posix/killtree.hpp
@@ -107,15 +107,14 @@ inline Try<std::list<ProcessTree>> killtree(
// that we don't kill "up the tree". This can only be done if the
// process is present.
if (process.isSome() && (groups || sessions)) {
- Option<Process> parent =
- os::process(process.get().parent, processes.get());
+ Option<Process> parent = os::process(process->parent, processes.get());
if (parent.isSome()) {
if (groups) {
- visited.groups.insert(parent.get().group);
+ visited.groups.insert(parent->group);
}
- if (sessions && parent.get().session.isSome()) {
- visited.sessions.insert(parent.get().session.get());
+ if (sessions && parent->session.isSome()) {
+ visited.sessions.insert(parent->session.get());
}
}
}
@@ -160,7 +159,7 @@ inline Try<std::list<ProcessTree>> killtree(
// Now "visit" the group and/or session of the current process.
if (groups) {
- pid_t group = process.get().group;
+ pid_t group = process->group;
if (visited.groups.count(group) == 0) {
foreach (const Process& process, processes.get()) {
if (process.group == group) {
@@ -176,8 +175,8 @@ inline Try<std::list<ProcessTree>> killtree(
// not been reaped and thus is located somewhere in the tree we
// are trying to kill. Therefore, we should discover it from our
// tree traversal, or through its group (which is always present).
- if (sessions && process.get().session.isSome()) {
- pid_t session = process.get().session.get();
+ if (sessions && process->session.isSome()) {
+ pid_t session = process->session.get();
if (visited.sessions.count(session) == 0) {
foreach (const Process& process, processes.get()) {
if (process.session.isSome() && process.session.get() == session) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/posix/shell.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/shell.hpp b/3rdparty/stout/include/stout/os/posix/shell.hpp
index 175de46..b878718 100644
--- a/3rdparty/stout/include/stout/os/posix/shell.hpp
+++ b/3rdparty/stout/include/stout/os/posix/shell.hpp
@@ -78,7 +78,7 @@ Try<std::string> shell(const std::string& fmt, const T&... t)
FILE* file;
std::ostringstream stdout;
- if ((file = popen(command.get().c_str(), "r")) == nullptr) {
+ if ((file = popen(command->c_str(), "r")) == nullptr) {
return Error("Failed to run '" + command.get() + "'");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/posix/which.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/which.hpp b/3rdparty/stout/include/stout/os/posix/which.hpp
index 96586dd..c66c8d5 100644
--- a/3rdparty/stout/include/stout/os/posix/which.hpp
+++ b/3rdparty/stout/include/stout/os/posix/which.hpp
@@ -54,9 +54,9 @@ inline Option<std::string> which(
continue;
}
- if (!permissions.get().owner.x &&
- !permissions.get().group.x &&
- !permissions.get().others.x) {
+ if (!permissions->owner.x &&
+ !permissions->group.x &&
+ !permissions->others.x) {
continue;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/os/pstree.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/pstree.hpp b/3rdparty/stout/include/stout/os/pstree.hpp
index fe382a1..db9c2f9 100644
--- a/3rdparty/stout/include/stout/os/pstree.hpp
+++ b/3rdparty/stout/include/stout/os/pstree.hpp
@@ -114,7 +114,7 @@ inline Try<std::list<ProcessTree>> pstrees(
std::list<ProcessTree> trees_ = trees;
trees.clear();
foreach (const ProcessTree& t, trees_) {
- if (tree.get().contains(t.process.pid)) {
+ if (tree->contains(t.process.pid)) {
continue;
}
trees.push_back(t);
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/posix/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/posix/os.hpp b/3rdparty/stout/include/stout/posix/os.hpp
index dfee0fa..f898f07 100644
--- a/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/stout/include/stout/posix/os.hpp
@@ -402,17 +402,17 @@ inline Try<Version> release()
// TODO(karya): Replace sscanf with Version::parse() once Version
// starts supporting labels and build metadata.
if (::sscanf(
- info.get().release.c_str(),
+ info->release.c_str(),
"%d.%d.%d",
&major,
&minor,
&patch) != 3) {
- return Error("Failed to parse: " + info.get().release);
+ return Error("Failed to parse: " + info->release);
}
#else
// TODO(dforsyth): Handle FreeBSD patch versions (-pX).
- if (::sscanf(info.get().release.c_str(), "%d.%d-%*s", &major, &minor) != 2) {
- return Error("Failed to parse: " + info.get().release);
+ if (::sscanf(info->release.c_str(), "%d.%d-%*s", &major, &minor) != 2) {
+ return Error("Failed to parse: " + info->release);
}
#endif
return Version(major, minor, patch);
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/protobuf.hpp b/3rdparty/stout/include/stout/protobuf.hpp
index 7f8ed34..4a1605e 100644
--- a/3rdparty/stout/include/stout/protobuf.hpp
+++ b/3rdparty/stout/include/stout/protobuf.hpp
@@ -223,7 +223,7 @@ struct Read
return Error("Failed to read size: " + result.error());
} else if (result.isNone()) {
return None(); // No more protobufs to read.
- } else if (result.get().size() < sizeof(size)) {
+ } else if (result->size() < sizeof(size)) {
// Hit EOF unexpectedly.
if (undoFailed) {
// Restore the offset to before the size read.
@@ -237,7 +237,7 @@ struct Read
}
// Parse the size from the bytes.
- memcpy((void*) &size, (void*) result.get().data(), sizeof(size));
+ memcpy((void*)&size, (void*)result->data(), sizeof(size));
// NOTE: Instead of specifically checking for corruption in 'size',
// we simply try to read 'size' bytes. If we hit EOF early, it is an
@@ -250,7 +250,7 @@ struct Read
os::lseek(fd, offset, SEEK_SET);
}
return Error("Failed to read message: " + result.error());
- } else if (result.isNone() || result.get().size() < size) {
+ } else if (result.isNone() || result->size() < size) {
// Hit EOF unexpectedly.
if (undoFailed) {
// Restore the offset to before the size read.
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/result.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/result.hpp b/3rdparty/stout/include/stout/result.hpp
index 1bf353b..c1387ae 100644
--- a/3rdparty/stout/include/stout/result.hpp
+++ b/3rdparty/stout/include/stout/result.hpp
@@ -108,8 +108,8 @@ public:
// 'isSome', 'isNone', and 'isError' are mutually exclusive. They
// correspond to the underlying unioned state of the Option and Try.
- bool isSome() const { return data.isSome() && data.get().isSome(); }
- bool isNone() const { return data.isSome() && data.get().isNone(); }
+ bool isSome() const { return data.isSome() && data->isSome(); }
+ bool isNone() const { return data.isSome() && data->isNone(); }
bool isError() const { return data.isError(); }
const T& get() const
@@ -123,7 +123,7 @@ public:
}
ABORT(errorMessage);
}
- return data.get().get();
+ return data->get();
}
T& get()
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/include/stout/try.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/try.hpp b/3rdparty/stout/include/stout/try.hpp
index 90f8aed..bcd55b9 100644
--- a/3rdparty/stout/include/stout/try.hpp
+++ b/3rdparty/stout/include/stout/try.hpp
@@ -74,7 +74,7 @@ public:
{
if (!data.isSome()) {
assert(error_.isSome());
- ABORT("Try::get() but state == ERROR: " + error_.get().message);
+ ABORT("Try::get() but state == ERROR: " + error_->message);
}
return data.get();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/tests/ip_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/ip_tests.cpp b/3rdparty/stout/tests/ip_tests.cpp
index a38e93c..f209c7a 100644
--- a/3rdparty/stout/tests/ip_tests.cpp
+++ b/3rdparty/stout/tests/ip_tests.cpp
@@ -46,7 +46,7 @@ TEST(NetTest, LinkDevice)
string addr = stringify(network.get());
string prefix = addr.substr(addr.find('/') + 1);
ASSERT_SOME(numify<int>(prefix));
- EXPECT_EQ(network.get().prefix(), numify<int>(prefix).get());
+ EXPECT_EQ(network->prefix(), numify<int>(prefix).get());
vector<string> tokens =
strings::split(addr.substr(0, addr.find('/')), ".");
@@ -178,8 +178,8 @@ TEST(NetTest, ConstructIPv4Network)
net::IP::Network::create(net::IP(address), net::IP(netmask));
ASSERT_SOME(network);
- EXPECT_EQ(net::IP(address), network.get().address());
- EXPECT_EQ(net::IP(netmask), network.get().netmask());
+ EXPECT_EQ(net::IP(address), network->address());
+ EXPECT_EQ(net::IP(netmask), network->netmask());
EXPECT_EQ("1.2.3.4/8", stringify(network.get()));
Try<net::IP::Network> network2 =
@@ -228,8 +228,8 @@ TEST(NetTest, ConstructIPv6Network)
net::IP::Network::create(address.get(), netmask1.get());
ASSERT_SOME(network);
- EXPECT_EQ(address.get(), network.get().address());
- EXPECT_EQ(netmask1.get(), network.get().netmask());
+ EXPECT_EQ(address.get(), network->address());
+ EXPECT_EQ(netmask1.get(), network->netmask());
EXPECT_EQ("2001:cdba::3257:9652/9", stringify(network.get()));
Try<net::IP::Network> network2 =
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/tests/os/filesystem_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os/filesystem_tests.cpp b/3rdparty/stout/tests/os/filesystem_tests.cpp
index 2204d10..b84f1ae 100644
--- a/3rdparty/stout/tests/os/filesystem_tests.cpp
+++ b/3rdparty/stout/tests/os/filesystem_tests.cpp
@@ -359,17 +359,17 @@ TEST_F(FsTest, List)
// Search all files in folder
Try<list<string>> allFiles = fs::list(path::join(testdir, "*"));
ASSERT_SOME(allFiles);
- EXPECT_EQ(3u, allFiles.get().size());
+ EXPECT_EQ(3u, allFiles->size());
// Search .jpg files in folder
Try<list<string>> jpgFiles = fs::list(path::join(testdir, "*.jpg"));
ASSERT_SOME(jpgFiles);
- EXPECT_EQ(1u, jpgFiles.get().size());
+ EXPECT_EQ(1u, jpgFiles->size());
// Search test*.txt files in folder
Try<list<string>> testTxtFiles = fs::list(path::join(testdir, "*.txt"));
ASSERT_SOME(testTxtFiles);
- EXPECT_EQ(2u, testTxtFiles.get().size());
+ EXPECT_EQ(2u, testTxtFiles->size());
// Verify that we return empty list when we provide an invalid path.
Try<list<string>> noFiles = fs::list("this_path_does_not_exist");
@@ -399,7 +399,7 @@ TEST_F(FsTest, Rename)
// Search all files in folder
Try<list<string>> allFiles = fs::list(path::join(testdir, "*"));
ASSERT_SOME(allFiles);
- EXPECT_EQ(2u, allFiles.get().size());
+ EXPECT_EQ(2u, allFiles->size());
// Rename a `file1` to `file3`, which does not exist yet. Verify `file3`
// contains the text that was in `file1`, and make sure the count of files in
@@ -412,7 +412,7 @@ TEST_F(FsTest, Rename)
allFiles = fs::list(path::join(testdir, "*"));
ASSERT_SOME(allFiles);
- EXPECT_EQ(2u, allFiles.get().size());
+ EXPECT_EQ(2u, allFiles->size());
// Rename `file3` -> `file2`. `file2` exists, so this will replace it. Verify
// text in the file, and that the count of files in the directory have gone
@@ -424,7 +424,7 @@ TEST_F(FsTest, Rename)
allFiles = fs::list(path::join(testdir, "*"));
ASSERT_SOME(allFiles);
- EXPECT_EQ(1u, allFiles.get().size());
+ EXPECT_EQ(1u, allFiles->size());
// Rename a fake file, verify failure.
const string fakeFile = testdir + "does_not_exist";
@@ -434,7 +434,7 @@ TEST_F(FsTest, Rename)
allFiles = fs::list(path::join(testdir, "*"));
ASSERT_SOME(allFiles);
- EXPECT_EQ(1u, allFiles.get().size());
+ EXPECT_EQ(1u, allFiles->size());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/tests/os/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os/process_tests.cpp b/3rdparty/stout/tests/os/process_tests.cpp
index cbae66c..add8ed6 100644
--- a/3rdparty/stout/tests/os/process_tests.cpp
+++ b/3rdparty/stout/tests/os/process_tests.cpp
@@ -78,26 +78,26 @@ TEST_F(ProcessTest, Process)
const Result<Process> process = os::process(getpid());
ASSERT_SOME(process);
- EXPECT_EQ(getpid(), process.get().pid);
- EXPECT_EQ(getppid(), process.get().parent);
- ASSERT_SOME(process.get().session);
+ EXPECT_EQ(getpid(), process->pid);
+ EXPECT_EQ(getppid(), process->parent);
+ ASSERT_SOME(process->session);
#ifndef __WINDOWS__
// NOTE: `getsid` does not have a meaningful interpretation on Windows.
- EXPECT_EQ(getsid(0), process.get().session.get());
+ EXPECT_EQ(getsid(0), process->session.get());
#endif // __WINDOWS__
- ASSERT_SOME(process.get().rss);
- EXPECT_GT(process.get().rss.get(), 0);
+ ASSERT_SOME(process->rss);
+ EXPECT_GT(process->rss.get(), 0);
// NOTE: On Linux /proc is a bit slow to update the CPU times,
// hence we allow 0 in this test.
- ASSERT_SOME(process.get().utime);
- EXPECT_GE(process.get().utime.get(), Nanoseconds(0));
- ASSERT_SOME(process.get().stime);
- EXPECT_GE(process.get().stime.get(), Nanoseconds(0));
+ ASSERT_SOME(process->utime);
+ EXPECT_GE(process->utime.get(), Nanoseconds(0));
+ ASSERT_SOME(process->stime);
+ EXPECT_GE(process->stime.get(), Nanoseconds(0));
- EXPECT_FALSE(process.get().command.empty());
+ EXPECT_FALSE(process->command.empty());
// Assert invalid PID returns `None`.
Result<Process> invalid_process = os::process(-1);
@@ -128,7 +128,7 @@ TEST_F(ProcessTest, Processes)
const Try<list<Process>> processes = os::processes();
ASSERT_SOME(processes);
- ASSERT_GT(processes.get().size(), 2u);
+ ASSERT_GT(processes->size(), 2u);
// Look for ourselves in the table.
bool found = false;
@@ -169,7 +169,7 @@ TEST_F(ProcessTest, Pids)
Try<set<pid_t>> pids = os::pids();
ASSERT_SOME(pids);
EXPECT_FALSE(pids->empty());
- EXPECT_EQ(1u, pids.get().count(getpid()));
+ EXPECT_EQ(1u, pids->count(getpid()));
// In a FreeBSD jail, pid 1 may not exist.
#ifdef __FreeBSD__
@@ -181,7 +181,7 @@ TEST_F(ProcessTest, Pids)
EXPECT_EQ(0u, pids.get().count(init_pid));
#else
// Elsewhere we always expect exactly 1 init PID.
- EXPECT_EQ(1u, pids.get().count(init_pid));
+ EXPECT_EQ(1u, pids->count(init_pid));
#endif
#ifdef __FreeBSD__
}
@@ -191,8 +191,8 @@ TEST_F(ProcessTest, Pids)
// NOTE: `getpgid` does not have a meaningful interpretation on Windows.
pids = os::pids(getpgid(0), None());
EXPECT_SOME(pids);
- EXPECT_GE(pids.get().size(), 1u);
- EXPECT_EQ(1u, pids.get().count(getpid()));
+ EXPECT_GE(pids->size(), 1u);
+ EXPECT_EQ(1u, pids->count(getpid()));
// NOTE: This test is not meaningful on Windows because process IDs are
// expected to be non-negative.
@@ -201,8 +201,8 @@ TEST_F(ProcessTest, Pids)
// NOTE: `getsid` does not have a meaningful interpretation on Windows.
pids = os::pids(None(), getsid(0));
EXPECT_SOME(pids);
- EXPECT_GE(pids.get().size(), 1u);
- EXPECT_EQ(1u, pids.get().count(getpid()));
+ EXPECT_GE(pids->size(), 1u);
+ EXPECT_EQ(1u, pids->count(getpid()));
// NOTE: This test is not meaningful on Windows because process IDs are
// expected to be non-negative.
@@ -265,20 +265,20 @@ TEST_F(ProcessTest, Pstree)
// might simply exec the command above (i.e., 'sleep 10') while
// others might fork/exec the command, keeping around a 'sh -c'
// process as well.
- ASSERT_LE(1u, tree.get().children.size());
- ASSERT_GE(2u, tree.get().children.size());
+ ASSERT_LE(1u, tree->children.size());
+ ASSERT_GE(2u, tree->children.size());
- pid_t child = tree.get().process.pid;
- pid_t grandchild = tree.get().children.front().process.pid;
+ pid_t child = tree->process.pid;
+ pid_t grandchild = tree->children.front().process.pid;
// Now check pstree again.
tree = os::pstree(child);
ASSERT_SOME(tree);
- EXPECT_EQ(child, tree.get().process.pid);
+ EXPECT_EQ(child, tree->process.pid);
- ASSERT_LE(1u, tree.get().children.size());
- ASSERT_GE(2u, tree.get().children.size());
+ ASSERT_LE(1u, tree->children.size());
+ ASSERT_GE(2u, tree->children.size());
// Cleanup by killing the descendant processes.
EXPECT_EQ(0, kill(grandchild, SIGKILL));
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/tests/os/systems_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os/systems_tests.cpp b/3rdparty/stout/tests/os/systems_tests.cpp
index 44a9221..a2a05ce 100644
--- a/3rdparty/stout/tests/os/systems_tests.cpp
+++ b/3rdparty/stout/tests/os/systems_tests.cpp
@@ -26,22 +26,22 @@ TEST_F(SystemsTests, Uname)
ASSERT_SOME(info);
#ifdef __linux__
- EXPECT_EQ(info.get().sysname, "Linux");
+ EXPECT_EQ(info->sysname, "Linux");
// Machine arch must be non-empty.
- EXPECT_FALSE(info.get().machine.empty());
+ EXPECT_FALSE(info->machine.empty());
#elif defined(__APPLE__)
- EXPECT_EQ(info.get().sysname, "Darwin");
+ EXPECT_EQ(info->sysname, "Darwin");
// Machine arch must be non-empty.
- EXPECT_FALSE(info.get().machine.empty());
+ EXPECT_FALSE(info->machine.empty());
#endif // __linux__
// The `release`, `version`, and `nodename` properties should all be
// populated with a string of at least 1 character.
- EXPECT_GT(info.get().release.size(), 0u);
- EXPECT_GT(info.get().version.size(), 0u);
- EXPECT_GT(info.get().nodename.size(), 0u);
+ EXPECT_GT(info->release.size(), 0u);
+ EXPECT_GT(info->version.size(), 0u);
+ EXPECT_GT(info->nodename.size(), 0u);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/tests/os_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os_tests.cpp b/3rdparty/stout/tests/os_tests.cpp
index 11f1720..d04c3b9 100644
--- a/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/stout/tests/os_tests.cpp
@@ -301,11 +301,11 @@ TEST_F(OsTest, Sysctl)
Try<string> release = os::sysctl(CTL_KERN, KERN_OSRELEASE).string();
- EXPECT_SOME_EQ(uname.get().release, release);
+ EXPECT_SOME_EQ(uname->release, release);
Try<string> type = os::sysctl(CTL_KERN, KERN_OSTYPE).string();
- EXPECT_SOME_EQ(uname.get().sysname, type);
+ EXPECT_SOME_EQ(uname->sysname, type);
// Integer test.
Try<int> maxproc = os::sysctl(CTL_KERN, KERN_MAXPROC).integer();
@@ -337,8 +337,8 @@ TEST_F(OsTest, Sysctl)
timeval time;
gettimeofday(&time, nullptr);
- EXPECT_GT(Seconds(bootTime.get().tv_sec), Seconds(0));
- EXPECT_LT(Seconds(bootTime.get().tv_sec), Seconds(time.tv_sec));
+ EXPECT_GT(Seconds(bootTime->tv_sec), Seconds(0));
+ EXPECT_LT(Seconds(bootTime->tv_sec), Seconds(time.tv_sec));
}
#endif // __APPLE__ || __FreeBSD__
@@ -358,18 +358,18 @@ TEST_F(OsTest, Children)
Exec(SLEEP_COMMAND(10)))();
ASSERT_SOME(tree);
- ASSERT_EQ(1u, tree.get().children.size());
+ ASSERT_EQ(1u, tree->children.size());
- pid_t child = tree.get().process.pid;
- pid_t grandchild = tree.get().children.front().process.pid;
+ pid_t child = tree->process.pid;
+ pid_t grandchild = tree->children.front().process.pid;
// Ensure the non-recursive children does not include the
// grandchild.
children = os::children(getpid(), false);
ASSERT_SOME(children);
- EXPECT_EQ(1u, children.get().size());
- EXPECT_EQ(1u, children.get().count(child));
+ EXPECT_EQ(1u, children->size());
+ EXPECT_EQ(1u, children->count(child));
children = os::children(getpid());
@@ -380,11 +380,11 @@ TEST_F(OsTest, Children)
// might simply for exec the command above (i.e., 'sleep 10') while
// others might fork/exec the command, keeping around a 'sh -c'
// process as well.
- EXPECT_LE(2u, children.get().size());
- EXPECT_GE(4u, children.get().size());
+ EXPECT_LE(2u, children->size());
+ EXPECT_GE(4u, children->size());
- EXPECT_EQ(1u, children.get().count(child));
- EXPECT_EQ(1u, children.get().count(grandchild));
+ EXPECT_EQ(1u, children->count(child));
+ EXPECT_EQ(1u, children->count(grandchild));
// Cleanup by killing the descendant processes.
EXPECT_EQ(0, kill(grandchild, SIGKILL));
@@ -433,15 +433,15 @@ TEST_F(OsTest, Killtree)
// \--- greatGreatGrandchild sleep 10
// Grab the pids from the instantiated process tree.
- ASSERT_EQ(1u, tree.get().children.size());
- ASSERT_EQ(1u, tree.get().children.front().children.size());
- ASSERT_EQ(1u, tree.get().children.front().children.front().children.size());
+ ASSERT_EQ(1u, tree->children.size());
+ ASSERT_EQ(1u, tree->children.front().children.size());
+ ASSERT_EQ(1u, tree->children.front().children.front().children.size());
pid_t child = tree.get();
- pid_t grandchild = tree.get().children.front();
- pid_t greatGrandchild = tree.get().children.front().children.front();
+ pid_t grandchild = tree->children.front();
+ pid_t greatGrandchild = tree->children.front().children.front();
pid_t greatGreatGrandchild =
- tree.get().children.front().children.front().children.front();
+ tree->children.front().children.front().children.front();
// Now wait for the grandchild to exit splitting the process tree.
Duration elapsed = Duration::zero();
@@ -450,13 +450,13 @@ TEST_F(OsTest, Killtree)
ASSERT_FALSE(process.isError());
- if (process.isNone() || process.get().zombie) {
+ if (process.isNone() || process->zombie) {
break;
}
if (elapsed > Seconds(10)) {
- FAIL() << "Granchild process '" << process.get().pid << "' "
- << "(" << process.get().command << ") did not terminate";
+ FAIL() << "Granchild process '" << process->pid << "' "
+ << "(" << process->command << ") did not terminate";
}
os::sleep(Milliseconds(5));
@@ -470,7 +470,7 @@ TEST_F(OsTest, Killtree)
ASSERT_SOME(trees);
- EXPECT_EQ(2u, trees.get().size()) << stringify(trees.get());
+ EXPECT_EQ(2u, trees->size()) << stringify(trees.get());
foreach (const ProcessTree& tree, trees.get()) {
if (tree.process.pid == child) {
@@ -502,7 +502,7 @@ TEST_F(OsTest, Killtree)
if (os::process(greatGreatGrandchild).isNone() &&
os::process(greatGrandchild).isNone() &&
os::process(grandchild).isNone() &&
- _child.get().zombie) {
+ _child->zombie) {
break;
}
@@ -519,7 +519,7 @@ TEST_F(OsTest, Killtree)
EXPECT_NONE(os::process(greatGrandchild));
EXPECT_NONE(os::process(grandchild));
EXPECT_SOME(os::process(child));
- EXPECT_TRUE(os::process(child).get().zombie);
+ EXPECT_TRUE(os::process(child)->zombie);
// We have to reap the child for running the tests in repetition.
ASSERT_EQ(child, waitpid(child, nullptr, 0));
@@ -556,12 +556,12 @@ TEST_F(OsTest, KilltreeNoRoot)
// \-+- great grandchild sleep 100
// Grab the pids from the instantiated process tree.
- ASSERT_EQ(1u, tree.get().children.size());
- ASSERT_EQ(1u, tree.get().children.front().children.size());
+ ASSERT_EQ(1u, tree->children.size());
+ ASSERT_EQ(1u, tree->children.front().children.size());
pid_t child = tree.get();
- pid_t grandchild = tree.get().children.front();
- pid_t greatGrandchild = tree.get().children.front().children.front();
+ pid_t grandchild = tree->children.front();
+ pid_t greatGrandchild = tree->children.front().children.front();
// Wait for the child to exit.
Duration elapsed = Duration::zero();
@@ -569,7 +569,7 @@ TEST_F(OsTest, KilltreeNoRoot)
Result<os::Process> process = os::process(child);
ASSERT_FALSE(process.isError());
- if (process.get().zombie) {
+ if (process->zombie) {
break;
}
@@ -583,7 +583,7 @@ TEST_F(OsTest, KilltreeNoRoot)
// Ensure we reap our child now.
EXPECT_SOME(os::process(child));
- EXPECT_TRUE(os::process(child).get().zombie);
+ EXPECT_TRUE(os::process(child)->zombie);
ASSERT_EQ(child, waitpid(child, nullptr, 0));
// Check the grandchild and great grandchild are still running.
@@ -597,8 +597,8 @@ TEST_F(OsTest, KilltreeNoRoot)
// meaning we can't just check that the parent pid == 1.
Result<os::Process> _grandchild = os::process(grandchild);
ASSERT_SOME(_grandchild);
- ASSERT_NE(child, _grandchild.get().parent);
- ASSERT_FALSE(_grandchild.get().zombie);
+ ASSERT_NE(child, _grandchild->parent);
+ ASSERT_FALSE(_grandchild->zombie);
// Check to see if we're in a jail on FreeBSD in case we've been
// reparented to pid 1
@@ -606,9 +606,9 @@ TEST_F(OsTest, KilltreeNoRoot)
if (!isJailed()) {
#endif
// Check that grandchild's parent is also not a zombie.
- Result<os::Process> currentParent = os::process(_grandchild.get().parent);
+ Result<os::Process> currentParent = os::process(_grandchild->parent);
ASSERT_SOME(currentParent);
- ASSERT_FALSE(currentParent.get().zombie);
+ ASSERT_FALSE(currentParent->zombie);
#ifdef __FreeBSD__
}
#endif
@@ -620,7 +620,7 @@ TEST_F(OsTest, KilltreeNoRoot)
Try<list<ProcessTree>> trees = os::killtree(child, SIGKILL, true, true);
ASSERT_SOME(trees);
- EXPECT_FALSE(trees.get().empty());
+ EXPECT_FALSE(trees->empty());
// All processes should be reparented and reaped by init.
elapsed = Duration::zero();
@@ -679,7 +679,7 @@ TEST_F(OsTest, ProcessExists)
Result<os::Process> process = os::process(pid);
ASSERT_SOME(process);
- if (process.get().zombie) {
+ if (process->zombie) {
break;
}
@@ -742,7 +742,7 @@ TEST_F(OsTest, User)
strings::split(strings::trim(gids_.get(), strings::ANY, "\n"), " ");
ASSERT_SOME(tokens);
- std::sort(tokens.get().begin(), tokens.get().end());
+ std::sort(tokens->begin(), tokens->end());
Try<vector<gid_t>> gids = os::getgrouplist(user.get());
EXPECT_SOME(gids);
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/tests/proc_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/proc_tests.cpp b/3rdparty/stout/tests/proc_tests.cpp
index b0e3720..cc698b4 100644
--- a/3rdparty/stout/tests/proc_tests.cpp
+++ b/3rdparty/stout/tests/proc_tests.cpp
@@ -44,8 +44,8 @@ TEST(ProcTest, Pids)
ASSERT_SOME(pids);
EXPECT_FALSE(pids->empty());
- EXPECT_EQ(1u, pids.get().count(getpid()));
- EXPECT_EQ(1u, pids.get().count(1));
+ EXPECT_EQ(1u, pids->count(getpid()));
+ EXPECT_EQ(1u, pids->count(1));
}
@@ -54,7 +54,7 @@ TEST(ProcTest, Cpus)
Try<std::list<CPU>> cpus = proc::cpus();
ASSERT_SOME(cpus);
- EXPECT_LE(1u, cpus.get().size());
+ EXPECT_LE(1u, cpus->size());
}
@@ -63,7 +63,7 @@ TEST(ProcTest, SystemStatus)
Try<SystemStatus> status = proc::status();
ASSERT_SOME(status);
- EXPECT_NE(0u, status.get().btime);
+ EXPECT_NE(0u, status->btime);
}
@@ -72,8 +72,8 @@ TEST(ProcTest, ProcessStatus)
Result<ProcessStatus> status = proc::status(getpid());
ASSERT_SOME(status);
- EXPECT_EQ(getpid(), status.get().pid);
- EXPECT_EQ(getppid(), status.get().ppid);
+ EXPECT_EQ(getpid(), status->pid);
+ EXPECT_EQ(getppid(), status->ppid);
}
@@ -84,8 +84,8 @@ TEST(ProcTest, SingleThread)
Try<set<pid_t>> threads = proc::threads(::getpid());
ASSERT_SOME(threads);
- EXPECT_EQ(1u, threads.get().size());
- EXPECT_EQ(1u, threads.get().count(::getpid()));
+ EXPECT_EQ(1u, threads->size());
+ EXPECT_EQ(1u, threads->count(::getpid()));
}
@@ -116,8 +116,8 @@ TEST(ProcTest, MultipleThreads)
Try<set<pid_t>> threads = proc::threads(::getpid());
ASSERT_SOME(threads);
- EXPECT_EQ(1u + numThreads, threads.get().size());
- EXPECT_EQ(1u, threads.get().count(::getpid()));
+ EXPECT_EQ(1u + numThreads, threads->size());
+ EXPECT_EQ(1u, threads->count(::getpid()));
// Terminate the additional threads.
synchronized (mutex) {
@@ -140,7 +140,7 @@ TEST(ProcTest, MultipleThreads)
threads = proc::threads(::getpid());
ASSERT_SOME(threads);
- if (threads.get().size() == 1) {
+ if (threads->size() == 1) {
break;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/e65fa462/3rdparty/stout/tests/some_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/some_tests.cpp b/3rdparty/stout/tests/some_tests.cpp
index 6858735..7ecc1da 100644
--- a/3rdparty/stout/tests/some_tests.cpp
+++ b/3rdparty/stout/tests/some_tests.cpp
@@ -37,7 +37,7 @@ TEST(SomeTest, Some)
Try<Option<int>> t1 = Some(42);
ASSERT_SOME(t1);
EXPECT_SOME(t1.get());
- EXPECT_EQ(42, t1.get().get());
+ EXPECT_EQ(42, t1->get());
t1 = None();
ASSERT_SOME(t1);
EXPECT_NONE(t1.get());
@@ -45,27 +45,27 @@ TEST(SomeTest, Some)
Try<Result<int>> t2 = Some(42);
ASSERT_SOME(t2);
EXPECT_SOME(t2.get());
- EXPECT_EQ(42, t2.get().get());
+ EXPECT_EQ(42, t2->get());
Option<Result<int>> o2 = Some(42);
ASSERT_SOME(o2);
EXPECT_SOME(o2.get());
- EXPECT_EQ(42, o2.get().get());
+ EXPECT_EQ(42, o2->get());
Option<Result<int>> o3 = Some(Some(42));
ASSERT_SOME(o3);
EXPECT_SOME(o3.get());
- EXPECT_EQ(42, o3.get().get());
+ EXPECT_EQ(42, o3->get());
Result<Option<int>> r2 = Some(42);
ASSERT_SOME(r2);
EXPECT_SOME(r2.get());
- EXPECT_EQ(42, r2.get().get());
+ EXPECT_EQ(42, r2->get());
Result<Option<int>> r3 = Some(Some(42));
ASSERT_SOME(r3);
EXPECT_SOME(r3.get());
- EXPECT_EQ(42, r3.get().get());
+ EXPECT_EQ(42, r3->get());
Option<string> o4 = Some("hello");
EXPECT_SOME(o4);
[2/4] mesos git commit: Removed some redundant `get` calls.
Posted by bb...@apache.org.
Removed some redundant `get` calls.
Review: https://reviews.apache.org/r/65162/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/49c642e9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/49c642e9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/49c642e9
Branch: refs/heads/master
Commit: 49c642e98a7dac911a7d21aea1c429e979def0ab
Parents: 0d96c61
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Feb 21 14:25:01 2018 +0100
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Wed Feb 21 14:26:56 2018 +0100
----------------------------------------------------------------------
src/appc/spec.cpp | 2 +-
src/authentication/cram_md5/auxprop.cpp | 2 +-
src/cli/execute.cpp | 4 +-
src/common/command_utils.cpp | 6 +-
src/common/http.cpp | 2 +-
src/common/parse.hpp | 2 +-
src/common/protobuf_utils.cpp | 10 +--
src/common/recordio.hpp | 4 +-
src/credentials/credentials.hpp | 8 +-
src/docker/docker.cpp | 55 +++++++-------
src/docker/spec.cpp | 24 +++---
src/executor/executor.cpp | 2 +-
src/files/files.cpp | 6 +-
src/hook/manager.cpp | 8 +-
src/internal/evolve.cpp | 12 +--
src/launcher/executor.cpp | 4 +-
src/launcher/fetcher.cpp | 31 ++++----
src/linux/cgroups.cpp | 31 ++++----
src/linux/fs.cpp | 16 ++--
src/linux/ns.cpp | 2 +-
src/local/local.cpp | 2 +-
src/log/catchup.cpp | 4 +-
src/log/consensus.cpp | 3 +-
src/log/replica.cpp | 10 +--
src/log/tool/benchmark.cpp | 6 +-
src/log/tool/initialize.cpp | 4 +-
src/log/tool/read.cpp | 6 +-
src/master/allocator/mesos/hierarchical.cpp | 6 +-
src/master/contender/contender.cpp | 2 +-
src/master/contender/zookeeper.cpp | 2 +-
src/master/detector/detector.cpp | 2 +-
src/master/detector/zookeeper.cpp | 18 ++---
src/master/http.cpp | 26 +++----
src/master/main.cpp | 8 +-
src/master/master.cpp | 73 +++++++++---------
src/master/master.hpp | 10 +--
src/master/quota_handler.cpp | 2 +-
src/master/registrar.cpp | 4 +-
src/master/validation.cpp | 34 ++++-----
src/master/weights_handler.cpp | 2 +-
src/resource_provider/http_connection.hpp | 4 +-
src/resource_provider/registrar.cpp | 2 +-
src/sched/sched.cpp | 80 ++++++++++----------
src/scheduler/scheduler.cpp | 4 +-
src/slave/container_loggers/lib_logrotate.cpp | 6 +-
src/slave/containerizer/containerizer.cpp | 2 +-
src/slave/containerizer/docker.cpp | 50 ++++++------
src/slave/containerizer/fetcher.cpp | 17 +++--
src/slave/containerizer/mesos/containerizer.cpp | 28 +++----
.../containerizer/mesos/io/switchboard.cpp | 6 +-
.../mesos/isolators/cgroups/subsystems/cpu.cpp | 6 +-
.../isolators/cgroups/subsystems/cpuacct.cpp | 8 +-
.../isolators/cgroups/subsystems/memory.cpp | 14 ++--
.../mesos/isolators/network/cni/cni.cpp | 8 +-
.../mesos/isolators/posix/disk.cpp | 14 ++--
.../mesos/isolators/volume/image.cpp | 2 +-
src/slave/containerizer/mesos/launcher.cpp | 6 +-
.../containerizer/mesos/linux_launcher.cpp | 4 +-
.../mesos/provisioner/appc/cache.cpp | 4 +-
.../mesos/provisioner/backends/bind.cpp | 2 +-
.../mesos/provisioner/backends/copy.cpp | 2 +-
.../provisioner/docker/metadata_manager.cpp | 2 +-
.../mesos/provisioner/docker/store.cpp | 2 +-
src/slave/main.cpp | 2 +-
src/slave/qos_controllers/load.cpp | 8 +-
src/slave/slave.cpp | 2 +-
src/slave/validation.cpp | 4 +-
src/state/in_memory.cpp | 5 +-
src/state/leveldb.cpp | 8 +-
src/state/log.cpp | 31 ++++----
src/state/zookeeper.cpp | 4 +-
src/tests/api_tests.cpp | 42 +++++-----
src/tests/cluster.cpp | 2 +-
src/tests/containerizer/cni_isolator_tests.cpp | 14 ++--
.../docker_containerizer_tests.cpp | 10 +--
.../environment_secret_isolator_tests.cpp | 6 +-
src/tests/default_executor_tests.cpp | 16 ++--
src/tests/environment.cpp | 2 +-
src/tests/health_check_tests.cpp | 20 ++---
src/tests/master_maintenance_tests.cpp | 8 +-
src/tests/master_tests.cpp | 4 +-
src/tests/mesos.hpp | 9 +--
src/tests/scheduler_http_api_tests.cpp | 6 +-
src/tests/slave_authorization_tests.cpp | 7 +-
src/tests/slave_tests.cpp | 3 +-
src/uri/fetchers/copy.cpp | 6 +-
src/uri/fetchers/curl.cpp | 6 +-
src/uri/fetchers/docker.cpp | 12 +--
src/usage/usage.cpp | 8 +-
src/watcher/whitelist_watcher.cpp | 10 +--
src/zookeeper/contender.cpp | 8 +-
91 files changed, 485 insertions(+), 506 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/appc/spec.cpp
----------------------------------------------------------------------
diff --git a/src/appc/spec.cpp b/src/appc/spec.cpp
index fc5e24e..8213d41 100644
--- a/src/appc/spec.cpp
+++ b/src/appc/spec.cpp
@@ -43,7 +43,7 @@ Try<ImageManifest> parse(const string& value)
Option<Error> error = validateManifest(manifest.get());
if (error.isSome()) {
- return Error("Schema validation failed: " + error.get().message);
+ return Error("Schema validation failed: " + error->message);
}
return manifest.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/authentication/cram_md5/auxprop.cpp
----------------------------------------------------------------------
diff --git a/src/authentication/cram_md5/auxprop.cpp b/src/authentication/cram_md5/auxprop.cpp
index 8a20d5b..b072db2 100644
--- a/src/authentication/cram_md5/auxprop.cpp
+++ b/src/authentication/cram_md5/auxprop.cpp
@@ -183,7 +183,7 @@ int InMemoryAuxiliaryPropertyPlugin::initialize(
Option<list<string>> values = lookup(user, name);
if (values.isSome()) {
- if (values.get().empty()) {
+ if (values->empty()) {
// Add the 'nullptr' value to indicate there were no values.
utils->prop_set(sparams->propctx, property->name, nullptr, 0);
} else {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index 729896a..221d65f 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -499,7 +499,7 @@ protected:
<< "Either task or task group should be set but not both";
if (task.isSome()) {
- requiredResources = Resources(task.get().resources());
+ requiredResources = Resources(task->resources());
} else {
foreach (const TaskInfo& _task, taskGroup->tasks()) {
requiredResources += Resources(_task.resources());
@@ -602,7 +602,7 @@ protected:
mesos->send(call);
if (task.isSome()) {
- cout << "Submitted task '" << task.get().name() << "' to agent '"
+ cout << "Submitted task '" << task->name() << "' to agent '"
<< offer.agent_id() << "'" << endl;
} else {
vector<TaskID> taskIds;
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/common/command_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/command_utils.cpp b/src/common/command_utils.cpp
index c50be76..7dfcc9f 100644
--- a/src/common/command_utils.cpp
+++ b/src/common/command_utils.cpp
@@ -63,9 +63,9 @@ static Future<string> launch(
}
return await(
- s.get().status(),
- process::io::read(s.get().out().get()),
- process::io::read(s.get().err().get()))
+ s->status(),
+ process::io::read(s->out().get()),
+ process::io::read(s->err().get()))
.then([command](const tuple<
Future<Option<int>>,
Future<string>,
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/common/http.cpp
----------------------------------------------------------------------
diff --git a/src/common/http.cpp b/src/common/http.cpp
index 728fc55..8d3a4ad 100644
--- a/src/common/http.cpp
+++ b/src/common/http.cpp
@@ -154,7 +154,7 @@ static JSON::Value value(
{
switch (type) {
case Value::SCALAR:
- return resources.get<Value::Scalar>(name).get().value();
+ return resources.get<Value::Scalar>(name)->value();
case Value::RANGES:
return stringify(resources.get<Value::Ranges>(name).get());
case Value::SET:
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/common/parse.hpp
----------------------------------------------------------------------
diff --git a/src/common/parse.hpp b/src/common/parse.hpp
index 212d640..03814e3 100644
--- a/src/common/parse.hpp
+++ b/src/common/parse.hpp
@@ -117,7 +117,7 @@ inline Try<hashmap<std::string, std::string>> parse(const std::string& value)
hashmap<std::string, std::string> map;
foreachpair (const std::string& key,
const JSON::Value& value,
- json.get().values) {
+ json->values) {
if (!value.is<JSON::String>()) {
return Error(
"The value of key '" + key + "' in '" + stringify(json.get()) + "'"
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/common/protobuf_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp
index b5c2997..f516091 100644
--- a/src/common/protobuf_utils.cpp
+++ b/src/common/protobuf_utils.cpp
@@ -146,8 +146,8 @@ StatusUpdate createStatusUpdate(
status->set_timestamp(update.timestamp());
if (uuid.isSome()) {
- update.set_uuid(uuid.get().toBytes());
- status->set_uuid(uuid.get().toBytes());
+ update.set_uuid(uuid->toBytes());
+ status->set_uuid(uuid->toBytes());
}
if (reason.isSome()) {
@@ -520,7 +520,7 @@ MasterInfo createMasterInfo(const UPID& pid)
// be fixed. See MESOS-1201 for more details.
// TODO(marco): `ip` and `port` are deprecated in favor of `address`;
// remove them both after the deprecation cycle.
- info.set_ip(pid.address.ip.in().get().s_addr);
+ info.set_ip(pid.address.ip.in()->s_addr);
info.set_port(pid.address.port);
info.mutable_address()->set_ip(stringify(pid.address.ip));
@@ -1073,7 +1073,7 @@ Unavailability createUnavailability(
unavailability.mutable_start()->set_nanoseconds(start.duration().ns());
if (duration.isSome()) {
- unavailability.mutable_duration()->set_nanoseconds(duration.get().ns());
+ unavailability.mutable_duration()->set_nanoseconds(duration->ns());
}
return unavailability;
@@ -1241,7 +1241,7 @@ mesos::master::Response::GetAgents::Agent createAgentResponse(
if (slave.reregisteredTime.isSome()) {
agent.mutable_reregistered_time()->set_nanoseconds(
- slave.reregisteredTime.get().duration().ns());
+ slave.reregisteredTime->duration().ns());
}
agent.mutable_agent_info()->clear_resources();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/common/recordio.hpp
----------------------------------------------------------------------
diff --git a/src/common/recordio.hpp b/src/common/recordio.hpp
index c58bb14..88e789c 100644
--- a/src/common/recordio.hpp
+++ b/src/common/recordio.hpp
@@ -167,7 +167,7 @@ public:
}
if (error.isSome()) {
- return process::Failure(error.get().message);
+ return process::Failure(error->message);
}
if (done) {
@@ -230,7 +230,7 @@ private:
}
// Have we reached EOF?
- if (read.get().empty()) {
+ if (read->empty()) {
complete();
return;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/credentials/credentials.hpp
----------------------------------------------------------------------
diff --git a/src/credentials/credentials.hpp b/src/credentials/credentials.hpp
index c790793..6e9f4aa 100644
--- a/src/credentials/credentials.hpp
+++ b/src/credentials/credentials.hpp
@@ -40,7 +40,7 @@ inline Result<Credentials> read(const Path& path)
if (read.isError()) {
return Error("Failed to read credentials file '" + path.string() +
"': " + read.error());
- } else if (read.get().empty()) {
+ } else if (read->empty()) {
return None();
}
@@ -48,7 +48,7 @@ inline Result<Credentials> read(const Path& path)
if (permissions.isError()) {
LOG(WARNING) << "Failed to stat credentials file '" << path
<< "': " << permissions.error();
- } else if (permissions.get().others.rwx) {
+ } else if (permissions->others.rwx) {
LOG(WARNING) << "Permissions on credentials file '" << path
<< "' are too open; it is recommended that your"
<< " credentials file is NOT accessible by others";
@@ -89,7 +89,7 @@ inline Result<Credential> readCredential(const Path& path)
if (read.isError()) {
return Error("Failed to read credential file '" + path.string() +
"': " + read.error());
- } else if (read.get().empty()) {
+ } else if (read->empty()) {
return None();
}
@@ -97,7 +97,7 @@ inline Result<Credential> readCredential(const Path& path)
if (permissions.isError()) {
LOG(WARNING) << "Failed to stat credential file '" << path
<< "': " << permissions.error();
- } else if (permissions.get().others.rwx) {
+ } else if (permissions->others.rwx) {
LOG(WARNING) << "Permissions on credential file '" << path
<< "' are too open; it is recommended that your"
<< " credential file is NOT accessible by others";
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index 3df370e..62349ab 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -167,7 +167,7 @@ Future<Version> Docker::version() const
return Failure("Failed to create subprocess '" + cmd + "': " + s.error());
}
- return s.get().status()
+ return s->status()
.then(lambda::bind(&Docker::_version, cmd, s.get()));
}
@@ -276,7 +276,7 @@ Try<Docker::Container> Docker::Container::create(const string& output)
return Error("Error finding Id in container: " + idValue.error());
}
- string id = idValue.get().value;
+ string id = idValue->value;
Result<JSON::String> nameValue = json.find<JSON::String>("Name");
if (nameValue.isNone()) {
@@ -285,7 +285,7 @@ Try<Docker::Container> Docker::Container::create(const string& output)
return Error("Error finding Name in container: " + nameValue.error());
}
- string name = nameValue.get().value;
+ string name = nameValue->value;
Result<JSON::Object> stateValue = json.find<JSON::Object>("State");
if (stateValue.isNone()) {
@@ -294,14 +294,14 @@ Try<Docker::Container> Docker::Container::create(const string& output)
return Error("Error finding State in container: " + stateValue.error());
}
- Result<JSON::Number> pidValue = stateValue.get().find<JSON::Number>("Pid");
+ Result<JSON::Number> pidValue = stateValue->find<JSON::Number>("Pid");
if (pidValue.isNone()) {
return Error("Unable to find Pid in State");
} else if (pidValue.isError()) {
return Error("Error finding Pid in State: " + pidValue.error());
}
- pid_t pid = pid_t(pidValue.get().as<int64_t>());
+ pid_t pid = pid_t(pidValue->as<int64_t>());
Option<pid_t> optionalPid;
if (pid != 0) {
@@ -309,14 +309,14 @@ Try<Docker::Container> Docker::Container::create(const string& output)
}
Result<JSON::String> startedAtValue =
- stateValue.get().find<JSON::String>("StartedAt");
+ stateValue->find<JSON::String>("StartedAt");
if (startedAtValue.isNone()) {
return Error("Unable to find StartedAt in State");
} else if (startedAtValue.isError()) {
return Error("Error finding StartedAt in State: " + startedAtValue.error());
}
- bool started = startedAtValue.get().value != "0001-01-01T00:00:00Z";
+ bool started = startedAtValue->value != "0001-01-01T00:00:00Z";
Option<string> ipAddress;
Option<string> ip6Address;
@@ -520,13 +520,12 @@ Try<Docker::Image> Docker::Image::create(const JSON::Object& json)
Option<vector<string>> entrypointOption = None();
- if (!entrypoint.get().is<JSON::Null>()) {
- if (!entrypoint.get().is<JSON::Array>()) {
+ if (!entrypoint->is<JSON::Null>()) {
+ if (!entrypoint->is<JSON::Array>()) {
return Error("Unexpected type found for 'ContainerConfig.Entrypoint'");
}
- const vector<JSON::Value>& values =
- entrypoint.get().as<JSON::Array>().values;
+ const vector<JSON::Value>& values = entrypoint->as<JSON::Array>().values;
if (values.size() != 0) {
vector<string> result;
@@ -553,12 +552,12 @@ Try<Docker::Image> Docker::Image::create(const JSON::Object& json)
Option<map<string, string>> envOption = None();
- if (!env.get().is<JSON::Null>()) {
- if (!env.get().is<JSON::Array>()) {
+ if (!env->is<JSON::Null>()) {
+ if (!env->is<JSON::Array>()) {
return Error("Unexpected type found for 'ContainerConfig.Env'");
}
- const vector<JSON::Value>& values = env.get().as<JSON::Array>().values;
+ const vector<JSON::Value>& values = env->as<JSON::Array>().values;
if (values.size() != 0) {
map<string, string> result;
@@ -613,7 +612,7 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
if (resources.isSome()) {
// TODO(yifan): Support other resources (e.g. disk).
- Option<double> cpus = resources.get().cpus();
+ Option<double> cpus = resources->cpus();
if (cpus.isSome()) {
options.cpuShares =
std::max((uint64_t) (CPU_SHARES_PER_CPU * cpus.get()), MIN_CPU_SHARES);
@@ -626,7 +625,7 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
}
}
- Option<Bytes> mem = resources.get().mem();
+ Option<Bytes> mem = resources->mem();
if (mem.isSome()) {
options.memory = std::max(mem.get(), MIN_MEMORY);
}
@@ -641,7 +640,7 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
foreach (const Environment::Variable& variable,
commandInfo.environment().variables()) {
if (env.isSome() &&
- env.get().find(variable.name()) != env.get().end()) {
+ env->find(variable.name()) != env->end()) {
// Skip to avoid duplicate environment variables.
continue;
}
@@ -814,7 +813,7 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
return Error("Port mappings require resources");
}
- Option<Value::Ranges> portRanges = resources.get().ports();
+ Option<Value::Ranges> portRanges = resources->ports();
if (!portRanges.isSome()) {
return Error("Port mappings require port resources");
@@ -823,7 +822,7 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
foreach (const ContainerInfo::DockerInfo::PortMapping& mapping,
dockerInfo.port_mappings()) {
bool found = false;
- foreach (const Value::Range& range, portRanges.get().range()) {
+ foreach (const Value::Range& range, portRanges->range()) {
if (mapping.host_port() >= range.begin() &&
mapping.host_port() <= range.end()) {
found = true;
@@ -1186,7 +1185,7 @@ Future<Nothing> Docker::stop(
return Failure("Failed to create subprocess '" + cmd + "': " + s.error());
}
- return s.get().status()
+ return s->status()
.then(lambda::bind(
&Docker::_stop,
*this,
@@ -1308,9 +1307,9 @@ void Docker::_inspect(
// Start reading from stdout so writing to the pipe won't block
// to handle cases where the output is larger than the pipe
// capacity.
- const Future<string> output = io::read(s.get().out().get());
+ const Future<string> output = io::read(s->out().get());
- s.get().status()
+ s->status()
.onAny([=]() { __inspect(cmd, promise, retryInterval, output, s.get()); });
}
@@ -1393,7 +1392,7 @@ void Docker::___inspect(
return;
}
- if (retryInterval.isSome() && !container.get().started) {
+ if (retryInterval.isSome() && !container->started) {
VLOG(1) << "Retrying inspect since container not yet started. cmd: '"
<< cmd << "', interval: " << stringify(retryInterval.get());
Clock::timer(retryInterval.get(),
@@ -1426,9 +1425,9 @@ Future<list<Docker::Container>> Docker::ps(
// Start reading from stdout so writing to the pipe won't block
// to handle cases where the output is larger than the pipe
// capacity.
- const Future<string>& output = io::read(s.get().out().get());
+ const Future<string>& output = io::read(s->out().get());
- return s.get().status()
+ return s->status()
.then(lambda::bind(&Docker::_ps, *this, cmd, s.get(), prefix, output));
}
@@ -1597,11 +1596,11 @@ Future<Docker::Image> Docker::pull(
// Start reading from stdout so writing to the pipe won't block
// to handle cases where the output is larger than the pipe
// capacity.
- const Future<string> output = io::read(s.get().out().get());
+ const Future<string> output = io::read(s->out().get());
// We assume docker inspect to exit quickly and do not need to be
// discarded.
- return s.get().status()
+ return s->status()
.then(lambda::bind(
&Docker::_pull,
*this,
@@ -1734,7 +1733,7 @@ Future<Docker::Image> Docker::__pull(
// Docker pull can run for a long time due to large images, so
// we allow the future to be discarded and it will kill the pull
// process.
- return s_.get().status()
+ return s_->status()
.then(lambda::bind(
&Docker::___pull,
docker,
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/docker/spec.cpp
----------------------------------------------------------------------
diff --git a/src/docker/spec.cpp b/src/docker/spec.cpp
index 538cf18..15224f9 100644
--- a/src/docker/spec.cpp
+++ b/src/docker/spec.cpp
@@ -253,8 +253,8 @@ Try<ImageManifest> parse(const JSON::Object& json)
"Failed to parse 'Labels' as a JSON value: " + value.error());
}
- if (value.isSome() && !value.get().is<JSON::Null>()) {
- const JSON::Object labels = value.get().as<JSON::Object>();
+ if (value.isSome() && !value->is<JSON::Null>()) {
+ const JSON::Object labels = value->as<JSON::Object>();
foreachpair (const string& key,
const JSON::Value& value,
@@ -288,8 +288,8 @@ Try<ImageManifest> parse(const JSON::Object& json)
"Failed to parse 'Labels' as a JSON value: " + value.error());
}
- if (value.isSome() && !value.get().is<JSON::Null>()) {
- const JSON::Object labels = value.get().as<JSON::Object>();
+ if (value.isSome() && !value->is<JSON::Null>()) {
+ const JSON::Object labels = value->as<JSON::Object>();
foreachpair (const string& key,
const JSON::Value& value,
@@ -308,8 +308,8 @@ Try<ImageManifest> parse(const JSON::Object& json)
Option<Error> error = validate(manifest.get());
if (error.isSome()) {
- return Error("Docker v1 image manifest validation failed: " +
- error.get().message);
+ return Error(
+ "Docker v1 image manifest validation failed: " + error->message);
}
return manifest.get();
@@ -368,9 +368,9 @@ Try<ImageManifest> parse(const JSON::Object& json)
return Error("Protobuf parse failed: " + manifest.error());
}
- for (int i = 0; i < manifest.get().history_size(); i++) {
- Try<JSON::Object> v1Compatibility = JSON::parse<JSON::Object>(
- manifest.get().history(i).v1compatibility());
+ for (int i = 0; i < manifest->history_size(); i++) {
+ Try<JSON::Object> v1Compatibility =
+ JSON::parse<JSON::Object>(manifest->history(i).v1compatibility());
if (v1Compatibility.isError()) {
return Error("Parsing v1Compatibility JSON failed: " +
@@ -382,15 +382,15 @@ Try<ImageManifest> parse(const JSON::Object& json)
return Error("Parsing v1Compatibility protobuf failed: " + v1.error());
}
- CHECK(!manifest.get().history(i).has_v1());
+ CHECK(!manifest->history(i).has_v1());
manifest->mutable_history(i)->mutable_v1()->CopyFrom(v1.get());
}
Option<Error> error = validate(manifest.get());
if (error.isSome()) {
- return Error("Docker v2 image manifest validation failed: " +
- error.get().message);
+ return Error(
+ "Docker v2 image manifest validation failed: " + error->message);
}
return manifest.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/executor/executor.cpp
----------------------------------------------------------------------
diff --git a/src/executor/executor.cpp b/src/executor/executor.cpp
index 9459368..5e95f99 100644
--- a/src/executor/executor.cpp
+++ b/src/executor/executor.cpp
@@ -710,7 +710,7 @@ protected:
return;
}
- receive(event.get().get(), false);
+ receive(event->get(), false);
read();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/files/files.cpp
----------------------------------------------------------------------
diff --git a/src/files/files.cpp b/src/files/files.cpp
index 324b4bc..5f92d2a 100644
--- a/src/files/files.cpp
+++ b/src/files/files.cpp
@@ -406,7 +406,7 @@ Future<http::Response> FilesProcess::_browse(
{
Option<string> path = request.url.query.get("path");
- if (!path.isSome() || path.get().empty()) {
+ if (!path.isSome() || path->empty()) {
return BadRequest("Expecting 'path=value' in query.\n");
}
@@ -527,7 +527,7 @@ Future<http::Response> FilesProcess::__read(
{
Option<string> path = request.url.query.get("path");
- if (!path.isSome() || path.get().empty()) {
+ if (!path.isSome() || path->empty()) {
return BadRequest("Expecting 'path=value' in query.\n");
}
@@ -762,7 +762,7 @@ Future<http::Response> FilesProcess::download(
{
Option<string> path = request.url.query.get("path");
- if (!path.isSome() || path.get().empty()) {
+ if (!path.isSome() || path->empty()) {
return BadRequest("Expecting 'path=value' in query.\n");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/hook/manager.cpp
----------------------------------------------------------------------
diff --git a/src/hook/manager.cpp b/src/hook/manager.cpp
index c659de5..44c0c32 100644
--- a/src/hook/manager.cpp
+++ b/src/hook/manager.cpp
@@ -287,13 +287,13 @@ TaskStatus HookManager::slaveTaskStatusDecorator(
// NOTE: Labels/ContainerStatus remain unchanged if the hook returns
// None().
if (result.isSome()) {
- if (result.get().has_labels()) {
- status.mutable_labels()->CopyFrom(result.get().labels());
+ if (result->has_labels()) {
+ status.mutable_labels()->CopyFrom(result->labels());
}
- if (result.get().has_container_status()) {
+ if (result->has_container_status()) {
status.mutable_container_status()->CopyFrom(
- result.get().container_status());
+ result->container_status());
}
} else if (result.isError()) {
LOG(WARNING) << "Agent TaskStatus decorator hook failed for "
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/internal/evolve.cpp
----------------------------------------------------------------------
diff --git a/src/internal/evolve.cpp b/src/internal/evolve.cpp
index 7758c9b..3ad5ebc 100644
--- a/src/internal/evolve.cpp
+++ b/src/internal/evolve.cpp
@@ -585,7 +585,7 @@ v1::master::Response evolve<v1::master::Response::GET_FLAGS>(
foreachpair (const string& key,
const JSON::Value& value,
- flags.get().values) {
+ flags->values) {
v1::Flag* flag = getFlags->add_flags();
flag->set_name(key);
@@ -614,7 +614,7 @@ v1::agent::Response evolve<v1::agent::Response::GET_FLAGS>(
foreachpair (const string& key,
const JSON::Value& value,
- flags.get().values) {
+ flags->values) {
v1::Flag* flag = getFlags->add_flags();
flag->set_name(key);
@@ -680,21 +680,21 @@ v1::agent::Response evolve<v1::agent::Response::GET_CONTAINERS>(
object.find<JSON::String>("container_id");
CHECK_SOME(container_id);
- container->mutable_container_id()->set_value(container_id.get().value);
+ container->mutable_container_id()->set_value(container_id->value);
Result<JSON::String> framework_id =
object.find<JSON::String>("framework_id");
CHECK(!framework_id.isError());
if (framework_id.isSome()) {
- container->mutable_framework_id()->set_value(framework_id.get().value);
+ container->mutable_framework_id()->set_value(framework_id->value);
}
Result<JSON::String> executor_id = object.find<JSON::String>("executor_id");
CHECK(!executor_id.isError());
if (executor_id.isSome()) {
- container->mutable_executor_id()->set_value(executor_id.get().value);
+ container->mutable_executor_id()->set_value(executor_id->value);
}
Result<JSON::String> executor_name =
@@ -702,7 +702,7 @@ v1::agent::Response evolve<v1::agent::Response::GET_CONTAINERS>(
CHECK(!executor_name.isError());
if (executor_name.isSome()) {
- container->set_executor_name(executor_name.get().value);
+ container->set_executor_name(executor_name->value);
}
Result<JSON::Object> container_status = object.find<JSON::Object>("status");
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index e4b9785..caa2cfc 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -917,11 +917,11 @@ private:
message =
"Failed to get exit status for Command: " +
(status_.isFailed() ? status_.failure() : "future discarded");
- } else if (status_.get().isNone()) {
+ } else if (status_->isNone()) {
taskState = TASK_FAILED;
message = "Failed to get exit status for Command";
} else {
- int status = status_.get().get();
+ int status = status_->get();
CHECK(WIFEXITED(status) || WIFSIGNALED(status))
<< "Unexpected wait status " << status;
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/launcher/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/fetcher.cpp b/src/launcher/fetcher.cpp
index 7fc69fe..2f42fa2 100644
--- a/src/launcher/fetcher.cpp
+++ b/src/launcher/fetcher.cpp
@@ -408,7 +408,7 @@ static Try<string> fetchThroughCache(
const string& sandboxDirectory,
const Option<string>& frameworksHome)
{
- if (cacheDirectory.isNone() || cacheDirectory.get().empty()) {
+ if (cacheDirectory.isNone() || cacheDirectory->empty()) {
return Error("Cache directory not specified");
}
@@ -559,10 +559,10 @@ int main(int argc, char* argv[])
CHECK_SOME(fetcherInfo)
<< "Failed to parse FetcherInfo: " << fetcherInfo.error();
- CHECK(!fetcherInfo.get().sandbox_directory().empty())
+ CHECK(!fetcherInfo->sandbox_directory().empty())
<< "Missing sandbox directory";
- const string sandboxDirectory = fetcherInfo.get().sandbox_directory();
+ const string sandboxDirectory = fetcherInfo->sandbox_directory();
Try<Nothing> result = createCacheDirectory(fetcherInfo.get());
if (result.isError()) {
@@ -572,30 +572,29 @@ int main(int argc, char* argv[])
// If the `FetcherInfo` specifies a user, use `os::su()` to fetch files as the
// task's user to ensure that filesystem permissions are enforced.
- if (fetcherInfo.get().has_user()) {
- // TODO(coffler): No support for os::su on Windows, see MESOS-8063
+ if (fetcherInfo->has_user()) {
+ // TODO(coffler): No support for os::su on Windows, see MESOS-8063
#ifndef __WINDOWS__
- result = os::su(fetcherInfo.get().user());
+ result = os::su(fetcherInfo->user());
if (result.isError()) {
- EXIT(EXIT_FAILURE)
- << "Fetcher could not execute `os::su()` for user '"
- << fetcherInfo.get().user() << "'";
+ EXIT(EXIT_FAILURE) << "Fetcher could not execute `os::su()` for user '"
+ << fetcherInfo->user() << "'";
}
#endif // __WINDOWS__
}
const Option<string> cacheDirectory =
- fetcherInfo.get().has_cache_directory() ?
- Option<string>::some(fetcherInfo.get().cache_directory()) :
- Option<string>::none();
+ fetcherInfo->has_cache_directory()
+ ? Option<string>::some(fetcherInfo->cache_directory())
+ : Option<string>::none();
const Option<string> frameworksHome =
- fetcherInfo.get().has_frameworks_home() ?
- Option<string>::some(fetcherInfo.get().frameworks_home()) :
- Option<string>::none();
+ fetcherInfo->has_frameworks_home()
+ ? Option<string>::some(fetcherInfo->frameworks_home())
+ : Option<string>::none();
// Fetch each URI to a local file and chmod if necessary.
- foreach (const FetcherInfo::Item& item, fetcherInfo.get().items()) {
+ foreach (const FetcherInfo::Item& item, fetcherInfo->items()) {
Try<string> fetched =
fetch(item, cacheDirectory, sandboxDirectory, frameworksHome);
if (fetched.isError()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/linux/cgroups.cpp
----------------------------------------------------------------------
diff --git a/src/linux/cgroups.cpp b/src/linux/cgroups.cpp
index ed22c45..682b288 100644
--- a/src/linux/cgroups.cpp
+++ b/src/linux/cgroups.cpp
@@ -309,7 +309,7 @@ static Try<Nothing> create(
return Error(
"Failed to determine if hierarchy '" + hierarchy +
"' has the 'cpuset' subsystem attached: " + attached.error());
- } else if (attached.get().count("cpuset") > 0) {
+ } else if (attached->count("cpuset") > 0) {
string parent = Path(path::join("/", cgroup)).dirname();
return cloneCpusetCpusMems(hierarchy, parent, cgroup);
}
@@ -539,7 +539,7 @@ Try<set<string>> hierarchies()
}
set<string> results;
- foreach (const fs::MountTable::Entry& entry, table.get().entries) {
+ foreach (const fs::MountTable::Entry& entry, table->entries) {
if (entry.type == "cgroup") {
Result<string> realpath = os::realpath(entry.dir);
if (!realpath.isSome()) {
@@ -675,7 +675,7 @@ Try<set<string>> subsystems(const string& hierarchy)
// Check if hierarchy is a mount point of type cgroup.
Option<fs::MountTable::Entry> hierarchyEntry;
- foreach (const fs::MountTable::Entry& entry, table.get().entries) {
+ foreach (const fs::MountTable::Entry& entry, table->entries) {
if (entry.type == "cgroup") {
Result<string> dirAbsPath = os::realpath(entry.dir);
if (!dirAbsPath.isSome()) {
@@ -710,7 +710,7 @@ Try<set<string>> subsystems(const string& hierarchy)
set<string> result;
foreach (const string& name, names.get()) {
- if (hierarchyEntry.get().hasOption(name)) {
+ if (hierarchyEntry->hasOption(name)) {
result.insert(name);
}
}
@@ -781,7 +781,7 @@ Try<bool> mounted(const string& hierarchy, const string& subsystems)
"Failed to get mounted hierarchies: " + hierarchies.error());
}
- if (hierarchies.get().count(realpath.get()) == 0) {
+ if (hierarchies->count(realpath.get()) == 0) {
return false;
}
@@ -794,7 +794,7 @@ Try<bool> mounted(const string& hierarchy, const string& subsystems)
}
foreach (const string& subsystem, strings::tokenize(subsystems, ",")) {
- if (attached.get().count(subsystem) == 0) {
+ if (attached->count(subsystem) == 0) {
return false;
}
}
@@ -829,7 +829,7 @@ Try<Nothing> remove(const string& hierarchy, const string& cgroup)
return Error("Failed to get nested cgroups: " + cgroups.error());
}
- if (!cgroups.get().empty()) {
+ if (!cgroups->empty()) {
return Error("Nested cgroups exist");
}
@@ -874,7 +874,7 @@ Try<vector<string>> get(const string& hierarchy, const string& cgroup)
: "No such file or directory"));
}
- char* paths[] = { const_cast<char*>(destAbsPath.get().c_str()), nullptr };
+ char* paths[] = {const_cast<char*>(destAbsPath->c_str()), nullptr};
FTS* tree = fts_open(paths, FTS_NOCHDIR, nullptr);
if (tree == nullptr) {
@@ -891,7 +891,7 @@ Try<vector<string>> get(const string& hierarchy, const string& cgroup)
// FTS_DP indicates a directory being visited in postorder.
if (node->fts_level > 0 && node->fts_info & FTS_DP) {
string path =
- strings::trim(node->fts_path + hierarchyAbsPath.get().length(), "/");
+ strings::trim(node->fts_path + hierarchyAbsPath->length(), "/");
cgroups.push_back(path);
}
}
@@ -1293,7 +1293,7 @@ private:
}
// Inform failure and not listen again.
- promise.get()->fail(error.get().message);
+ promise.get()->fail(error->message);
}
const string hierarchy;
@@ -1460,7 +1460,7 @@ protected:
{
Option<Error> error = verify(hierarchy, cgroup, "freezer.state");
if (error.isSome()) {
- promise.fail("Invalid freezer cgroup: " + error.get().message);
+ promise.fail("Invalid freezer cgroup: " + error->message);
terminate(self());
return;
}
@@ -1614,7 +1614,7 @@ private:
Try<set<pid_t>> processes = cgroups::processes(hierarchy, cgroup);
// If the `cgroup` is already removed, treat this as a success.
- if ((processes.isError() || !processes.get().empty()) &&
+ if ((processes.isError() || !processes->empty()) &&
os::exists(path::join(hierarchy, cgroup))) {
promise.fail("Failed to kill all processes in cgroup: " +
(processes.isError() ? processes.error()
@@ -2395,7 +2395,7 @@ Try<Stats> stat(
return Error(stats.error());
}
- if (!stats.get().contains("user") || !stats.get().contains("system")) {
+ if (!stats->contains("user") || !stats->contains("system")) {
return Error("Failed to get user/system value from cpuacct.stat");
}
@@ -2407,8 +2407,7 @@ Try<Stats> stat(
return ErrnoError("Failed to get _SC_CLK_TCK");
}
- Try<Duration> user =
- Duration::create((double) stats.get().at("user") / userTicks);
+ Try<Duration> user = Duration::create((double)stats->at("user") / userTicks);
if (user.isError()) {
return Error(
@@ -2416,7 +2415,7 @@ Try<Stats> stat(
}
Try<Duration> system =
- Duration::create((double) stats.get().at("system") / userTicks);
+ Duration::create((double)stats->at("system") / userTicks);
if (system.isError()) {
return Error(
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/linux/fs.cpp
----------------------------------------------------------------------
diff --git a/src/linux/fs.cpp b/src/linux/fs.cpp
index 94e78df..dae0942 100644
--- a/src/linux/fs.cpp
+++ b/src/linux/fs.cpp
@@ -495,11 +495,11 @@ Try<Nothing> mount(const Option<string>& source,
// unsigned long mountflags,
// const void *data);
if (::mount(
- (source.isSome() ? source.get().c_str() : nullptr),
- target.c_str(),
- (type.isSome() ? type.get().c_str() : nullptr),
- flags,
- data) < 0) {
+ (source.isSome() ? source->c_str() : nullptr),
+ target.c_str(),
+ (type.isSome() ? type->c_str() : nullptr),
+ flags,
+ data) < 0) {
return ErrnoError();
}
@@ -518,7 +518,7 @@ Try<Nothing> mount(const Option<string>& source,
target,
type,
flags,
- options.isSome() ? options.get().c_str() : nullptr);
+ options.isSome() ? options->c_str() : nullptr);
}
@@ -542,7 +542,7 @@ Try<Nothing> unmountAll(const string& target, int flags)
}
foreach (const MountTable::Entry& entry,
- adaptor::reverse(mountTable.get().entries)) {
+ adaptor::reverse(mountTable->entries)) {
if (strings::startsWith(entry.dir, target)) {
Try<Nothing> unmount = fs::unmount(entry.dir, flags);
if (unmount.isError()) {
@@ -900,7 +900,7 @@ Try<Nothing> enter(const string& root)
// The old root is now relative to chroot so remove the chroot path.
const string relativeOld = strings::remove(old.get(), root, strings::PREFIX);
- foreach (const fs::MountTable::Entry& entry, mountTable.get().entries) {
+ foreach (const fs::MountTable::Entry& entry, mountTable->entries) {
// TODO(idownes): sort the entries and remove depth first so we
// don't rely on the lazy umount and can check the status.
if (strings::startsWith(entry.dir, relativeOld)) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/linux/ns.cpp
----------------------------------------------------------------------
diff --git a/src/linux/ns.cpp b/src/linux/ns.cpp
index fc0e7e4..49f8fca 100644
--- a/src/linux/ns.cpp
+++ b/src/linux/ns.cpp
@@ -119,7 +119,7 @@ Try<Nothing> setns(
return Error(
"Failed to get the threads of the current process: " +
threads.error());
- } else if (threads.get().size() > 1) {
+ } else if (threads->size() > 1) {
return Error("Multiple threads exist in the current process");
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index ba1bcf2..9c5b45b 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -466,7 +466,7 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
LOG(WARNING) << "Failed to stat jwt secret key file '"
<< slaveFlags.jwt_secret_key.get()
<< "': " << permissions.error();
- } else if (permissions.get().others.rwx) {
+ } else if (permissions->others.rwx) {
LOG(WARNING) << "Permissions on executor secret key file '"
<< slaveFlags.jwt_secret_key.get()
<< "' are too open; it is recommended that your"
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/log/catchup.cpp
----------------------------------------------------------------------
diff --git a/src/log/catchup.cpp b/src/log/catchup.cpp
index 79cc18c..ed2e79b 100644
--- a/src/log/catchup.cpp
+++ b/src/log/catchup.cpp
@@ -122,8 +122,8 @@ private:
} else {
// Update the proposal number so that we can save a proposal
// number bump round trip if we need to invoke fill again.
- CHECK(filling.get().promised() >= proposal);
- proposal = filling.get().promised();
+ CHECK(filling->promised() >= proposal);
+ proposal = filling->promised();
check();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/log/consensus.cpp
----------------------------------------------------------------------
diff --git a/src/log/consensus.cpp b/src/log/consensus.cpp
index f766015..76ed3e8 100644
--- a/src/log/consensus.cpp
+++ b/src/log/consensus.cpp
@@ -217,8 +217,7 @@ private:
// An action has already been performed in this position, we
// need to save the action with the highest proposal number.
if (highestAckAction.isNone() ||
- (highestAckAction.get().performed() <
- response.action().performed())) {
+ (highestAckAction->performed() < response.action().performed())) {
highestAckAction = response.action();
}
} else {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/log/replica.cpp
----------------------------------------------------------------------
diff --git a/src/log/replica.cpp b/src/log/replica.cpp
index c86a609..bb5aa8c 100644
--- a/src/log/replica.cpp
+++ b/src/log/replica.cpp
@@ -775,13 +775,13 @@ void ReplicaProcess::restore(const string& path)
}
// Pull out and save some of the state.
- metadata = state.get().metadata;
- begin = state.get().begin;
- end = state.get().end;
- unlearned = state.get().unlearned;
+ metadata = state->metadata;
+ begin = state->begin;
+ end = state->end;
+ unlearned = state->unlearned;
// Only use the learned positions to help determine the holes.
- const IntervalSet<uint64_t>& learned = state.get().learned;
+ const IntervalSet<uint64_t>& learned = state->learned;
// Holes are those positions in [begin, end] that are not in both
// learned and unlearned sets. In the case of a brand new log (begin
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/log/tool/benchmark.cpp
----------------------------------------------------------------------
diff --git a/src/log/tool/benchmark.cpp b/src/log/tool/benchmark.cpp
index b939e26..9c7ca67 100644
--- a/src/log/tool/benchmark.cpp
+++ b/src/log/tool/benchmark.cpp
@@ -194,7 +194,7 @@ Try<Nothing> Benchmark::execute(int argc, char** argv)
vector<Time> timestamps;
// Read sizes from the input trace file.
- ifstream input(flags.input.get().c_str());
+ ifstream input(flags.input->c_str());
if (!input.is_open()) {
return Error("Failed to open the trace file " + flags.input.get());
}
@@ -239,7 +239,7 @@ Try<Nothing> Benchmark::execute(int argc, char** argv)
(position.isFailed()
? position.failure()
: "Discarded future"));
- } else if (position.get().isNone()) {
+ } else if (position->isNone()) {
return Error("Failed to append: exclusive write promise lost");
}
@@ -251,7 +251,7 @@ Try<Nothing> Benchmark::execute(int argc, char** argv)
cout << "Total time used: " << stopwatch.elapsed() << endl;
// Ouput statistics.
- ofstream output(flags.output.get().c_str());
+ ofstream output(flags.output->c_str());
if (!output.is_open()) {
return Error("Failed to open the output file " + flags.output.get());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/log/tool/initialize.cpp
----------------------------------------------------------------------
diff --git a/src/log/tool/initialize.cpp b/src/log/tool/initialize.cpp
index c0f8543..56b12b0 100644
--- a/src/log/tool/initialize.cpp
+++ b/src/log/tool/initialize.cpp
@@ -87,7 +87,7 @@ Try<Nothing> Initialize::execute(int argc, char** argv)
// Get the current status of the replica.
Future<Metadata::Status> status = replica.status();
if (timeout.isSome()) {
- status.await(timeout.get().remaining());
+ status.await(timeout->remaining());
} else {
status.await();
}
@@ -108,7 +108,7 @@ Try<Nothing> Initialize::execute(int argc, char** argv)
// Update the status of the replica to VOTING.
Future<bool> update = replica.update(Metadata::VOTING);
if (timeout.isSome()) {
- update.await(timeout.get().remaining());
+ update.await(timeout->remaining());
} else {
update.await();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/log/tool/read.cpp
----------------------------------------------------------------------
diff --git a/src/log/tool/read.cpp b/src/log/tool/read.cpp
index 50fb020..e02a6e3 100644
--- a/src/log/tool/read.cpp
+++ b/src/log/tool/read.cpp
@@ -103,7 +103,7 @@ Try<Nothing> Read::execute(int argc, char** argv)
// Get the beginning of the replica.
Future<uint64_t> begin = replica.beginning();
if (timeout.isSome()) {
- begin.await(timeout.get().remaining());
+ begin.await(timeout->remaining());
} else {
begin.await();
}
@@ -120,7 +120,7 @@ Try<Nothing> Read::execute(int argc, char** argv)
// Get the ending of the replica.
Future<uint64_t> end = replica.ending();
if (timeout.isSome()) {
- end.await(timeout.get().remaining());
+ end.await(timeout->remaining());
} else {
end.await();
}
@@ -149,7 +149,7 @@ Try<Nothing> Read::execute(int argc, char** argv)
Future<list<Action>> actions = replica.read(from.get(), to.get());
if (timeout.isSome()) {
- actions.await(timeout.get().remaining());
+ actions.await(timeout->remaining());
} else {
actions.await();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/allocator/mesos/hierarchical.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index f33ff76..80e0a34 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -777,7 +777,7 @@ void HierarchicalAllocatorProcess::updateWhitelist(
if (whitelist.isSome()) {
LOG(INFO) << "Updated agent whitelist: " << stringify(whitelist.get());
- if (whitelist.get().empty()) {
+ if (whitelist->empty()) {
LOG(WARNING) << "Whitelist is empty, no offers will be made!";
}
} else {
@@ -1043,7 +1043,7 @@ void HierarchicalAllocatorProcess::updateInverseOffer(
// should guard against this. This goes against the pattern of not
// checking external invariants; however, the allocator and master are
// currently so tightly coupled that this check is valuable.
- CHECK_NE(status.get().status(), InverseOfferStatus::UNKNOWN);
+ CHECK_NE(status->status(), InverseOfferStatus::UNKNOWN);
// If the framework responded, we update our state to match.
maintenance.statuses[frameworkId].CopyFrom(status.get());
@@ -1122,7 +1122,7 @@ HierarchicalAllocatorProcess::getInverseOfferStatuses()
// Make a copy of the most recent statuses.
foreachpair (const SlaveID& id, const Slave& slave, slaves) {
if (slave.maintenance.isSome()) {
- result[id] = slave.maintenance.get().statuses;
+ result[id] = slave.maintenance->statuses;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/contender/contender.cpp
----------------------------------------------------------------------
diff --git a/src/master/contender/contender.cpp b/src/master/contender/contender.cpp
index ea7453d..ad2ae66 100644
--- a/src/master/contender/contender.cpp
+++ b/src/master/contender/contender.cpp
@@ -55,7 +55,7 @@ Try<MasterContender*> MasterContender::create(
if (url.isError()) {
return Error(url.error());
}
- if (url.get().path == "/") {
+ if (url->path == "/") {
return Error(
"Expecting a (chroot) path for ZooKeeper ('/' is not supported)");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/contender/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/master/contender/zookeeper.cpp b/src/master/contender/zookeeper.cpp
index 64fbb3a..9a0601a 100644
--- a/src/master/contender/zookeeper.cpp
+++ b/src/master/contender/zookeeper.cpp
@@ -140,7 +140,7 @@ Future<Future<Nothing>> ZooKeeperMasterContenderProcess::contend()
}
// Should not recontend if the last election is still ongoing.
- if (candidacy.isSome() && candidacy.get().isPending()) {
+ if (candidacy.isSome() && candidacy->isPending()) {
return candidacy.get();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/detector/detector.cpp
----------------------------------------------------------------------
diff --git a/src/master/detector/detector.cpp b/src/master/detector/detector.cpp
index 9d2e8c4..6359446 100644
--- a/src/master/detector/detector.cpp
+++ b/src/master/detector/detector.cpp
@@ -64,7 +64,7 @@ Try<MasterDetector*> MasterDetector::create(
if (url.isError()) {
return Error(url.error());
}
- if (url.get().path == "/") {
+ if (url->path == "/") {
return Error(
"Expecting a (chroot) path for ZooKeeper ('/' is not supported)");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/detector/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/master/detector/zookeeper.cpp b/src/master/detector/zookeeper.cpp
index 1cab567..09ae47c 100644
--- a/src/master/detector/zookeeper.cpp
+++ b/src/master/detector/zookeeper.cpp
@@ -134,7 +134,7 @@ Future<Option<MasterInfo>> ZooKeeperMasterDetectorProcess::detect(
// Return immediately if the detector is no longer operational due
// to a non-retryable error.
if (error.isSome()) {
- return Failure(error.get().message);
+ return Failure(error->message);
}
if (leader != previous) {
@@ -170,14 +170,14 @@ void ZooKeeperMasterDetectorProcess::detected(
return;
}
- if (_leader.get().isNone()) {
+ if (_leader->isNone()) {
leader = None();
setPromises(&promises, leader);
} else {
// Fetch the data associated with the leader.
- group->data(_leader.get().get())
- .onAny(defer(self(), &Self::fetched, _leader.get().get(), lambda::_1));
+ group->data(_leader->get())
+ .onAny(defer(self(), &Self::fetched, _leader->get(), lambda::_1));
}
// Keep trying to detect leadership changes.
@@ -196,7 +196,7 @@ void ZooKeeperMasterDetectorProcess::fetched(
leader = None();
failPromises(&promises, data.failure());
return;
- } else if (data.get().isNone()) {
+ } else if (data->isNone()) {
// Membership is gone before we can read its data.
leader = None();
setPromises(&promises, leader);
@@ -209,13 +209,13 @@ void ZooKeeperMasterDetectorProcess::fetched(
if (label.isNone()) {
// If we are here it means some masters are still creating znodes
// with the old format.
- UPID pid = UPID(data.get().get());
+ UPID pid = UPID(data->get());
LOG(WARNING) << "Leading master " << pid << " has data in old format";
leader = mesos::internal::protobuf::createMasterInfo(pid);
} else if (label.isSome() &&
label.get() == internal::master::MASTER_INFO_LABEL) {
MasterInfo info;
- if (!info.ParseFromString(data.get().get())) {
+ if (!info.ParseFromString(data->get())) {
leader = None();
failPromises(&promises,
"Failed to parse data into MasterInfo");
@@ -228,7 +228,7 @@ void ZooKeeperMasterDetectorProcess::fetched(
leader = info;
} else if (label.isSome() &&
label.get() == internal::master::MASTER_INFO_JSON_LABEL) {
- Try<JSON::Object> object = JSON::parse<JSON::Object>(data.get().get());
+ Try<JSON::Object> object = JSON::parse<JSON::Object>(data->get());
if (object.isError()) {
leader = None();
@@ -260,7 +260,7 @@ void ZooKeeperMasterDetectorProcess::fetched(
}
LOG(INFO) << "A new leading master (UPID="
- << UPID(leader.get().pid()) << ") is detected";
+ << UPID(leader->pid()) << ") is detected";
setPromises(&promises, leader);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 6f692e2..acf10a0 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -404,7 +404,7 @@ struct SlaveWriter
writer->field("registered_time", slave_.registeredTime.secs());
if (slave_.reregisteredTime.isSome()) {
- writer->field("reregistered_time", slave_.reregisteredTime.get().secs());
+ writer->field("reregistered_time", slave_.reregisteredTime->secs());
}
const Resources& totalResources = slave_.totalResources;
@@ -627,7 +627,7 @@ Future<Response> Master::Http::api(
CHECK_SOME(master->recovered);
- if (!master->recovered.get().isReady()) {
+ if (!master->recovered->isReady()) {
return ServiceUnavailable("Master has not finished recovery");
}
@@ -675,8 +675,7 @@ Future<Response> Master::Http::api(
Option<Error> error = validation::master::call::validate(call, principal);
if (error.isSome()) {
- return BadRequest("Failed to validate master::Call: " +
- error.get().message);
+ return BadRequest("Failed to validate master::Call: " + error->message);
}
LOG(INFO) << "Processing call " << call.type();
@@ -935,7 +934,7 @@ Future<Response> Master::Http::scheduler(
CHECK_SOME(master->recovered);
- if (!master->recovered.get().isReady()) {
+ if (!master->recovered->isReady()) {
return ServiceUnavailable("Master has not finished recovery");
}
@@ -984,8 +983,7 @@ Future<Response> Master::Http::scheduler(
if (error.isSome()) {
master->metrics->incrementInvalidSchedulerCalls(call);
- return BadRequest("Failed to validate scheduler::Call: " +
- error.get().message);
+ return BadRequest("Failed to validate scheduler::Call: " + error->message);
}
if (call.type() == scheduler::Call::SUBSCRIBE) {
@@ -1081,7 +1079,7 @@ Future<Response> Master::Http::scheduler(
}
const string& streamId = request.headers.at("Mesos-Stream-Id");
- if (streamId != framework->http.get().streamId.toString()) {
+ if (streamId != framework->http->streamId.toString()) {
return BadRequest(
"The stream ID '" + streamId + "' included in this request "
"didn't match the stream ID currently associated with framework ID "
@@ -1263,7 +1261,7 @@ Future<Response> Master::Http::createVolumes(
}
RepeatedPtrField<Resource> volumes;
- foreach (const JSON::Value& value, parse.get().values) {
+ foreach (const JSON::Value& value, parse->values) {
Try<Resource> volume = ::protobuf::parse<Resource>(value);
if (volume.isError()) {
return BadRequest(
@@ -1437,7 +1435,7 @@ Future<Response> Master::Http::destroyVolumes(
}
RepeatedPtrField<Resource> volumes;
- foreach (const JSON::Value& value, parse.get().values) {
+ foreach (const JSON::Value& value, parse->values) {
Try<Resource> volume = ::protobuf::parse<Resource>(value);
if (volume.isError()) {
return BadRequest(
@@ -2257,7 +2255,7 @@ Future<Response> Master::Http::getMaster(
getMaster->set_start_time(master->startTime.secs());
if (master->electedTime.isSome()) {
- getMaster->set_elected_time(master->electedTime.get().secs());
+ getMaster->set_elected_time(master->electedTime->secs());
}
return OK(serialize(contentType, evolve(response)),
@@ -2431,7 +2429,7 @@ Future<Response> Master::Http::reserve(
}
RepeatedPtrField<Resource> resources;
- foreach (const JSON::Value& value, parse.get().values) {
+ foreach (const JSON::Value& value, parse->values) {
Try<Resource> resource = ::protobuf::parse<Resource>(value);
if (resource.isError()) {
return BadRequest(
@@ -2921,7 +2919,7 @@ Future<Response> Master::Http::state(
writer->field("start_time", master->startTime.secs());
if (master->electedTime.isSome()) {
- writer->field("elected_time", master->electedTime.get().secs());
+ writer->field("elected_time", master->electedTime->secs());
}
writer->field("id", master->info().id());
@@ -5211,7 +5209,7 @@ Future<Response> Master::Http::unreserve(
}
RepeatedPtrField<Resource> resources;
- foreach (const JSON::Value& value, parse.get().values) {
+ foreach (const JSON::Value& value, parse->values) {
Try<Resource> resource = ::protobuf::parse<Resource>(value);
if (resource.isError()) {
return BadRequest(
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 0040d65..8cb52d0 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -370,7 +370,7 @@ int main(int argc, char** argv)
<< " registry when using ZooKeeper";
}
- Try<zookeeper::URL> url = zookeeper::URL::parse(flags.zk.get().value);
+ Try<zookeeper::URL> url = zookeeper::URL::parse(flags.zk->value);
if (url.isError()) {
EXIT(EXIT_FAILURE) << "Error parsing ZooKeeper URL: " << url.error();
}
@@ -378,10 +378,10 @@ int main(int argc, char** argv)
log = new Log(
flags.quorum.get(),
path::join(flags.work_dir.get(), "replicated_log"),
- url.get().servers,
+ url->servers,
flags.zk_session_timeout,
- path::join(url.get().path, "log_replicas"),
- url.get().authentication,
+ path::join(url->path, "log_replicas"),
+ url->authentication,
flags.log_auto_initialize,
"registrar/");
} else {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index b06d7a6..e7d5ac6 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -337,7 +337,7 @@ Master::Master(
// TODO(marco): The ip, port, hostname fields above are
// being deprecated; the code should be removed once
// the deprecation cycle is complete.
- info_.set_ip(self().address.ip.in().get().s_addr);
+ info_.set_ip(self().address.ip.in()->s_addr);
info_.set_port(self().address.port);
info_.set_pid(self());
@@ -646,7 +646,7 @@ void Master::initialize()
if (flags.rate_limits.isSome()) {
// Add framework rate limiters.
- foreach (const RateLimit& limit_, flags.rate_limits.get().limits()) {
+ foreach (const RateLimit& limit_, flags.rate_limits->limits()) {
if (frameworks.limiters.contains(limit_.principal())) {
EXIT(EXIT_FAILURE)
<< "Duplicate principal " << limit_.principal()
@@ -673,22 +673,22 @@ void Master::initialize()
}
}
- if (flags.rate_limits.get().has_aggregate_default_qps() &&
- flags.rate_limits.get().aggregate_default_qps() <= 0) {
+ if (flags.rate_limits->has_aggregate_default_qps() &&
+ flags.rate_limits->aggregate_default_qps() <= 0) {
EXIT(EXIT_FAILURE)
<< "Invalid aggregate_default_qps: "
- << flags.rate_limits.get().aggregate_default_qps()
+ << flags.rate_limits->aggregate_default_qps()
<< ". It must be a positive number";
}
- if (flags.rate_limits.get().has_aggregate_default_qps()) {
+ if (flags.rate_limits->has_aggregate_default_qps()) {
Option<uint64_t> capacity;
- if (flags.rate_limits.get().has_aggregate_default_capacity()) {
- capacity = flags.rate_limits.get().aggregate_default_capacity();
+ if (flags.rate_limits->has_aggregate_default_capacity()) {
+ capacity = flags.rate_limits->aggregate_default_capacity();
}
- frameworks.defaultLimiter = Owned<BoundedRateLimiter>(
- new BoundedRateLimiter(
- flags.rate_limits.get().aggregate_default_qps(), capacity));
+ frameworks.defaultLimiter =
+ Owned<BoundedRateLimiter>(new BoundedRateLimiter(
+ flags.rate_limits->aggregate_default_qps(), capacity));
}
LOG(INFO) << "Framework rate limiting enabled";
@@ -715,15 +715,15 @@ void Master::initialize()
roleWhitelist = hashset<string>();
foreach (const string& role, roles.get()) {
- roleWhitelist.get().insert(role);
+ roleWhitelist->insert(role);
}
- if (roleWhitelist.get().size() < roles.get().size()) {
+ if (roleWhitelist->size() < roles->size()) {
LOG(WARNING) << "Duplicate values in '--roles': " << flags.roles.get();
}
// The default role is always allowed.
- roleWhitelist.get().insert("*");
+ roleWhitelist->insert("*");
}
// Add role weights.
@@ -1270,8 +1270,7 @@ void Master::finalize()
void Master::exited(const FrameworkID& frameworkId, const HttpConnection& http)
{
foreachvalue (Framework* framework, frameworks.registered) {
- if (framework->http.isSome() &&
- framework->http.get().writer == http.writer) {
+ if (framework->http.isSome() && framework->http->writer == http.writer) {
CHECK_EQ(frameworkId, framework->id());
_exited(framework);
return;
@@ -1511,7 +1510,7 @@ void Master::consume(MessageEvent&& event)
// through recover(). What are the performance implications of
// the additional queueing delay and the accumulated backlog
// of messages post-recovery?
- if (!recovered.get().isReady()) {
+ if (!recovered->isReady()) {
VLOG(1) << "Dropping '" << event.message.name << "' message since "
<< "not recovered yet";
++metrics->dropped_messages;
@@ -2090,8 +2089,8 @@ void Master::contended(const Future<Future<Nothing>>& candidacy)
}
// Watch for candidacy change.
- candidacy.get()
- .onAny(defer(self(), &Master::lostCandidacy, lambda::_1));
+ candidacy
+ ->onAny(defer(self(), &Master::lostCandidacy, lambda::_1));
}
@@ -2593,10 +2592,10 @@ void Master::subscribe(
if (validationError.isSome()) {
LOG(INFO) << "Refusing subscription of framework"
<< " '" << frameworkInfo.name() << "': "
- << validationError.get().message;
+ << validationError->message;
FrameworkErrorMessage message;
- message.set_message(validationError.get().message);
+ message.set_message(validationError->message);
http.send(message);
http.close();
@@ -2645,10 +2644,10 @@ void Master::_subscribe(
if (authorizationError.isSome()) {
LOG(INFO) << "Refusing subscription of framework"
<< " '" << frameworkInfo.name() << "'"
- << ": " << authorizationError.get().message;
+ << ": " << authorizationError->message;
FrameworkErrorMessage message;
- message.set_message(authorizationError.get().message);
+ message.set_message(authorizationError->message);
http.send(message);
http.close();
return;
@@ -2859,10 +2858,10 @@ void Master::subscribe(
if (validationError.isSome()) {
LOG(INFO) << "Refusing subscription of framework"
<< " '" << frameworkInfo.name() << "' at " << from << ": "
- << validationError.get().message;
+ << validationError->message;
FrameworkErrorMessage message;
- message.set_message(validationError.get().message);
+ message.set_message(validationError->message);
send(from, message);
return;
}
@@ -2925,10 +2924,10 @@ void Master::_subscribe(
if (authorizationError.isSome()) {
LOG(INFO) << "Refusing subscription of framework"
<< " '" << frameworkInfo.name() << "' at " << from
- << ": " << authorizationError.get().message;
+ << ": " << authorizationError->message;
FrameworkErrorMessage message;
- message.set_message(authorizationError.get().message);
+ message.set_message(authorizationError->message);
send(from, message);
return;
@@ -2943,7 +2942,7 @@ void Master::_subscribe(
if (authenticationError.isSome()) {
LOG(INFO) << "Dropping SUBSCRIBE call for framework"
<< " '" << frameworkInfo.name() << "' at " << from
- << ": " << authenticationError.get().message;
+ << ": " << authenticationError->message;
return;
}
@@ -3227,7 +3226,7 @@ void Master::disconnect(Framework* framework)
// Close the HTTP connection, which may already have
// been closed due to scheduler disconnection.
- framework->http.get().close();
+ framework->http->close();
}
}
@@ -3417,7 +3416,7 @@ bool Master::isWhitelistedRole(const string& name) const
return true;
}
- return roleWhitelist.get().contains(name);
+ return roleWhitelist->contains(name);
}
@@ -7809,7 +7808,7 @@ void Master::updateUnavailability(
// TODO(jmlvanre): Add stream operator for unavailability.
LOG(INFO) << "Updating unavailability of agent " << *slave
<< ", starting at "
- << Nanoseconds(unavailability.get().start().nanoseconds());
+ << Nanoseconds(unavailability->start().nanoseconds());
} else {
LOG(INFO) << "Removing unavailability of agent " << *slave;
}
@@ -8636,8 +8635,8 @@ void Master::_reconcileTasks(
if (update.isSome()) {
VLOG(1) << "Sending explicit reconciliation state "
- << update.get().status().state()
- << " for task " << update.get().status().task_id()
+ << update->status().state()
+ << " for task " << update->status().task_id()
<< " of framework " << *framework;
// TODO(bmahler): Consider using forward(); might lead to too
@@ -9042,7 +9041,7 @@ void Master::_authenticate(
const UPID& pid,
const Future<Option<string>>& future)
{
- if (!future.isReady() || future.get().isNone()) {
+ if (!future.isReady() || future->isNone()) {
const string& error = future.isReady()
? "Refused authentication"
: (future.isFailed() ? future.failure() : "future discarded");
@@ -9050,10 +9049,10 @@ void Master::_authenticate(
LOG(WARNING) << "Failed to authenticate " << pid
<< ": " << error;
} else {
- LOG(INFO) << "Successfully authenticated principal '" << future.get().get()
+ LOG(INFO) << "Successfully authenticated principal '" << future->get()
<< "' at " << pid;
- authenticated.put(pid, future.get().get());
+ authenticated.put(pid, future->get());
}
CHECK(authenticating.contains(pid));
@@ -11738,7 +11737,7 @@ bool Slave::hasExecutor(const FrameworkID& frameworkId,
const ExecutorID& executorId) const
{
return executors.contains(frameworkId) &&
- executors.get(frameworkId).get().contains(executorId);
+ executors.get(frameworkId)->contains(executorId);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 92af852..6569c9e 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -2322,7 +2322,7 @@ struct Framework
}
if (http.isSome()) {
- if (!http.get().send(message)) {
+ if (!http->send(message)) {
LOG(WARNING) << "Unable to send event to framework " << *this << ":"
<< " connection closed";
}
@@ -2761,7 +2761,7 @@ struct Framework
{
CHECK_SOME(http);
- if (connected() && !http.get().close()) {
+ if (connected() && !http->close()) {
LOG(WARNING) << "Failed to close HTTP pipe for " << *this;
}
@@ -2769,8 +2769,8 @@ struct Framework
CHECK_SOME(heartbeater);
- terminate(heartbeater.get().get());
- wait(heartbeater.get().get());
+ terminate(heartbeater->get());
+ wait(heartbeater->get());
heartbeater = None();
}
@@ -2792,7 +2792,7 @@ struct Framework
http.get(),
DEFAULT_HEARTBEAT_INTERVAL);
- process::spawn(heartbeater.get().get());
+ process::spawn(heartbeater->get());
}
bool active() const { return state == ACTIVE; }
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/quota_handler.cpp
----------------------------------------------------------------------
diff --git a/src/master/quota_handler.cpp b/src/master/quota_handler.cpp
index 37d43e1..21bafd0 100644
--- a/src/master/quota_handler.cpp
+++ b/src/master/quota_handler.cpp
@@ -562,7 +562,7 @@ Future<http::Response> Master::QuotaHandler::__set(
if (error.isSome()) {
return Conflict(
"Heuristic capacity check for set quota request failed: " +
- error.get().message);
+ error->message);
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/registrar.cpp
----------------------------------------------------------------------
diff --git a/src/master/registrar.cpp b/src/master/registrar.cpp
index aabce22..a835142 100644
--- a/src/master/registrar.cpp
+++ b/src/master/registrar.cpp
@@ -530,7 +530,7 @@ void RegistrarProcess::_update(
updating = false;
// Abort if the storage operation did not succeed.
- if (!store.isReady() || store.get().isNone()) {
+ if (!store.isReady() || store->isNone()) {
string message = "Failed to update registry: ";
if (store.isFailed()) {
@@ -551,7 +551,7 @@ void RegistrarProcess::_update(
LOG(INFO) << "Successfully updated the registry in " << elapsed;
- variable = store.get().get();
+ variable = store->get();
registry->Swap(updatedRegistry.get());
// Remove the operations.
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index b15b75c..9254cd2 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -864,22 +864,22 @@ Option<Error> validate(const RepeatedPtrField<Resource>& resources)
{
Option<Error> error = Resources::validate(resources);
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error = common::validation::validateGpus(resources);
if (error.isSome()) {
- return Error("Invalid 'gpus' resource: " + error.get().message);
+ return Error("Invalid 'gpus' resource: " + error->message);
}
error = validateDiskInfo(resources);
if (error.isSome()) {
- return Error("Invalid DiskInfo: " + error.get().message);
+ return Error("Invalid DiskInfo: " + error->message);
}
error = validateDynamicReservationInfo(resources);
if (error.isSome()) {
- return Error("Invalid ReservationInfo: " + error.get().message);
+ return Error("Invalid ReservationInfo: " + error->message);
}
return None();
@@ -1957,13 +1957,13 @@ Option<Error> validate(
// NOTE: this ensures the reservation is not being made to the "*" role.
Option<Error> error = resource::validate(reserve.resources());
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error =
resource::internal::validateSingleResourceProvider(reserve.resources());
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
Option<hashset<string>> frameworkRoles;
@@ -2101,13 +2101,13 @@ Option<Error> validate(
{
Option<Error> error = resource::validate(unreserve.resources());
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error =
resource::internal::validateSingleResourceProvider(unreserve.resources());
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
// NOTE: We don't check that 'FrameworkInfo.principal' matches
@@ -2144,17 +2144,17 @@ Option<Error> validate(
{
Option<Error> error = resource::validate(create.volumes());
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error = resource::internal::validateSingleResourceProvider(create.volumes());
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error = resource::validatePersistentVolume(create.volumes());
if (error.isSome()) {
- return Error("Not a persistent volume: " + error.get().message);
+ return Error("Not a persistent volume: " + error->message);
}
error = resource::validateUniquePersistenceID(
@@ -2175,7 +2175,7 @@ Option<Error> validate(
return Error(
"Create volume operation for '" + stringify(volume) +
"' has been attempted by framework '" +
- stringify(frameworkInfo.get().id()) +
+ stringify(frameworkInfo->id()) +
"' with no SHARED_RESOURCES capability");
}
@@ -2264,17 +2264,17 @@ Option<Error> validate(
Option<Error> error = resource::validate(volumes);
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error = resource::internal::validateSingleResourceProvider(volumes);
if (error.isSome()) {
- return Error("Invalid resources: " + error.get().message);
+ return Error("Invalid resources: " + error->message);
}
error = resource::validatePersistentVolume(volumes);
if (error.isSome()) {
- return Error("Not a persistent volume: " + error.get().message);
+ return Error("Not a persistent volume: " + error->message);
}
foreach (const Resource volume, volumes) {
@@ -2378,7 +2378,7 @@ Option<Error> validate(const Offer::Operation::CreateBlock& createBlock)
Option<Error> error = resource::validate(Resources(source));
if (error.isSome()) {
- return Error("Invalid resource: " + error.get().message);
+ return Error("Invalid resource: " + error->message);
}
if (!Resources::hasResourceProvider(source)) {
@@ -2399,7 +2399,7 @@ Option<Error> validate(const Offer::Operation::DestroyBlock& destroyBlock)
Option<Error> error = resource::validate(Resources(block));
if (error.isSome()) {
- return Error("Invalid resource: " + error.get().message);
+ return Error("Invalid resource: " + error->message);
}
if (!Resources::hasResourceProvider(block)) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/master/weights_handler.cpp
----------------------------------------------------------------------
diff --git a/src/master/weights_handler.cpp b/src/master/weights_handler.cpp
index 59104a8..1053652 100644
--- a/src/master/weights_handler.cpp
+++ b/src/master/weights_handler.cpp
@@ -212,7 +212,7 @@ Future<http::Response> Master::WeightsHandler::_updateWeights(
if (roleError.isSome()) {
return BadRequest(
"Failed to validate update weights request JSON: Invalid role '" +
- role + "': " + roleError.get().message);
+ role + "': " + roleError->message);
}
// Check that the role is on the role whitelist, if it exists.
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/resource_provider/http_connection.hpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/http_connection.hpp b/src/resource_provider/http_connection.hpp
index add5acc..0ae8124 100644
--- a/src/resource_provider/http_connection.hpp
+++ b/src/resource_provider/http_connection.hpp
@@ -216,7 +216,7 @@ protected:
endpoint = None();
} else {
- endpoint = future.get().get();
+ endpoint = future->get();
LOG(INFO) << "New endpoint detected at " << endpoint.get();
@@ -452,7 +452,7 @@ protected:
if (event->isError()) {
LOG(ERROR) << "Failed to de-serialize event: " << event->error();
} else {
- receive(event.get().get());
+ receive(event->get());
}
read();
http://git-wip-us.apache.org/repos/asf/mesos/blob/49c642e9/src/resource_provider/registrar.cpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/registrar.cpp b/src/resource_provider/registrar.cpp
index 3e6b64b..9eb49f1 100644
--- a/src/resource_provider/registrar.cpp
+++ b/src/resource_provider/registrar.cpp
@@ -309,7 +309,7 @@ void AgentRegistrarProcess::_update(
{
updating = false;
// Abort if the storage operation did not succeed.
- if (!store.isReady() || store.get().isNone()) {
+ if (!store.isReady() || store->isNone()) {
string message = "Failed to update registry: ";
if (store.isFailed()) {