You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ka...@apache.org on 2016/04/18 14:22:31 UTC

[11/11] mesos git commit: Moved mesos::internal::state to mesos::state namespace.

Moved mesos::internal::state to mesos::state namespace.

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


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

Branch: refs/heads/master
Commit: 2986b64cf7bfadec20cdd9a2ad16233f02b72b18
Parents: de134b2
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Wed Apr 13 15:59:44 2016 -0400
Committer: Kapil Arya <ka...@mesosphere.io>
Committed: Sun Apr 17 23:38:26 2016 -0400

----------------------------------------------------------------------
 include/mesos/state/in_memory.hpp               | 13 +++--
 include/mesos/state/leveldb.hpp                 | 13 +++--
 include/mesos/state/log.hpp                     | 13 +++--
 include/mesos/state/protobuf.hpp                | 25 ++++-----
 include/mesos/state/state.hpp                   | 18 +++---
 include/mesos/state/storage.hpp                 | 12 ++--
 include/mesos/state/zookeeper.hpp               | 13 +++--
 .../org_apache_mesos_state_AbstractState.cpp    |  2 +-
 .../jni/org_apache_mesos_state_LevelDBState.cpp |  2 +-
 .../jni/org_apache_mesos_state_LogState.cpp     |  2 +-
 .../jni/org_apache_mesos_state_Variable.cpp     |  2 +-
 .../org_apache_mesos_state_ZooKeeperState.cpp   |  2 +-
 src/local/local.cpp                             | 10 ++--
 src/master/main.cpp                             | 13 +++--
 src/master/registrar.cpp                        |  4 +-
 src/master/registrar.hpp                        |  2 +-
 src/state/in_memory.cpp                         |  4 +-
 src/state/leveldb.cpp                           |  4 +-
 src/state/log.cpp                               | 59 ++++++++++----------
 src/state/zookeeper.cpp                         |  4 +-
 src/tests/cluster.cpp                           |  6 +-
 src/tests/cluster.hpp                           |  4 +-
 src/tests/registrar_tests.cpp                   |  8 +--
 src/tests/state_tests.cpp                       | 31 +++++-----
 24 files changed, 140 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/include/mesos/state/in_memory.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/in_memory.hpp b/include/mesos/state/in_memory.hpp
index 8ab175b..2032742 100644
--- a/include/mesos/state/in_memory.hpp
+++ b/include/mesos/state/in_memory.hpp
@@ -28,23 +28,25 @@
 #include <stout/uuid.hpp>
 
 namespace mesos {
-namespace internal {
 namespace state {
 
 // Forward declaration.
 class InMemoryStorageProcess;
 
 
-class InMemoryStorage : public Storage
+class InMemoryStorage : public mesos::state::Storage
 {
 public:
   InMemoryStorage();
   virtual ~InMemoryStorage();
 
   // Storage implementation.
-  virtual process::Future<Option<Entry>> get(const std::string& name);
-  virtual process::Future<bool> set(const Entry& entry, const UUID& uuid);
-  virtual process::Future<bool> expunge(const Entry& entry);
+  virtual process::Future<Option<internal::state::Entry>> get(
+      const std::string& name);
+  virtual process::Future<bool> set(
+      const internal::state::Entry& entry,
+      const UUID& uuid);
+  virtual process::Future<bool> expunge(const internal::state::Entry& entry);
   virtual process::Future<std::set<std::string>> names();
 
 private:
@@ -52,7 +54,6 @@ private:
 };
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {
 
 #endif // __MESOS_STATE_IN_MEMORY_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/include/mesos/state/leveldb.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/leveldb.hpp b/include/mesos/state/leveldb.hpp
index 306c84f..6c732d3 100644
--- a/include/mesos/state/leveldb.hpp
+++ b/include/mesos/state/leveldb.hpp
@@ -29,23 +29,25 @@
 #include <stout/uuid.hpp>
 
 namespace mesos {
-namespace internal {
 namespace state {
 
 // More forward declarations.
 class LevelDBStorageProcess;
 
 
-class LevelDBStorage : public Storage
+class LevelDBStorage : public mesos::state::Storage
 {
 public:
   explicit LevelDBStorage(const std::string& path);
   virtual ~LevelDBStorage();
 
   // Storage implementation.
-  virtual process::Future<Option<Entry>> get(const std::string& name);
-  virtual process::Future<bool> set(const Entry& entry, const UUID& uuid);
-  virtual process::Future<bool> expunge(const Entry& entry);
+  virtual process::Future<Option<internal::state::Entry>> get(
+      const std::string& name);
+  virtual process::Future<bool> set(
+      const internal::state::Entry& entry,
+      const UUID& uuid);
+  virtual process::Future<bool> expunge(const internal::state::Entry& entry);
   virtual process::Future<std::set<std::string>> names();
 
 private:
@@ -53,7 +55,6 @@ private:
 };
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {
 
 #endif // __MESOS_STATE_LEVELDB_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/include/mesos/state/log.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/log.hpp b/include/mesos/state/log.hpp
index c4fbe38..ac0312f 100644
--- a/include/mesos/state/log.hpp
+++ b/include/mesos/state/log.hpp
@@ -30,14 +30,13 @@
 #include <stout/uuid.hpp>
 
 namespace mesos {
-namespace internal {
 namespace state {
 
 // Forward declarations.
 class LogStorageProcess;
 
 
-class LogStorage : public Storage
+class LogStorage : public mesos::state::Storage
 {
 public:
   LogStorage(mesos::log::Log* log, size_t diffsBetweenSnapshots = 0);
@@ -45,9 +44,12 @@ public:
   virtual ~LogStorage();
 
   // Storage implementation.
-  virtual process::Future<Option<Entry>> get(const std::string& name);
-  virtual process::Future<bool> set(const Entry& entry, const UUID& uuid);
-  virtual process::Future<bool> expunge(const Entry& entry);
+  virtual process::Future<Option<internal::state::Entry>> get(
+      const std::string& name);
+  virtual process::Future<bool> set(
+      const internal::state::Entry& entry,
+      const UUID& uuid);
+  virtual process::Future<bool> expunge(const internal::state::Entry& entry);
   virtual process::Future<std::set<std::string>> names();
 
 private:
@@ -55,7 +57,6 @@ private:
 };
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {
 
 #endif // __MESOS_STATE_LOG_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/include/mesos/state/protobuf.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/protobuf.hpp b/include/mesos/state/protobuf.hpp
index 453a971..cde7b77 100644
--- a/include/mesos/state/protobuf.hpp
+++ b/include/mesos/state/protobuf.hpp
@@ -33,7 +33,6 @@
 #include "messages/messages.hpp"
 
 namespace mesos {
-namespace internal {
 namespace state {
 namespace protobuf {
 
@@ -59,19 +58,20 @@ public:
 private:
   friend class State; // Creates and manages variables.
 
-  Variable(const state::Variable& _variable, const T& _t)
+  Variable(const mesos::state::Variable& _variable, const T& _t)
     : variable(_variable), t(_t)
   {}
 
-  state::Variable variable; // Not const to keep Variable assignable.
+  mesos::state::Variable variable; // Not const to keep Variable assignable.
   T t;
 };
 
 
-class State : public state::State
+class State : public mesos::state::State
 {
 public:
-  explicit State(Storage* storage) : state::State(storage) {}
+  explicit State(mesos::state::Storage* storage)
+    : mesos::state::State(storage) {}
   virtual ~State() {}
 
   // Returns a variable from the state, creating a new one if one
@@ -95,26 +95,26 @@ private:
   // constructor.
   template <typename T>
   static process::Future<Variable<T>> _fetch(
-      const state::Variable& option);
+      const mesos::state::Variable& option);
 
   template <typename T>
   static process::Future<Option<Variable<T>>> _store(
       const T& t,
-      const Option<state::Variable>& variable);
+      const Option<mesos::state::Variable>& variable);
 };
 
 
 template <typename T>
 process::Future<Variable<T>> State::fetch(const std::string& name)
 {
-  return state::State::fetch(name)
+  return mesos::state::State::fetch(name)
     .then(lambda::bind(&State::template _fetch<T>, lambda::_1));
 }
 
 
 template <typename T>
 process::Future<Variable<T>> State::_fetch(
-    const state::Variable& variable)
+    const mesos::state::Variable& variable)
 {
   Try<T> t = messages::deserialize<T>(variable.value());
   if (t.isError()) {
@@ -135,7 +135,7 @@ process::Future<Option<Variable<T>>> State::store(
     return process::Failure(value.error());
   }
 
-  return state::State::store(variable.variable.mutate(value.get()))
+  return mesos::state::State::store(variable.variable.mutate(value.get()))
     .then(lambda::bind(&State::template _store<T>, variable.t, lambda::_1));
 }
 
@@ -143,7 +143,7 @@ process::Future<Option<Variable<T>>> State::store(
 template <typename T>
 process::Future<Option<Variable<T>>> State::_store(
     const T& t,
-    const Option<state::Variable>& variable)
+    const Option<mesos::state::Variable>& variable)
 {
   if (variable.isSome()) {
     return Some(Variable<T>(variable.get(), t));
@@ -156,12 +156,11 @@ process::Future<Option<Variable<T>>> State::_store(
 template <typename T>
 process::Future<bool> State::expunge(const Variable<T>& variable)
 {
-  return state::State::expunge(variable.variable);
+  return mesos::state::State::expunge(variable.variable);
 }
 
 } // namespace protobuf {
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {
 
 #endif // __MESOS_STATE_PROTOBUF_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/include/mesos/state/state.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/state.hpp b/include/mesos/state/state.hpp
index 3f54207..f2fddee 100644
--- a/include/mesos/state/state.hpp
+++ b/include/mesos/state/state.hpp
@@ -33,7 +33,6 @@
 #include <stout/uuid.hpp>
 
 namespace mesos {
-namespace internal {
 namespace state {
 
 // An abstraction of "state" (possibly between multiple distributed
@@ -80,11 +79,11 @@ public:
 private:
   friend class State; // Creates and manages variables.
 
-  explicit Variable(const Entry& _entry)
+  explicit Variable(const internal::state::Entry& _entry)
     : entry(_entry)
   {}
 
-  Entry entry; // Not const to keep Variable assignable.
+  internal::state::Entry entry; // Not const to keep Variable assignable.
 };
 
 
@@ -115,10 +114,10 @@ private:
   // constructor.
   static process::Future<Variable> _fetch(
       const std::string& name,
-      const Option<Entry>& option);
+      const Option<internal::state::Entry>& option);
 
   static process::Future<Option<Variable>> _store(
-      const Entry& entry,
+      const internal::state::Entry& entry,
       const bool& b); // TODO(benh): Remove 'const &' after fixing libprocess.
 
   Storage* storage;
@@ -134,7 +133,7 @@ inline process::Future<Variable> State::fetch(const std::string& name)
 
 inline process::Future<Variable> State::_fetch(
     const std::string& name,
-    const Option<Entry>& option)
+    const Option<internal::state::Entry>& option)
 {
   if (option.isSome()) {
     return Variable(option.get());
@@ -142,7 +141,7 @@ inline process::Future<Variable> State::_fetch(
 
   // Otherwise, construct a Variable with a new Entry (with a random
   // UUID and no value to start).
-  Entry entry;
+  internal::state::Entry entry;
   entry.set_name(name);
   entry.set_uuid(UUID::random().toBytes());
 
@@ -157,7 +156,7 @@ inline process::Future<Option<Variable>> State::store(const Variable& variable)
 
   // Create a new entry to replace the existing entry provided the
   // UUID matches.
-  Entry entry;
+  internal::state::Entry entry;
   entry.set_name(variable.entry.name());
   entry.set_uuid(UUID::random().toBytes());
   entry.set_value(variable.entry.value());
@@ -168,7 +167,7 @@ inline process::Future<Option<Variable>> State::store(const Variable& variable)
 
 
 inline process::Future<Option<Variable>> State::_store(
-    const Entry& entry,
+    const internal::state::Entry& entry,
     const bool& b) // TODO(benh): Remove 'const &' after fixing libprocess.
 {
   if (b) {
@@ -191,7 +190,6 @@ inline process::Future<std::set<std::string>> State::names()
 }
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {
 
 #endif // __MESOS_STATE_STATE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/include/mesos/state/storage.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/storage.hpp b/include/mesos/state/storage.hpp
index d6f873a..2bfa047 100644
--- a/include/mesos/state/storage.hpp
+++ b/include/mesos/state/storage.hpp
@@ -28,7 +28,6 @@
 #include <stout/uuid.hpp>
 
 namespace mesos {
-namespace internal {
 namespace state {
 
 class Storage
@@ -41,18 +40,21 @@ public:
   // implementations to be agnostic of Variable. Note that set acts
   // like a "test-and-set" by requiring the existing entry to have the
   // specified UUID.
-  virtual process::Future<Option<Entry>> get(const std::string& name) = 0;
-  virtual process::Future<bool> set(const Entry& entry, const UUID& uuid) = 0;
+  virtual process::Future<Option<internal::state::Entry>> get(
+      const std::string& name) = 0;
+  virtual process::Future<bool> set(
+      const internal::state::Entry& entry,
+      const UUID& uuid) = 0;
 
   // Returns true if successfully expunged the variable from the state.
-  virtual process::Future<bool> expunge(const Entry& entry) = 0;
+  virtual process::Future<bool> expunge(
+      const internal::state::Entry& entry) = 0;
 
   // Returns the collection of variable names in the state.
   virtual process::Future<std::set<std::string>> names() = 0;
 };
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {
 
 #endif // __MESOS_STATE_STORAGE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/include/mesos/state/zookeeper.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/zookeeper.hpp b/include/mesos/state/zookeeper.hpp
index 6b36ed5..8d8c19c 100644
--- a/include/mesos/state/zookeeper.hpp
+++ b/include/mesos/state/zookeeper.hpp
@@ -31,14 +31,13 @@
 #include <stout/uuid.hpp>
 
 namespace mesos {
-namespace internal {
 namespace state {
 
 // Forward declarations.
 class ZooKeeperStorageProcess;
 
 
-class ZooKeeperStorage : public Storage
+class ZooKeeperStorage : public mesos::state::Storage
 {
 public:
   // TODO(benh): Just take a zookeeper::URL.
@@ -50,9 +49,12 @@ public:
   virtual ~ZooKeeperStorage();
 
   // Storage implementation.
-  virtual process::Future<Option<Entry>> get(const std::string& name);
-  virtual process::Future<bool> set(const Entry& entry, const UUID& uuid);
-  virtual process::Future<bool> expunge(const Entry& entry);
+  virtual process::Future<Option<internal::state::Entry>> get(
+      const std::string& name);
+  virtual process::Future<bool> set(
+      const internal::state::Entry& entry,
+      const UUID& uuid);
+  virtual process::Future<bool> expunge(const internal::state::Entry& entry);
   virtual process::Future<std::set<std::string>> names();
 
 private:
@@ -61,7 +63,6 @@ private:
 
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {
 
 #endif // __MESOS_STATE_ZOOKEEPER_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/java/jni/org_apache_mesos_state_AbstractState.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_AbstractState.cpp b/src/java/jni/org_apache_mesos_state_AbstractState.cpp
index d08ed0f..2ab748f 100644
--- a/src/java/jni/org_apache_mesos_state_AbstractState.cpp
+++ b/src/java/jni/org_apache_mesos_state_AbstractState.cpp
@@ -30,7 +30,7 @@
 #include "construct.hpp"
 #include "convert.hpp"
 
-using namespace mesos::internal::state;
+using namespace mesos::state;
 
 using process::Future;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/java/jni/org_apache_mesos_state_LevelDBState.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_LevelDBState.cpp b/src/java/jni/org_apache_mesos_state_LevelDBState.cpp
index 7a1a422..704367f 100644
--- a/src/java/jni/org_apache_mesos_state_LevelDBState.cpp
+++ b/src/java/jni/org_apache_mesos_state_LevelDBState.cpp
@@ -24,7 +24,7 @@
 #include "construct.hpp"
 #include "convert.hpp"
 
-using namespace mesos::internal::state;
+using namespace mesos::state;
 
 using std::string;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/java/jni/org_apache_mesos_state_LogState.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_LogState.cpp b/src/java/jni/org_apache_mesos_state_LogState.cpp
index 87790fe..1a60b87 100644
--- a/src/java/jni/org_apache_mesos_state_LogState.cpp
+++ b/src/java/jni/org_apache_mesos_state_LogState.cpp
@@ -30,7 +30,7 @@
 
 using namespace mesos;
 
-using namespace mesos::internal::state;
+using namespace mesos::state;
 
 using std::string;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/java/jni/org_apache_mesos_state_Variable.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_Variable.cpp b/src/java/jni/org_apache_mesos_state_Variable.cpp
index 197a5c4..5a3805f 100644
--- a/src/java/jni/org_apache_mesos_state_Variable.cpp
+++ b/src/java/jni/org_apache_mesos_state_Variable.cpp
@@ -20,7 +20,7 @@
 
 #include <mesos/state/state.hpp>
 
-using namespace mesos::internal::state;
+using mesos::state::Variable;
 
 extern "C" {
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp b/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
index 3d1ceca..857300b 100644
--- a/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
+++ b/src/java/jni/org_apache_mesos_state_ZooKeeperState.cpp
@@ -26,7 +26,7 @@
 #include "construct.hpp"
 #include "convert.hpp"
 
-using namespace mesos::internal::state;
+using namespace mesos::state;
 
 using std::string;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index 2487c73..c800f78 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -126,8 +126,8 @@ namespace local {
 
 static Allocator* allocator = NULL;
 static Log* log = NULL;
-static state::Storage* storage = NULL;
-static state::protobuf::State* state = NULL;
+static mesos::state::Storage* storage = NULL;
+static mesos::state::protobuf::State* state = NULL;
 static Registrar* registrar = NULL;
 static Repairer* repairer = NULL;
 static Master* master = NULL;
@@ -195,7 +195,7 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
           << "Cannot use '--registry_strict' when using in-memory storage"
           << " based registry";
       }
-      storage = new state::InMemoryStorage();
+      storage = new mesos::state::InMemoryStorage();
     } else if (flags.registry == "replicated_log") {
       // For local runs, we use a temporary work directory.
       if (flags.work_dir.isNone()) {
@@ -212,7 +212,7 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
           path::join(flags.work_dir.get(), "replicated_log"),
           set<UPID>(),
           flags.log_auto_initialize);
-      storage = new state::LogStorage(log);
+      storage = new mesos::state::LogStorage(log);
     } else {
       EXIT(EXIT_FAILURE)
         << "'" << flags.registry << "' is not a supported"
@@ -221,7 +221,7 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
 
     CHECK_NOTNULL(storage);
 
-    state = new state::protobuf::State(storage);
+    state = new mesos::state::protobuf::State(storage);
     registrar =
       new Registrar(flags, state, master::DEFAULT_HTTP_AUTHENTICATION_REALM);
     repairer = new Repairer();

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 8b6e21a..2823c22 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -97,6 +97,10 @@ using mesos::master::detector::StandaloneMasterDetector;
 using mesos::modules::Anonymous;
 using mesos::modules::ModuleManager;
 
+using mesos::state::InMemoryStorage;
+using mesos::state::LogStorage;
+using mesos::state::Storage;
+
 using process::Owned;
 using process::RateLimiter;
 using process::UPID;
@@ -284,7 +288,7 @@ int main(int argc, char** argv)
   CHECK_NOTNULL(allocator.get());
   LOG(INFO) << "Using '" << allocatorName << "' allocator";
 
-  state::Storage* storage = NULL;
+  Storage* storage = NULL;
   Log* log = NULL;
 
   if (flags.registry == "in_memory") {
@@ -293,7 +297,7 @@ int main(int argc, char** argv)
         << "Cannot use '--registry_strict' when using in-memory storage"
         << " based registry";
     }
-    storage = new state::InMemoryStorage();
+    storage = new InMemoryStorage();
   } else if (flags.registry == "replicated_log" ||
              flags.registry == "log_storage") {
     // TODO(bmahler): "log_storage" is present for backwards
@@ -339,7 +343,7 @@ int main(int argc, char** argv)
           set<UPID>(),
           flags.log_auto_initialize);
     }
-    storage = new state::LogStorage(log);
+    storage = new LogStorage(log);
   } else {
     EXIT(EXIT_FAILURE)
       << "'" << flags.registry << "' is not a supported"
@@ -348,7 +352,8 @@ int main(int argc, char** argv)
 
   CHECK_NOTNULL(storage);
 
-  state::protobuf::State* state = new state::protobuf::State(storage);
+  mesos::state::protobuf::State* state =
+    new mesos::state::protobuf::State(storage);
   Registrar* registrar =
     new Registrar(flags, state, DEFAULT_HTTP_AUTHENTICATION_REALM);
   Repairer* repairer = new Repairer();

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/master/registrar.cpp
----------------------------------------------------------------------
diff --git a/src/master/registrar.cpp b/src/master/registrar.cpp
index d337552..a509f45 100644
--- a/src/master/registrar.cpp
+++ b/src/master/registrar.cpp
@@ -44,8 +44,8 @@
 #include "master/registrar.hpp"
 #include "master/registry.hpp"
 
-using mesos::internal::state::protobuf::State;
-using mesos::internal::state::protobuf::Variable;
+using mesos::state::protobuf::State;
+using mesos::state::protobuf::Variable;
 
 using process::dispatch;
 using process::spawn;

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/master/registrar.hpp
----------------------------------------------------------------------
diff --git a/src/master/registrar.hpp b/src/master/registrar.hpp
index a388c42..c39dd1b 100644
--- a/src/master/registrar.hpp
+++ b/src/master/registrar.hpp
@@ -104,7 +104,7 @@ public:
   // If flags.registry_strict is true, all operations will be
   // permitted.
   Registrar(const Flags& flags,
-            state::protobuf::State* state,
+            mesos::state::protobuf::State* state,
             const Option<std::string>& authenticationRealm = None());
   ~Registrar();
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/state/in_memory.cpp
----------------------------------------------------------------------
diff --git a/src/state/in_memory.cpp b/src/state/in_memory.cpp
index 78c287d..c50f46d 100644
--- a/src/state/in_memory.cpp
+++ b/src/state/in_memory.cpp
@@ -34,8 +34,9 @@ using namespace process;
 // 'std::' to disambiguate the 'set' member.
 using std::string;
 
+using mesos::internal::state::Entry;
+
 namespace mesos {
-namespace internal {
 namespace state {
 
 
@@ -126,5 +127,4 @@ Future<std::set<string>> InMemoryStorage::names()
 }
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/state/leveldb.cpp
----------------------------------------------------------------------
diff --git a/src/state/leveldb.cpp b/src/state/leveldb.cpp
index 8b84251..60c18dd 100644
--- a/src/state/leveldb.cpp
+++ b/src/state/leveldb.cpp
@@ -45,8 +45,9 @@ using namespace process;
 // 'std::' to disambiguate the 'set' member.
 using std::string;
 
+using mesos::internal::state::Entry;
+
 namespace mesos {
-namespace internal {
 namespace state {
 
 
@@ -308,5 +309,4 @@ Future<std::set<string>> LevelDBStorage::names()
 }
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/state/log.cpp
----------------------------------------------------------------------
diff --git a/src/state/log.cpp b/src/state/log.cpp
index 9e7005c..ab0c143 100644
--- a/src/state/log.cpp
+++ b/src/state/log.cpp
@@ -45,6 +45,8 @@
 #include <stout/svn.hpp>
 #include <stout/uuid.hpp>
 
+#include "messages/state.hpp"
+
 using namespace mesos::log;
 
 using namespace mesos::internal::log;
@@ -56,8 +58,10 @@ using namespace process;
 using std::list;
 using std::string;
 
+using mesos::internal::state::Entry;
+using mesos::internal::state::Operation;
+
 namespace mesos {
-namespace internal {
 namespace state {
 
 // A storage implementation for State that uses the replicated
@@ -84,9 +88,9 @@ public:
   virtual ~LogStorageProcess();
 
   // Storage implementation.
-  Future<Option<state::Entry>> get(const string& name);
-  Future<bool> set(const state::Entry& entry, const UUID& uuid);
-  Future<bool> expunge(const state::Entry& entry);
+  Future<Option<Entry>> get(const string& name);
+  Future<bool> set(const Entry& entry, const UUID& uuid);
+  Future<bool> expunge(const Entry& entry);
   Future<std::set<string>> names();
 
 protected:
@@ -110,19 +114,19 @@ private:
       const Option<Log::Position>& position);
 
   // Continuations.
-  Future<Option<state::Entry>> _get(const string& name);
+  Future<Option<Entry>> _get(const string& name);
 
-  Future<bool> _set(const state::Entry& entry, const UUID& uuid);
-  Future<bool> __set(const state::Entry& entry, const UUID& uuid);
+  Future<bool> _set(const Entry& entry, const UUID& uuid);
+  Future<bool> __set(const Entry& entry, const UUID& uuid);
   Future<bool> ___set(
-      const state::Entry& entry,
+      const Entry& entry,
       size_t diff,
       Option<Log::Position> position);
 
-  Future<bool> _expunge(const state::Entry& entry);
-  Future<bool> __expunge(const state::Entry& entry);
+  Future<bool> _expunge(const Entry& entry);
+  Future<bool> __expunge(const Entry& entry);
   Future<bool> ___expunge(
-      const state::Entry& entry,
+      const Entry& entry,
       const Option<Log::Position>& position);
 
   Future<std::set<string>> _names();
@@ -151,7 +155,7 @@ private:
   struct Snapshot
   {
     Snapshot(const Log::Position& position,
-             const state::Entry& entry,
+             const Entry& entry,
              size_t diffs = 0)
       : position(position),
         entry(entry),
@@ -183,10 +187,10 @@ private:
     // the snapshot, not the last DIFF record in the log.
     const Log::Position position;
 
-    // TODO(benh): Rather than storing the entire state::Entry we
+    // TODO(benh): Rather than storing the entire Entry we
     // should just store the position, name, and UUID and cache the
     // data so we don't use too much memory.
-    const state::Entry entry;
+    const Entry entry;
 
     // This value represents the number of Operation::DIFFs in the
     // underlying log that make up this "snapshot". If this snapshot
@@ -434,14 +438,14 @@ Future<Nothing> LogStorageProcess::__truncate(
 }
 
 
-Future<Option<state::Entry>> LogStorageProcess::get(const string& name)
+Future<Option<Entry>> LogStorageProcess::get(const string& name)
 {
   return start()
     .then(defer(self(), &Self::_get, name));
 }
 
 
-Future<Option<state::Entry>> LogStorageProcess::_get(const string& name)
+Future<Option<Entry>> LogStorageProcess::_get(const string& name)
 {
   Option<Snapshot> snapshot = snapshots.get(name);
 
@@ -454,7 +458,7 @@ Future<Option<state::Entry>> LogStorageProcess::_get(const string& name)
 
 
 Future<bool> LogStorageProcess::set(
-    const state::Entry& entry,
+    const Entry& entry,
     const UUID& uuid)
 {
   return mutex.lock()
@@ -464,7 +468,7 @@ Future<bool> LogStorageProcess::set(
 
 
 Future<bool> LogStorageProcess::_set(
-    const state::Entry& entry,
+    const Entry& entry,
     const UUID& uuid)
 {
   return start()
@@ -473,7 +477,7 @@ Future<bool> LogStorageProcess::_set(
 
 
 Future<bool> LogStorageProcess::__set(
-    const state::Entry& entry,
+    const Entry& entry,
     const UUID& uuid)
 {
   Option<Snapshot> snapshot = snapshots.get(entry.name());
@@ -544,7 +548,7 @@ Future<bool> LogStorageProcess::__set(
 
 
 Future<bool> LogStorageProcess::___set(
-    const state::Entry& entry,
+    const Entry& entry,
     size_t diffs,
     Option<Log::Position> position)
 {
@@ -576,7 +580,7 @@ Future<bool> LogStorageProcess::___set(
 }
 
 
-Future<bool> LogStorageProcess::expunge(const state::Entry& entry)
+Future<bool> LogStorageProcess::expunge(const Entry& entry)
 {
   return mutex.lock()
     .then(defer(self(), &Self::_expunge, entry))
@@ -584,14 +588,14 @@ Future<bool> LogStorageProcess::expunge(const state::Entry& entry)
 }
 
 
-Future<bool> LogStorageProcess::_expunge(const state::Entry& entry)
+Future<bool> LogStorageProcess::_expunge(const Entry& entry)
 {
   return start()
     .then(defer(self(), &Self::__expunge, entry));
 }
 
 
-Future<bool> LogStorageProcess::__expunge(const state::Entry& entry)
+Future<bool> LogStorageProcess::__expunge(const Entry& entry)
 {
   Option<Snapshot> snapshot = snapshots.get(entry.name());
 
@@ -621,7 +625,7 @@ Future<bool> LogStorageProcess::__expunge(const state::Entry& entry)
 
 
 Future<bool> LogStorageProcess::___expunge(
-    const state::Entry& entry,
+    const Entry& entry,
     const Option<Log::Position>& position)
 {
   if (position.isNone()) {
@@ -667,19 +671,19 @@ LogStorage::~LogStorage()
 }
 
 
-Future<Option<state::Entry>> LogStorage::get(const string& name)
+Future<Option<Entry>> LogStorage::get(const string& name)
 {
   return dispatch(process, &LogStorageProcess::get, name);
 }
 
 
-Future<bool> LogStorage::set(const state::Entry& entry, const UUID& uuid)
+Future<bool> LogStorage::set(const Entry& entry, const UUID& uuid)
 {
   return dispatch(process, &LogStorageProcess::set, entry, uuid);
 }
 
 
-Future<bool> LogStorage::expunge(const state::Entry& entry)
+Future<bool> LogStorage::expunge(const Entry& entry)
 {
   return dispatch(process, &LogStorageProcess::expunge, entry);
 }
@@ -691,5 +695,4 @@ Future<std::set<string>> LogStorage::names()
 }
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/state/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/state/zookeeper.cpp b/src/state/zookeeper.cpp
index c9ada9f..1596637 100644
--- a/src/state/zookeeper.cpp
+++ b/src/state/zookeeper.cpp
@@ -54,10 +54,11 @@ using std::queue;
 using std::string;
 using std::vector;
 
+using mesos::internal::state::Entry;
+
 using zookeeper::Authentication;
 
 namespace mesos {
-namespace internal {
 namespace state {
 
 
@@ -666,5 +667,4 @@ Future<std::set<string>> ZooKeeperStorage::names()
 }
 
 } // namespace state {
-} // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/tests/cluster.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cluster.cpp b/src/tests/cluster.cpp
index 040112e..3e5fdf6 100644
--- a/src/tests/cluster.cpp
+++ b/src/tests/cluster.cpp
@@ -213,16 +213,16 @@ Try<process::Owned<Master>> Master::start(
 
   // Create the registry's storage backend.
   if (flags.registry == "in_memory") {
-    master->storage.reset(new state::InMemoryStorage());
+    master->storage.reset(new mesos::state::InMemoryStorage());
   } else if (flags.registry == "replicated_log") {
-    master->storage.reset(new state::LogStorage(master->log.get()));
+    master->storage.reset(new mesos::state::LogStorage(master->log.get()));
   } else {
     return Error(
         "Unsupported option for registry persistence: " + flags.registry);
   }
 
   // Instantiate some other master dependencies.
-  master->state.reset(new state::protobuf::State(master->storage.get()));
+  master->state.reset(new mesos::state::protobuf::State(master->storage.get()));
   master->registrar.reset(new master::Registrar(
       flags, master->state.get(), master::DEFAULT_HTTP_AUTHENTICATION_REALM));
   master->repairer.reset(new master::Repairer());

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/tests/cluster.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cluster.hpp b/src/tests/cluster.hpp
index ce03a17..96ec52a 100644
--- a/src/tests/cluster.hpp
+++ b/src/tests/cluster.hpp
@@ -115,8 +115,8 @@ private:
   process::Owned<mesos::master::contender::MasterContender> contender;
   process::Owned<mesos::master::detector::MasterDetector> detector;
   process::Owned<mesos::log::Log> log;
-  process::Owned<state::Storage> storage;
-  process::Owned<state::protobuf::State> state;
+  process::Owned<mesos::state::Storage> storage;
+  process::Owned<mesos::state::protobuf::State> state;
   process::Owned<master::Registrar> registrar;
   process::Owned<master::Repairer> repairer;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/tests/registrar_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/registrar_tests.cpp b/src/tests/registrar_tests.cpp
index 534dec7..f707a04 100644
--- a/src/tests/registrar_tests.cpp
+++ b/src/tests/registrar_tests.cpp
@@ -113,11 +113,11 @@ using namespace mesos::internal::master::weights;
 
 using mesos::http::authentication::BasicAuthenticatorFactory;
 
-using state::Entry;
-using state::LogStorage;
-using state::Storage;
+using mesos::state::LogStorage;
+using mesos::state::Storage;
+using mesos::state::protobuf::State;
 
-using state::protobuf::State;
+using state::Entry;
 
 
 static vector<WeightInfo> getWeightInfos(

http://git-wip-us.apache.org/repos/asf/mesos/blob/2986b64c/src/tests/state_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/state_tests.cpp b/src/tests/state_tests.cpp
index 461ac28..153fe07 100644
--- a/src/tests/state_tests.cpp
+++ b/src/tests/state_tests.cpp
@@ -51,6 +51,8 @@
 
 #include "master/registry.hpp"
 
+#include "messages/state.hpp"
+
 #ifdef MESOS_HAS_JAVA
 #include "tests/zookeeper.hpp"
 #endif
@@ -70,15 +72,16 @@ namespace mesos {
 namespace internal {
 namespace tests {
 
-using state::LevelDBStorage;
-using state::Operation;
-using state::Storage;
+using mesos::state::Storage;
+using mesos::state::LevelDBStorage;
 #ifdef MESOS_HAS_JAVA
-using state::ZooKeeperStorage;
+using mesos::state::ZooKeeperStorage;
 #endif
 
-using state::protobuf::State;
-using state::protobuf::Variable;
+using mesos::state::protobuf::State;
+using mesos::state::protobuf::Variable;
+
+using state::Operation;
 
 typedef mesos::internal::Registry::Slaves Slaves;
 typedef mesos::internal::Registry::Slave Slave;
@@ -334,7 +337,7 @@ public:
 protected:
   virtual void SetUp()
   {
-    storage = new state::InMemoryStorage();
+    storage = new mesos::state::InMemoryStorage();
     state = new State(storage);
   }
 
@@ -344,7 +347,7 @@ protected:
     delete storage;
   }
 
-  state::Storage* storage;
+  mesos::state::Storage* storage;
   State* state;
 };
 
@@ -406,7 +409,7 @@ protected:
     ASSERT_SOME(sandbox);
     path = sandbox.get() + "/.state";
 
-    storage = new state::LevelDBStorage(path);
+    storage = new mesos::state::LevelDBStorage(path);
     state = new State(storage);
   }
 
@@ -418,7 +421,7 @@ protected:
     TemporaryDirectoryTest::TearDown();
   }
 
-  state::Storage* storage;
+  mesos::state::Storage* storage;
   State* state;
 
 private:
@@ -502,7 +505,7 @@ protected:
     pids.insert(replica2->pid());
 
     log = new Log(2, path1, pids);
-    storage = new state::LogStorage(log, 1024);
+    storage = new mesos::state::LogStorage(log, 1024);
     state = new State(storage);
   }
 
@@ -517,7 +520,7 @@ protected:
     TemporaryDirectoryTest::TearDown();
   }
 
-  state::Storage* storage;
+  mesos::state::Storage* storage;
   State* state;
 
   Replica* replica2;
@@ -700,7 +703,7 @@ protected:
   virtual void SetUp()
   {
     ZooKeeperTest::SetUp();
-    storage = new state::ZooKeeperStorage(
+    storage = new mesos::state::ZooKeeperStorage(
         server->connectString(),
         NO_TIMEOUT,
         "/state/");
@@ -714,7 +717,7 @@ protected:
     ZooKeeperTest::TearDown();
   }
 
-  state::Storage* storage;
+  mesos::state::Storage* storage;
   State* state;
 };