You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/03/29 20:27:52 UTC

mesos git commit: Cleaned up resources library to use the new -> operators.

Repository: mesos
Updated Branches:
  refs/heads/master 59c5082b2 -> b3516fd39


Cleaned up resources library to use the new -> operators.

Review: https://reviews.apache.org/r/44776/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b3516fd3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b3516fd3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b3516fd3

Branch: refs/heads/master
Commit: b3516fd39f2dea55c010ca4ee9e2a8c5393df7c6
Parents: 59c5082
Author: Kevin Klues <kl...@gmail.com>
Authored: Tue Mar 29 11:26:53 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Tue Mar 29 11:26:53 2016 -0700

----------------------------------------------------------------------
 src/common/resources.cpp | 16 ++++++++--------
 src/v1/resources.cpp     | 16 ++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b3516fd3/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 1f23dc8..818eb8b 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -731,7 +731,7 @@ Option<Error> Resources::validate(const RepeatedPtrField<Resource>& resources)
     if (error.isSome()) {
       return Error(
           "Resource '" + stringify(resource) +
-          "' is invalid: " + error.get().message);
+          "' is invalid: " + error->message);
     }
   }
 
@@ -972,7 +972,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::RESERVE: {
       Option<Error> error = validate(operation.reserve().resources());
       if (error.isSome()) {
-        return Error("Invalid RESERVE Operation: " + error.get().message);
+        return Error("Invalid RESERVE Operation: " + error->message);
       }
 
       foreach (const Resource& reserved, operation.reserve().resources()) {
@@ -998,7 +998,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::UNRESERVE: {
       Option<Error> error = validate(operation.unreserve().resources());
       if (error.isSome()) {
-        return Error("Invalid UNRESERVE Operation: " + error.get().message);
+        return Error("Invalid UNRESERVE Operation: " + error->message);
       }
 
       foreach (const Resource& reserved, operation.unreserve().resources()) {
@@ -1024,7 +1024,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::CREATE: {
       Option<Error> error = validate(operation.create().volumes());
       if (error.isSome()) {
-        return Error("Invalid CREATE Operation: " + error.get().message);
+        return Error("Invalid CREATE Operation: " + error->message);
       }
 
       foreach (const Resource& volume, operation.create().volumes()) {
@@ -1062,7 +1062,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::DESTROY: {
       Option<Error> error = validate(operation.destroy().volumes());
       if (error.isSome()) {
-        return Error("Invalid DESTROY Operation: " + error.get().message);
+        return Error("Invalid DESTROY Operation: " + error->message);
       }
 
       foreach (const Resource& volume, operation.destroy().volumes()) {
@@ -1220,7 +1220,7 @@ Option<double> Resources::cpus() const
 {
   Option<Value::Scalar> value = get<Value::Scalar>("cpus");
   if (value.isSome()) {
-    return value.get().value();
+    return value->value();
   } else {
     return None();
   }
@@ -1231,7 +1231,7 @@ Option<Bytes> Resources::mem() const
 {
   Option<Value::Scalar> value = get<Value::Scalar>("mem");
   if (value.isSome()) {
-    return Megabytes(static_cast<uint64_t>(value.get().value()));
+    return Megabytes(static_cast<uint64_t>(value->value()));
   } else {
     return None();
   }
@@ -1242,7 +1242,7 @@ Option<Bytes> Resources::disk() const
 {
   Option<Value::Scalar> value = get<Value::Scalar>("disk");
   if (value.isSome()) {
-    return Megabytes(static_cast<uint64_t>(value.get().value()));
+    return Megabytes(static_cast<uint64_t>(value->value()));
   } else {
     return None();
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/b3516fd3/src/v1/resources.cpp
----------------------------------------------------------------------
diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp
index c6f125e..4907040 100644
--- a/src/v1/resources.cpp
+++ b/src/v1/resources.cpp
@@ -734,7 +734,7 @@ Option<Error> Resources::validate(const RepeatedPtrField<Resource>& resources)
     if (error.isSome()) {
       return Error(
           "Resource '" + stringify(resource) +
-          "' is invalid: " + error.get().message);
+          "' is invalid: " + error->message);
     }
   }
 
@@ -975,7 +975,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::RESERVE: {
       Option<Error> error = validate(operation.reserve().resources());
       if (error.isSome()) {
-        return Error("Invalid RESERVE Operation: " + error.get().message);
+        return Error("Invalid RESERVE Operation: " + error->message);
       }
 
       foreach (const Resource& reserved, operation.reserve().resources()) {
@@ -1001,7 +1001,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::UNRESERVE: {
       Option<Error> error = validate(operation.unreserve().resources());
       if (error.isSome()) {
-        return Error("Invalid UNRESERVE Operation: " + error.get().message);
+        return Error("Invalid UNRESERVE Operation: " + error->message);
       }
 
       foreach (const Resource& reserved, operation.unreserve().resources()) {
@@ -1027,7 +1027,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::CREATE: {
       Option<Error> error = validate(operation.create().volumes());
       if (error.isSome()) {
-        return Error("Invalid CREATE Operation: " + error.get().message);
+        return Error("Invalid CREATE Operation: " + error->message);
       }
 
       foreach (const Resource& volume, operation.create().volumes()) {
@@ -1065,7 +1065,7 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
     case Offer::Operation::DESTROY: {
       Option<Error> error = validate(operation.destroy().volumes());
       if (error.isSome()) {
-        return Error("Invalid DESTROY Operation: " + error.get().message);
+        return Error("Invalid DESTROY Operation: " + error->message);
       }
 
       foreach (const Resource& volume, operation.destroy().volumes()) {
@@ -1223,7 +1223,7 @@ Option<double> Resources::cpus() const
 {
   Option<Value::Scalar> value = get<Value::Scalar>("cpus");
   if (value.isSome()) {
-    return value.get().value();
+    return value->value();
   } else {
     return None();
   }
@@ -1234,7 +1234,7 @@ Option<Bytes> Resources::mem() const
 {
   Option<Value::Scalar> value = get<Value::Scalar>("mem");
   if (value.isSome()) {
-    return Megabytes(static_cast<uint64_t>(value.get().value()));
+    return Megabytes(static_cast<uint64_t>(value->value()));
   } else {
     return None();
   }
@@ -1245,7 +1245,7 @@ Option<Bytes> Resources::disk() const
 {
   Option<Value::Scalar> value = get<Value::Scalar>("disk");
   if (value.isSome()) {
-    return Megabytes(static_cast<uint64_t>(value.get().value()));
+    return Megabytes(static_cast<uint64_t>(value->value()));
   } else {
     return None();
   }