Repository: mesos
Updated Branches:
  refs/heads/master 884459168 -> c78496fd5


Renamed the resource provider PUBLISH event to PUBLISH_RESOURCES.

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


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

Branch: refs/heads/master
Commit: 2975d7e6bae6dc0b1ddb730ef3da2938b4fc5e01
Parents: 8844591
Author: Greg Mann <gregorywm...@gmail.com>
Authored: Wed Dec 6 15:28:14 2017 -0800
Committer: Greg Mann <gregorywm...@gmail.com>
Committed: Thu Dec 7 23:06:14 2017 -0800

----------------------------------------------------------------------
 .../resource_provider/resource_provider.proto   |  6 ++--
 .../resource_provider/resource_provider.proto   |  6 ++--
 src/resource_provider/manager.cpp               | 17 ++++++-----
 src/resource_provider/manager.hpp               |  2 +-
 src/resource_provider/storage/provider.cpp      | 11 ++++---
 src/slave/slave.cpp                             |  2 +-
 src/tests/mesos.hpp                             | 14 +++++----
 src/tests/resource_provider_manager_tests.cpp   | 32 ++++++++++----------
 src/tests/slave_tests.cpp                       |  6 ++--
 9 files changed, 50 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/include/mesos/resource_provider/resource_provider.proto
----------------------------------------------------------------------
diff --git a/include/mesos/resource_provider/resource_provider.proto 
b/include/mesos/resource_provider/resource_provider.proto
index d2b9c79..9c69813 100644
--- a/include/mesos/resource_provider/resource_provider.proto
+++ b/include/mesos/resource_provider/resource_provider.proto
@@ -34,7 +34,7 @@ message Event {
 
     SUBSCRIBED = 1;                  // See 'Subscribed' below.
     OPERATION = 2;                   // See 'Operation' below.
-    PUBLISH = 3;                     // See 'Publish' below.
+    PUBLISH_RESOURCES = 3;           // See 'PublishResources' below.
     ACKNOWLEDGE_OFFER_OPERATION = 4; // See 'AcknowledgeOfferOperation' below.
     RECONCILE_OFFER_OPERATIONS = 5;  // See 'ReconcileOfferOperations' below.
   }
@@ -73,7 +73,7 @@ message Event {
 
   // Received when the master wants to launch a task using resources
   // of this resource provider.
-  message Publish {
+  message PublishResources {
     required bytes uuid = 1;
     repeated Resource resources = 2;
   }
@@ -99,7 +99,7 @@ message Event {
   optional Type type = 1;
   optional Subscribed subscribed = 2;
   optional Operation operation = 3;
-  optional Publish publish = 4;
+  optional PublishResources publish_resources = 4;
   optional AcknowledgeOfferOperation acknowledge_offer_operation = 5;
   optional ReconcileOfferOperations reconcile_offer_operations = 6;
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/include/mesos/v1/resource_provider/resource_provider.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/resource_provider/resource_provider.proto 
b/include/mesos/v1/resource_provider/resource_provider.proto
index 0c23e91..8340316 100644
--- a/include/mesos/v1/resource_provider/resource_provider.proto
+++ b/include/mesos/v1/resource_provider/resource_provider.proto
@@ -34,7 +34,7 @@ message Event {
 
     SUBSCRIBED = 1;                  // See 'Subscribed' below.
     OPERATION = 2;                   // See 'Operation' below.
-    PUBLISH = 3;                     // See 'Publish' below.
+    PUBLISH_RESOURCES = 3;           // See 'PublishResources' below.
     ACKNOWLEDGE_OFFER_OPERATION = 4; // See 'AcknowledgeOfferOperation' below.
     RECONCILE_OFFER_OPERATIONS = 5;  // See 'ReconcileOfferOperations' below.
   }
@@ -73,7 +73,7 @@ message Event {
 
   // Received when the master wants to launch a task using resources
   // of this resource provider.
-  message Publish {
+  message PublishResources {
     required bytes uuid = 1;
     repeated Resource resources = 2;
   }
@@ -99,7 +99,7 @@ message Event {
   optional Type type = 1;
   optional Subscribed subscribed = 2;
   optional Operation operation = 3;
-  optional Publish publish = 4;
+  optional PublishResources publish_resources = 4;
   optional AcknowledgeOfferOperation acknowledge_offer_operation = 5;
   optional ReconcileOfferOperations reconcile_offer_operations = 6;
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/src/resource_provider/manager.cpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/manager.cpp 
b/src/resource_provider/manager.cpp
index e75d528..c12fd38 100644
--- a/src/resource_provider/manager.cpp
+++ b/src/resource_provider/manager.cpp
@@ -163,7 +163,7 @@ public:
 
   void reconcileOfferOperations(const ReconcileOfferOperationsMessage& 
message);
 
-  Future<Nothing> publish(const Resources& resources);
+  Future<Nothing> publishResources(const Resources& resources);
 
   Queue<ResourceProviderMessage> messages;
 
@@ -496,7 +496,7 @@ void 
ResourceProviderManagerProcess::reconcileOfferOperations(
 }
 
 
-Future<Nothing> ResourceProviderManagerProcess::publish(
+Future<Nothing> ResourceProviderManagerProcess::publishResources(
     const Resources& resources)
 {
   hashmap<ResourceProviderID, Resources> providedResources;
@@ -531,9 +531,9 @@ Future<Nothing> ResourceProviderManagerProcess::publish(
     UUID uuid = UUID::random();
 
     Event event;
-    event.set_type(Event::PUBLISH);
-    event.mutable_publish()->set_uuid(uuid.toBytes());
-    event.mutable_publish()->mutable_resources()->CopyFrom(resources);
+    event.set_type(Event::PUBLISH_RESOURCES);
+    event.mutable_publish_resources()->set_uuid(uuid.toBytes());
+    
event.mutable_publish_resources()->mutable_resources()->CopyFrom(resources);
 
     ResourceProvider* resourceProvider =
       resourceProviders.subscribed.at(resourceProviderId).get();
@@ -544,7 +544,7 @@ Future<Nothing> ResourceProviderManagerProcess::publish(
 
     if (!resourceProvider->http.send(event)) {
       return Failure(
-          "Failed to send PUBLISH event to resource provider " +
+          "Failed to send PUBLISH_RESOURCES event to resource provider " +
           stringify(resourceProviderId) + ": connection closed");
     }
 
@@ -765,11 +765,12 @@ void ResourceProviderManager::reconcileOfferOperations(
 }
 
 
-Future<Nothing> ResourceProviderManager::publish(const Resources& resources)
+Future<Nothing> ResourceProviderManager::publishResources(
+    const Resources& resources)
 {
   return dispatch(
       process.get(),
-      &ResourceProviderManagerProcess::publish,
+      &ResourceProviderManagerProcess::publishResources,
       resources);
 }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/src/resource_provider/manager.hpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/manager.hpp 
b/src/resource_provider/manager.hpp
index e94b836..c5c2d52 100644
--- a/src/resource_provider/manager.hpp
+++ b/src/resource_provider/manager.hpp
@@ -64,7 +64,7 @@ public:
       const ReconcileOfferOperationsMessage& message) const;
 
   // Ensure that the resources are ready for use.
-  process::Future<Nothing> publish(const Resources& resources);
+  process::Future<Nothing> publishResources(const Resources& resources);
 
   // Returns a stream of messages from the resource provider manager.
   process::Queue<ResourceProviderMessage> messages() const;

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/src/resource_provider/storage/provider.cpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/storage/provider.cpp 
b/src/resource_provider/storage/provider.cpp
index a029421..d43c8bd 100644
--- a/src/resource_provider/storage/provider.cpp
+++ b/src/resource_provider/storage/provider.cpp
@@ -330,7 +330,7 @@ private:
   // Functions for received events.
   void subscribed(const Event::Subscribed& subscribed);
   void operation(const Event::Operation& operation);
-  void publish(const Event::Publish& publish);
+  void publishResources(const Event::PublishResources& publish);
   void acknowledgeOfferOperation(
       const Event::AcknowledgeOfferOperation& acknowledge);
   void reconcileOfferOperations(
@@ -453,9 +453,9 @@ void StorageLocalResourceProviderProcess::received(const 
Event& event)
       operation(event.operation());
       break;
     }
-    case Event::PUBLISH: {
-      CHECK(event.has_publish());
-      publish(event.publish());
+    case Event::PUBLISH_RESOURCES: {
+      CHECK(event.has_publish_resources());
+      publishResources(event.publish_resources());
       break;
     }
     case Event::ACKNOWLEDGE_OFFER_OPERATION: {
@@ -997,7 +997,8 @@ void StorageLocalResourceProviderProcess::operation(
 }
 
 
-void StorageLocalResourceProviderProcess::publish(const Event::Publish& 
publish)
+void StorageLocalResourceProviderProcess::publishResources(
+    const Event::PublishResources& publish)
 {
   Option<Error> error;
   hashset<string> volumeIds;

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 1bdc9d8..98370f9 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -7363,7 +7363,7 @@ Future<Nothing> Slave::publishResources(
     resources += additionalResources.get();
   }
 
-  return resourceProviderManager.publish(resources);
+  return resourceProviderManager.publishResources(resources);
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 76fbd90..3b9403c 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -2850,7 +2850,7 @@ public:
               Source>::operationDefault));
     EXPECT_CALL(*this, operation(_)).WillRepeatedly(DoDefault());
 
-    ON_CALL(*this, publish(_))
+    ON_CALL(*this, publishResources(_))
       .WillByDefault(Invoke(
           this,
           &MockResourceProvider<
@@ -2864,14 +2864,16 @@ public:
               OfferOperationState,
               Operation,
               Source>::publishDefault));
-    EXPECT_CALL(*this, publish(_)).WillRepeatedly(DoDefault());
+    EXPECT_CALL(*this, publishResources(_)).WillRepeatedly(DoDefault());
   }
 
   MOCK_METHOD0_T(connected, void());
   MOCK_METHOD0_T(disconnected, void());
   MOCK_METHOD1_T(subscribed, void(const typename Event::Subscribed&));
   MOCK_METHOD1_T(operation, void(const typename Event::Operation&));
-  MOCK_METHOD1_T(publish, void(const typename Event::Publish&));
+  MOCK_METHOD1_T(
+      publishResources,
+      void(const typename Event::PublishResources&));
   MOCK_METHOD1_T(
       acknowledgeOfferOperation,
       void(const typename Event::AcknowledgeOfferOperation&));
@@ -2892,8 +2894,8 @@ public:
         case Event::OPERATION:
           operation(event.operation());
           break;
-        case Event::PUBLISH:
-          publish(event.publish());
+        case Event::PUBLISH_RESOURCES:
+          publishResources(event.publish_resources());
           break;
         case Event::ACKNOWLEDGE_OFFER_OPERATION:
           acknowledgeOfferOperation(event.acknowledge_offer_operation());
@@ -3075,7 +3077,7 @@ public:
     driver->send(call);
   }
 
-  void publishDefault(const typename Event::Publish& publish)
+  void publishDefault(const typename Event::PublishResources& publish)
   {
     CHECK(info.has_id());
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/src/tests/resource_provider_manager_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/resource_provider_manager_tests.cpp 
b/src/tests/resource_provider_manager_tests.cpp
index a4c19ca..117003d 100644
--- a/src/tests/resource_provider_manager_tests.cpp
+++ b/src/tests/resource_provider_manager_tests.cpp
@@ -460,9 +460,9 @@ TEST_P(ResourceProviderManagerHttpApiTest, 
UpdateOfferOperationStatus)
 
 
 // This test verifies that the pending future returned by
-// `ResourceProviderManager::publish()` becomes ready when the manager
+// `ResourceProviderManager::publishResources()` becomes ready when the manager
 // receives an publish status update with an `OK` status.
-TEST_P(ResourceProviderManagerHttpApiTest, PublishSuccess)
+TEST_P(ResourceProviderManagerHttpApiTest, PublishResourcesSuccess)
 {
   const ContentType contentType = GetParam();
 
@@ -531,19 +531,19 @@ TEST_P(ResourceProviderManagerHttpApiTest, PublishSuccess)
       resource.mutable_provider_id()->CopyFrom(resourceProviderId.get());
     }
 
-    Future<Nothing> published = manager.publish(devolve(resources));
+    Future<Nothing> published = manager.publishResources(devolve(resources));
 
     Future<Result<Event>> event = responseDecoder->read();
     AWAIT_READY(event);
     ASSERT_SOME(event.get());
-    ASSERT_EQ(Event::PUBLISH, event->get().type());
+    ASSERT_EQ(Event::PUBLISH_RESOURCES, event->get().type());
 
     Call call;
     call.set_type(Call::UPDATE_PUBLISH_STATUS);
     call.mutable_resource_provider_id()->CopyFrom(resourceProviderId.get());
 
     Call::UpdatePublishStatus* update = call.mutable_update_publish_status();
-    update->set_uuid(event->get().publish().uuid());
+    update->set_uuid(event->get().publish_resources().uuid());
     update->set_status(Call::UpdatePublishStatus::OK);
 
     http::Request request;
@@ -565,9 +565,9 @@ TEST_P(ResourceProviderManagerHttpApiTest, PublishSuccess)
 
 
 // This test verifies that the pending future returned by
-// `ResourceProviderManager::publish()` becomes failed when the manager
+// `ResourceProviderManager::publishResources()` becomes failed when the 
manager
 // receives an publish status update with a `FAILED` status.
-TEST_P(ResourceProviderManagerHttpApiTest, PublishFailure)
+TEST_P(ResourceProviderManagerHttpApiTest, PublishResourcesFailure)
 {
   const ContentType contentType = GetParam();
 
@@ -636,19 +636,19 @@ TEST_P(ResourceProviderManagerHttpApiTest, PublishFailure)
       resource.mutable_provider_id()->CopyFrom(resourceProviderId.get());
     }
 
-    Future<Nothing> published = manager.publish(devolve(resources));
+    Future<Nothing> published = manager.publishResources(devolve(resources));
 
     Future<Result<Event>> event = responseDecoder->read();
     AWAIT_READY(event);
     ASSERT_SOME(event.get());
-    ASSERT_EQ(Event::PUBLISH, event->get().type());
+    ASSERT_EQ(Event::PUBLISH_RESOURCES, event->get().type());
 
     Call call;
     call.set_type(Call::UPDATE_PUBLISH_STATUS);
     call.mutable_resource_provider_id()->CopyFrom(resourceProviderId.get());
 
     Call::UpdatePublishStatus* update = call.mutable_update_publish_status();
-    update->set_uuid(event->get().publish().uuid());
+    update->set_uuid(event->get().publish_resources().uuid());
     update->set_status(Call::UpdatePublishStatus::FAILED);
 
     http::Request request;
@@ -670,9 +670,9 @@ TEST_P(ResourceProviderManagerHttpApiTest, PublishFailure)
 
 
 // This test verifies that the pending future returned by
-// `ResourceProviderManager::publish()` becomes failed when the resource
-// provider is disconnected.
-TEST_P(ResourceProviderManagerHttpApiTest, PublishDisconnected)
+// `ResourceProviderManager::publishResources()` becomes failed when the
+// resource provider is disconnected.
+TEST_P(ResourceProviderManagerHttpApiTest, PublishResourcesDisconnected)
 {
   const ContentType contentType = GetParam();
 
@@ -727,7 +727,7 @@ TEST_P(ResourceProviderManagerHttpApiTest, 
PublishDisconnected)
     EXPECT_FALSE(resourceProviderId->value().empty());
   }
 
-  // Then, close the connection after receiving a publish event.
+  // Then, close the connection after receiving a publish resources event.
   {
     vector<v1::Resource> resources =
       v1::Resources::fromString("disk:4").get();
@@ -735,12 +735,12 @@ TEST_P(ResourceProviderManagerHttpApiTest, 
PublishDisconnected)
       resource.mutable_provider_id()->CopyFrom(resourceProviderId.get());
     }
 
-    Future<Nothing> published = manager.publish(devolve(resources));
+    Future<Nothing> published = manager.publishResources(devolve(resources));
 
     Future<Result<Event>> event = responseDecoder->read();
     AWAIT_READY(event);
     ASSERT_SOME(event.get());
-    ASSERT_EQ(Event::PUBLISH, event->get().type());
+    ASSERT_EQ(Event::PUBLISH_RESOURCES, event->get().type());
 
     reader->close();
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2975d7e6/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 6640620..8739f0b 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -8883,11 +8883,11 @@ TEST_F(SlaveTest, ResourceProviderPublishAll)
     AWAIT_READY(offers);
     ASSERT_FALSE(offers->empty());
 
-    Future<mesos::v1::resource_provider::Event::Publish> publish;
+    Future<mesos::v1::resource_provider::Event::PublishResources> publish;
 
-    // Two PUBLISH events will be received: one for launching the
+    // Two PUBLISH_RESOURCES events will be received: one for launching the
     // executor, and the other for launching the task.
-    EXPECT_CALL(resourceProvider, publish(_))
+    EXPECT_CALL(resourceProvider, publishResources(_))
       .WillOnce(
           Invoke(&resourceProvider,
                  &v1::MockResourceProvider::publishDefault))

Reply via email to