You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 05:15:23 UTC

svn commit: r1131523 - in /incubator/mesos/trunk: include/nexus_types.h include/nexus_types.hpp src/master.cpp src/nexus_sched.cpp src/swig/java/TestFramework.java

Author: benh
Date: Sun Jun  5 03:15:22 2011
New Revision: 1131523

URL: http://svn.apache.org/viewvc?rev=1131523&view=rev
Log:
Offer ID changed to strings (preparation for prefixing with master id)

Modified:
    incubator/mesos/trunk/include/nexus_types.h
    incubator/mesos/trunk/include/nexus_types.hpp
    incubator/mesos/trunk/src/master.cpp
    incubator/mesos/trunk/src/nexus_sched.cpp
    incubator/mesos/trunk/src/swig/java/TestFramework.java

Modified: incubator/mesos/trunk/include/nexus_types.h
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/include/nexus_types.h?rev=1131523&r1=1131522&r2=1131523&view=diff
==============================================================================
--- incubator/mesos/trunk/include/nexus_types.h (original)
+++ incubator/mesos/trunk/include/nexus_types.h Sun Jun  5 03:15:22 2011
@@ -6,7 +6,7 @@
 typedef int32_t framework_id;
 typedef int32_t task_id;
 typedef const char *slave_id;
-typedef int64_t offer_id;
+typedef const char *offer_id;
 typedef int32_t nexus_handle;
 
 enum task_state {

Modified: incubator/mesos/trunk/include/nexus_types.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/include/nexus_types.hpp?rev=1131523&r1=1131522&r2=1131523&view=diff
==============================================================================
--- incubator/mesos/trunk/include/nexus_types.hpp (original)
+++ incubator/mesos/trunk/include/nexus_types.hpp Sun Jun  5 03:15:22 2011
@@ -11,7 +11,7 @@ namespace nexus {
 typedef framework_id FrameworkID; // Unique within master
 typedef task_id TaskID;           // Unique within framework
 typedef std::string SlaveID;         // Unique within master
-typedef offer_id OfferID;         // Unique within master
+typedef std::string OfferID;         // Unique within master
 typedef task_state TaskState;
 
 }

Modified: incubator/mesos/trunk/src/master.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master.cpp?rev=1131523&r1=1131522&r2=1131523&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master.cpp (original)
+++ incubator/mesos/trunk/src/master.cpp Sun Jun  5 03:15:22 2011
@@ -112,13 +112,13 @@ public:
 
 Master::Master(const bool ft, const string zk)
   : isFT(ft), zkserver(zk), leaderDetector(NULL), nextFrameworkId(0), nextSlaveId("0"), 
-    nextSlotOfferId(0), allocatorType("simple")
+    nextSlotOfferId("0"), allocatorType("simple")
 {}
 
 
 Master::Master(const string& _allocatorType, const bool ft, const string zk)
   : isFT(ft), zkserver(zk), leaderDetector(NULL), nextFrameworkId(0), nextSlaveId("0"), 
-    nextSlotOfferId(0), allocatorType(_allocatorType)
+    nextSlotOfferId("0"), allocatorType(_allocatorType)
 {}
                    
 
@@ -500,7 +500,13 @@ void Master::operator () ()
 OfferID Master::makeOffer(Framework *framework,
                           const vector<SlaveResources>& resources)
 {
-  OfferID oid = nextSlotOfferId++;
+  OfferID oid = nextSlotOfferId;
+
+  ostringstream ss;
+  ss<<(atoi(nextSlotOfferId.c_str()) + 1);
+  nextSlotOfferId = ss.str();
+
+
   SlotOffer *offer = new SlotOffer(oid, framework->id, resources);
   slotOffers[offer->id] = offer;
   framework->addOffer(offer);

Modified: incubator/mesos/trunk/src/nexus_sched.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/nexus_sched.cpp?rev=1131523&r1=1131522&r2=1131523&view=diff
==============================================================================
--- incubator/mesos/trunk/src/nexus_sched.cpp (original)
+++ incubator/mesos/trunk/src/nexus_sched.cpp Sun Jun  5 03:15:22 2011
@@ -510,13 +510,13 @@ public:
       c_offers[i] = offer;
     }
 
-    sched->slot_offer(sched, offerId, c_offers, offers.size());
+    sched->slot_offer(sched, offerId.c_str(), c_offers, offers.size());
     delete[] c_offers;
   }
 
   virtual void offerRescinded(SchedulerDriver*, OfferID offerId)
   {
-    sched->slot_offer_rescinded(sched, offerId);
+    sched->slot_offer_rescinded(sched, offerId.c_str());
   }
 
   virtual void statusUpdate(SchedulerDriver*, TaskStatus &status)

Modified: incubator/mesos/trunk/src/swig/java/TestFramework.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/swig/java/TestFramework.java?rev=1131523&r1=1131522&r2=1131523&view=diff
==============================================================================
--- incubator/mesos/trunk/src/swig/java/TestFramework.java (original)
+++ incubator/mesos/trunk/src/swig/java/TestFramework.java Sun Jun  5 03:15:22 2011
@@ -36,7 +36,7 @@ public class TestFramework {
 
     @Override
     public void resourceOffer(SchedulerDriver d,
-                              long oid,
+                              String oid,
                               SlaveOfferVector offers) {
       System.out.println("Got offer offer " + oid);
       TaskDescriptionVector tasks = new TaskDescriptionVector();