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 2015/01/08 20:59:32 UTC

[2/3] mesos git commit: Moved the raw path formatting strings into a .cpp file.

Moved the raw path formatting strings into a .cpp file.

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


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

Branch: refs/heads/master
Commit: 2eff8dd4b3a3d363021a0d3308188d6f23565dfb
Parents: d7cd051
Author: Benjamin Mahler <be...@gmail.com>
Authored: Wed Jan 7 12:18:49 2015 -0800
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Thu Jan 8 11:40:10 2015 -0800

----------------------------------------------------------------------
 src/Makefile.am     |   1 +
 src/slave/paths.cpp | 486 +++++++++++++++++++++++++++++++++++++++++++++++
 src/slave/paths.hpp | 437 ++++++++----------------------------------
 3 files changed, 563 insertions(+), 361 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2eff8dd4/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index f989a54..fc0c322 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -304,6 +304,7 @@ libmesos_no_3rdparty_la_SOURCES =					\
 	slave/http.cpp							\
 	slave/metrics.cpp						\
 	slave/monitor.cpp						\
+	slave/paths.cpp							\
 	slave/state.cpp							\
 	slave/slave.cpp							\
 	slave/containerizer/containerizer.cpp				\

http://git-wip-us.apache.org/repos/asf/mesos/blob/2eff8dd4/src/slave/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/paths.cpp b/src/slave/paths.cpp
new file mode 100644
index 0000000..edd8011
--- /dev/null
+++ b/src/slave/paths.cpp
@@ -0,0 +1,486 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <list>
+#include <string>
+
+#include <mesos/mesos.hpp>
+
+#include <stout/check.hpp>
+#include <stout/format.hpp>
+#include <stout/fs.hpp>
+#include <stout/nothing.hpp>
+#include <stout/os.hpp>
+#include <stout/try.hpp>
+
+#include "common/type_utils.hpp"
+
+#include "messages/messages.hpp"
+
+#include "slave/paths.hpp"
+
+using std::list;
+using std::string;
+
+namespace mesos {
+namespace internal {
+namespace slave {
+namespace paths {
+
+// TODO(bmahler): Replace these non-POD globals, per MESOS-1023.
+
+// File names.
+const string BOOT_ID_FILE = "boot_id";
+const string SLAVE_INFO_FILE = "slave.info";
+const string FRAMEWORK_PID_FILE = "framework.pid";
+const string FRAMEWORK_INFO_FILE = "framework.info";
+const string LIBPROCESS_PID_FILE = "libprocess.pid";
+const string EXECUTOR_INFO_FILE = "executor.info";
+const string EXECUTOR_SENTINEL_FILE = "executor.sentinel";
+const string FORKED_PID_FILE = "forked.pid";
+const string TASK_INFO_FILE = "task.info";
+const string TASK_UPDATES_FILE = "task.updates";
+const string RESOURCES_INFO_FILE = "resources.info";
+
+// Path layout templates.
+const string ROOT_PATH = "%s";
+const string LATEST_SLAVE_PATH =
+  path::join(ROOT_PATH, "slaves", LATEST_SYMLINK);
+const string SLAVE_PATH =
+  path::join(ROOT_PATH, "slaves", "%s");
+const string BOOT_ID_PATH =
+  path::join(ROOT_PATH, BOOT_ID_FILE);
+const string SLAVE_INFO_PATH =
+  path::join(SLAVE_PATH, SLAVE_INFO_FILE);
+const string FRAMEWORK_PATH =
+  path::join(SLAVE_PATH, "frameworks", "%s");
+const string FRAMEWORK_PID_PATH =
+  path::join(FRAMEWORK_PATH, FRAMEWORK_PID_FILE);
+const string FRAMEWORK_INFO_PATH =
+  path::join(FRAMEWORK_PATH, FRAMEWORK_INFO_FILE);
+const string EXECUTOR_PATH =
+  path::join(FRAMEWORK_PATH, "executors", "%s");
+const string EXECUTOR_INFO_PATH =
+  path::join(EXECUTOR_PATH, EXECUTOR_INFO_FILE);
+const string EXECUTOR_RUN_PATH =
+  path::join(EXECUTOR_PATH, "runs", "%s");
+const string EXECUTOR_SENTINEL_PATH =
+  path::join(EXECUTOR_RUN_PATH, EXECUTOR_SENTINEL_FILE);
+const string EXECUTOR_LATEST_RUN_PATH =
+  path::join(EXECUTOR_PATH, "runs", LATEST_SYMLINK);
+const string PIDS_PATH =
+  path::join(EXECUTOR_RUN_PATH, "pids");
+const string LIBPROCESS_PID_PATH =
+  path::join(PIDS_PATH, LIBPROCESS_PID_FILE);
+const string FORKED_PID_PATH =
+  path::join(PIDS_PATH, FORKED_PID_FILE);
+const string TASK_PATH =
+  path::join(EXECUTOR_RUN_PATH, "tasks", "%s");
+const string TASK_INFO_PATH =
+  path::join(TASK_PATH, TASK_INFO_FILE);
+const string TASK_UPDATES_PATH =
+  path::join(TASK_PATH, TASK_UPDATES_FILE);
+const string RESOURCES_INFO_PATH =
+  path::join(ROOT_PATH, "resources", RESOURCES_INFO_FILE);
+
+
+string getMetaRootDir(const string& rootDir)
+{
+  return path::join(rootDir, "meta");
+}
+
+
+string getArchiveDir(const string& rootDir)
+{
+  return path::join(rootDir, "archive");
+}
+
+
+string getLatestSlavePath(const string& rootDir)
+{
+  return strings::format(LATEST_SLAVE_PATH, rootDir).get();
+}
+
+
+string getBootIdPath(const string& rootDir)
+{
+  return strings::format(BOOT_ID_PATH, rootDir).get();
+}
+
+
+string getSlaveInfoPath(
+    const string& rootDir,
+    const SlaveID& slaveId)
+{
+  return strings::format(SLAVE_INFO_PATH, rootDir, slaveId).get();
+}
+
+
+string getSlavePath(
+    const string& rootDir,
+    const SlaveID& slaveId)
+{
+  return strings::format(SLAVE_PATH, rootDir, slaveId).get();
+}
+
+
+Try<list<string>> getFrameworkPaths(
+    const string& rootDir,
+    const SlaveID& slaveId)
+{
+  Try<string> format = strings::format(
+      paths::FRAMEWORK_PATH,
+      rootDir,
+      slaveId,
+      "*");
+
+  CHECK_SOME(format);
+
+  return os::glob(format.get());
+}
+
+
+string getFrameworkPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId)
+{
+  return strings::format(
+      FRAMEWORK_PATH, rootDir, slaveId, frameworkId).get();
+}
+
+
+string getFrameworkPidPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId)
+{
+  return strings::format(
+      FRAMEWORK_PID_PATH, rootDir, slaveId, frameworkId).get();
+}
+
+
+string getFrameworkInfoPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId)
+{
+  return strings::format(
+      FRAMEWORK_INFO_PATH, rootDir, slaveId, frameworkId).get();
+}
+
+
+Try<list<string>> getExecutorPaths(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId)
+{
+  Try<string> format = strings::format(
+      paths::EXECUTOR_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      "*");
+
+  CHECK_SOME(format);
+
+  return os::glob(format.get());
+}
+
+
+string getExecutorPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId)
+{
+  return strings::format(
+      EXECUTOR_PATH, rootDir, slaveId, frameworkId, executorId).get();
+}
+
+
+string getExecutorInfoPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId)
+{
+  return strings::format(
+      EXECUTOR_INFO_PATH, rootDir, slaveId, frameworkId, executorId).get();
+}
+
+
+Try<list<string>> getExecutorRunPaths(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId)
+{
+  Try<string> format = strings::format(
+      paths::EXECUTOR_RUN_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      "*");
+
+  CHECK_SOME(format);
+
+  return os::glob(format.get());
+}
+
+
+string getExecutorRunPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId)
+{
+  return strings::format(
+      EXECUTOR_RUN_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId).get();
+}
+
+
+string getExecutorSentinelPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId)
+{
+  return strings::format(
+      EXECUTOR_SENTINEL_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId).get();
+}
+
+
+string getExecutorLatestRunPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId)
+{
+  return strings::format(
+      EXECUTOR_LATEST_RUN_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId).get();
+}
+
+
+string getLibprocessPidPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId)
+{
+  return strings::format(
+      LIBPROCESS_PID_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId).get();
+}
+
+
+string getForkedPidPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId)
+{
+  return strings::format(
+      FORKED_PID_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId).get();
+}
+
+
+Try<list<string>> getTaskPaths(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId)
+{
+  Try<string> format = strings::format(
+      paths::TASK_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId,
+      "*");
+
+  CHECK_SOME(format);
+
+  return os::glob(format.get());
+}
+
+
+string getTaskPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId,
+    const TaskID& taskId)
+{
+  return strings::format(
+      TASK_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId,
+      taskId).get();
+}
+
+
+string getTaskInfoPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId,
+    const TaskID& taskId)
+{
+  return strings::format(
+      TASK_INFO_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId,
+      taskId).get();
+}
+
+
+string getTaskUpdatesPath(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId,
+    const TaskID& taskId)
+{
+  return strings::format(
+      TASK_UPDATES_PATH,
+      rootDir,
+      slaveId,
+      frameworkId,
+      executorId,
+      containerId,
+      taskId).get();
+}
+
+
+string getResourcesInfoPath(
+    const string& rootDir)
+{
+  return strings::format(
+      RESOURCES_INFO_PATH,
+      rootDir).get();
+}
+
+
+string createExecutorDirectory(
+    const string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId)
+{
+  string directory =
+    getExecutorRunPath(rootDir, slaveId, frameworkId, executorId, containerId);
+
+  Try<Nothing> mkdir = os::mkdir(directory);
+
+  CHECK_SOME(mkdir)
+    << "Failed to create executor directory '" << directory << "'";
+
+  // Remove the previous "latest" symlink.
+  string latest =
+    getExecutorLatestRunPath(rootDir, slaveId, frameworkId, executorId);
+
+  if (os::exists(latest)) {
+    CHECK_SOME(os::rm(latest))
+      << "Failed to remove latest symlink '" << latest << "'";
+  }
+
+  // Symlink the new executor directory to "latest".
+  Try<Nothing> symlink = ::fs::symlink(directory, latest);
+
+  CHECK_SOME(symlink)
+    << "Failed to symlink directory '" << directory
+    << "' to '" << latest << "'";
+
+  return directory;
+}
+
+
+string createSlaveDirectory(
+    const string& rootDir,
+    const SlaveID& slaveId)
+{
+  string directory = getSlavePath(rootDir, slaveId);
+
+  Try<Nothing> mkdir = os::mkdir(directory);
+
+  CHECK_SOME(mkdir)
+    << "Failed to create slave directory '" << directory << "'";
+
+  // Remove the previous "latest" symlink.
+  string latest = getLatestSlavePath(rootDir);
+
+  if (os::exists(latest)) {
+    CHECK_SOME(os::rm(latest))
+      << "Failed to remove latest symlink '" << latest << "'";
+  }
+
+  // Symlink the new slave directory to "latest".
+  Try<Nothing> symlink = ::fs::symlink(directory, latest);
+
+  CHECK_SOME(symlink)
+    << "Failed to symlink directory '" << directory
+    << "' to '" << latest << "'";
+
+  return directory;
+}
+
+} // namespace paths {
+} // namespace slave {
+} // namespace internal {
+} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2eff8dd4/src/slave/paths.hpp
----------------------------------------------------------------------
diff --git a/src/slave/paths.hpp b/src/slave/paths.hpp
index 606c822..1e9e823 100644
--- a/src/slave/paths.hpp
+++ b/src/slave/paths.hpp
@@ -22,18 +22,7 @@
 #include <list>
 #include <string>
 
-#include <stout/check.hpp>
-#include <stout/foreach.hpp>
-#include <stout/format.hpp>
-#include <stout/fs.hpp>
-#include <stout/nothing.hpp>
-#include <stout/os.hpp>
-#include <stout/try.hpp>
-#include <stout/uuid.hpp>
-
-#include "logging/logging.hpp"
-
-#include "messages/messages.hpp"
+#include <mesos/mesos.hpp>
 
 namespace mesos {
 namespace internal {
@@ -42,443 +31,169 @@ namespace paths {
 
 const std::string LATEST_SYMLINK = "latest";
 
-// Helper functions to generate paths.
-
-// File names.
-const std::string BOOT_ID_FILE = "boot_id";
-const std::string SLAVE_INFO_FILE = "slave.info";
-const std::string FRAMEWORK_PID_FILE = "framework.pid";
-const std::string FRAMEWORK_INFO_FILE = "framework.info";
-const std::string LIBPROCESS_PID_FILE = "libprocess.pid";
-const std::string EXECUTOR_INFO_FILE = "executor.info";
-const std::string EXECUTOR_SENTINEL_FILE = "executor.sentinel";
-const std::string FORKED_PID_FILE = "forked.pid";
-const std::string TASK_INFO_FILE = "task.info";
-const std::string TASK_UPDATES_FILE = "task.updates";
-const std::string RESOURCES_INFO_FILE = "resources.info";
-
-// Path layout templates.
-const std::string ROOT_PATH = "%s";
-const std::string LATEST_SLAVE_PATH =
-  path::join(ROOT_PATH, "slaves", LATEST_SYMLINK);
-const std::string SLAVE_PATH =
-  path::join(ROOT_PATH, "slaves", "%s");
-const std::string BOOT_ID_PATH =
-  path::join(ROOT_PATH, BOOT_ID_FILE);
-const std::string SLAVE_INFO_PATH =
-  path::join(SLAVE_PATH, SLAVE_INFO_FILE);
-const std::string FRAMEWORK_PATH =
-  path::join(SLAVE_PATH, "frameworks", "%s");
-const std::string FRAMEWORK_PID_PATH =
-  path::join(FRAMEWORK_PATH, FRAMEWORK_PID_FILE);
-const std::string FRAMEWORK_INFO_PATH =
-  path::join(FRAMEWORK_PATH, FRAMEWORK_INFO_FILE);
-const std::string EXECUTOR_PATH =
-  path::join(FRAMEWORK_PATH, "executors", "%s");
-const std::string EXECUTOR_INFO_PATH =
-  path::join(EXECUTOR_PATH, EXECUTOR_INFO_FILE);
-const std::string EXECUTOR_RUN_PATH =
-  path::join(EXECUTOR_PATH, "runs", "%s");
-const std::string EXECUTOR_SENTINEL_PATH =
-  path::join(EXECUTOR_RUN_PATH, EXECUTOR_SENTINEL_FILE);
-const std::string EXECUTOR_LATEST_RUN_PATH =
-  path::join(EXECUTOR_PATH, "runs", LATEST_SYMLINK);
-const std::string PIDS_PATH =
-  path::join(EXECUTOR_RUN_PATH, "pids");
-const std::string LIBPROCESS_PID_PATH =
-  path::join(PIDS_PATH, LIBPROCESS_PID_FILE);
-const std::string FORKED_PID_PATH =
-  path::join(PIDS_PATH, FORKED_PID_FILE);
-const std::string TASK_PATH =
-  path::join(EXECUTOR_RUN_PATH, "tasks", "%s");
-const std::string TASK_INFO_PATH =
-  path::join(TASK_PATH, TASK_INFO_FILE);
-const std::string TASK_UPDATES_PATH =
-  path::join(TASK_PATH, TASK_UPDATES_FILE);
-const std::string RESOURCES_INFO_PATH =
-  path::join(ROOT_PATH, "resources", RESOURCES_INFO_FILE);
-
-
-inline std::string getMetaRootDir(const std::string rootDir)
-{
-  return path::join(rootDir, "meta");
-}
-
-
-inline std::string getArchiveDir(const std::string rootDir)
-{
-  return path::join(rootDir, "archive");
-}
-
-
-inline std::string getLatestSlavePath(const std::string& rootDir)
-{
-  return strings::format(LATEST_SLAVE_PATH, rootDir).get();
-}
-
-
-inline std::string getBootIdPath(const std::string& rootDir)
-{
-  return strings::format(BOOT_ID_PATH, rootDir).get();
-}
-
-
-inline std::string getSlaveInfoPath(
-    const std::string& rootDir,
-    const SlaveID& slaveId)
-{
-  return strings::format(SLAVE_INFO_PATH, rootDir, slaveId).get();
-}
+// Helpers for obtaining paths in the layout:
 
+std::string getMetaRootDir(const std::string& rootDir);
 
-inline std::string getSlavePath(
-    const std::string& rootDir,
-    const SlaveID& slaveId)
-{
-  return strings::format(SLAVE_PATH, rootDir, slaveId).get();
-}
+
+std::string getArchiveDir(const std::string& rootDir);
+
+
+std::string getLatestSlavePath(const std::string& rootDir);
 
 
-inline Try<std::list<std::string>> getFrameworkPaths(
+std::string getBootIdPath(const std::string& rootDir);
+
+
+std::string getSlaveInfoPath(
     const std::string& rootDir,
-    const SlaveID& slaveId)
-{
-  Try<std::string> format = strings::format(
-      paths::FRAMEWORK_PATH,
-      rootDir,
-      slaveId,
-      "*");
+    const SlaveID& slaveId);
 
-  CHECK_SOME(format);
 
-  return os::glob(format.get());
-}
+std::string getSlavePath(
+    const std::string& rootDir,
+    const SlaveID& slaveId);
 
 
-inline std::string getFrameworkPath(
+Try<std::list<std::string>> getFrameworkPaths(
     const std::string& rootDir,
-    const SlaveID& slaveId,
-    const FrameworkID& frameworkId)
-{
-  return strings::format(
-      FRAMEWORK_PATH, rootDir, slaveId, frameworkId).get();
-}
+    const SlaveID& slaveId);
 
 
-inline std::string getFrameworkPidPath(
+std::string getFrameworkPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
-    const FrameworkID& frameworkId)
-{
-  return strings::format(
-      FRAMEWORK_PID_PATH, rootDir, slaveId, frameworkId).get();
-}
+    const FrameworkID& frameworkId);
 
 
-inline std::string getFrameworkInfoPath(
+std::string getFrameworkPidPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
-    const FrameworkID& frameworkId)
-{
-  return strings::format(
-      FRAMEWORK_INFO_PATH, rootDir, slaveId, frameworkId).get();
-}
+    const FrameworkID& frameworkId);
 
 
-inline Try<std::list<std::string>> getExecutorPaths(
+std::string getFrameworkInfoPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
-    const FrameworkID& frameworkId)
-{
-  Try<std::string> format = strings::format(
-      paths::EXECUTOR_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      "*");
+    const FrameworkID& frameworkId);
 
-  CHECK_SOME(format);
 
-  return os::glob(format.get());
-}
+Try<std::list<std::string>> getExecutorPaths(
+    const std::string& rootDir,
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId);
 
 
-inline std::string getExecutorPath(
+std::string getExecutorPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
-    const ExecutorID& executorId)
-{
-  return strings::format(
-      EXECUTOR_PATH, rootDir, slaveId, frameworkId, executorId).get();
-}
+    const ExecutorID& executorId);
 
 
-inline std::string getExecutorInfoPath(
+std::string getExecutorInfoPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
-    const ExecutorID& executorId)
-{
-  return strings::format(
-      EXECUTOR_INFO_PATH, rootDir, slaveId, frameworkId, executorId).get();
-}
+    const ExecutorID& executorId);
 
 
-inline Try<std::list<std::string>> getExecutorRunPaths(
+Try<std::list<std::string>> getExecutorRunPaths(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
-    const ExecutorID& executorId)
-{
-  Try<std::string> format = strings::format(
-      paths::EXECUTOR_RUN_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      "*");
+    const ExecutorID& executorId);
 
-  CHECK_SOME(format);
 
-  return os::glob(format.get());
-}
-
-
-inline std::string getExecutorRunPath(
+std::string getExecutorRunPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
-    const ContainerID& containerId)
-{
-  return strings::format(
-      EXECUTOR_RUN_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId).get();
-}
-
-
-inline std::string getExecutorSentinelPath(
+    const ContainerID& containerId);
+
+
+std::string getExecutorSentinelPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
-    const ContainerID& containerId)
-{
-  return strings::format(
-      EXECUTOR_SENTINEL_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId).get();
-}
-
-
-inline std::string getExecutorLatestRunPath(
+    const ContainerID& containerId);
+
+
+std::string getExecutorLatestRunPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
-    const ExecutorID& executorId)
-{
-  return strings::format(
-      EXECUTOR_LATEST_RUN_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId).get();
-}
-
-
-inline std::string getLibprocessPidPath(
+    const ExecutorID& executorId);
+
+
+std::string getLibprocessPidPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
-    const ContainerID& containerId)
-{
-  return strings::format(
-      LIBPROCESS_PID_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId).get();
-}
-
-
-inline std::string getForkedPidPath(
+    const ContainerID& containerId);
+
+
+std::string getForkedPidPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
-    const ContainerID& containerId)
-{
-  return strings::format(
-      FORKED_PID_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId).get();
-}
-
-
-inline Try<std::list<std::string>> getTaskPaths(
+    const ContainerID& containerId);
+
+
+Try<std::list<std::string>> getTaskPaths(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
-    const ContainerID& containerId)
-{
-  Try<std::string> format = strings::format(
-      paths::TASK_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId,
-      "*");
+    const ContainerID& containerId);
 
-  CHECK_SOME(format);
 
-  return os::glob(format.get());
-}
-
-
-inline std::string getTaskPath(
+std::string getTaskPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
     const ContainerID& containerId,
-    const TaskID& taskId)
-{
-  return strings::format(
-      TASK_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId,
-      taskId).get();
-}
-
-
-inline std::string getTaskInfoPath(
+    const TaskID& taskId);
+
+
+std::string getTaskInfoPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
     const ContainerID& containerId,
-    const TaskID& taskId)
-{
-  return strings::format(
-      TASK_INFO_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId,
-      taskId).get();
-}
-
-
-inline std::string getTaskUpdatesPath(
+    const TaskID& taskId);
+
+
+std::string getTaskUpdatesPath(
     const std::string& rootDir,
     const SlaveID& slaveId,
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
     const ContainerID& containerId,
-    const TaskID& taskId)
-{
-  return strings::format(
-      TASK_UPDATES_PATH,
-      rootDir,
-      slaveId,
-      frameworkId,
-      executorId,
-      containerId,
-      taskId).get();
-}
-
-
-inline std::string getResourcesInfoPath(
-    const std::string& rootDir)
-{
-  return strings::format(
-      RESOURCES_INFO_PATH,
-      rootDir).get();
-}
-
-
-inline std::string createExecutorDirectory(
-    const std::string& rootDir,
-    const SlaveID& slaveId,
-    const FrameworkID& frameworkId,
-    const ExecutorID& executorId,
-    const ContainerID& containerId)
-{
-  std::string directory =
-    getExecutorRunPath(rootDir, slaveId, frameworkId, executorId, containerId);
-
-  Try<Nothing> mkdir = os::mkdir(directory);
-
-  CHECK_SOME(mkdir)
-    << "Failed to create executor directory '" << directory << "'";
+    const TaskID& taskId);
 
-  // Remove the previous "latest" symlink.
-  std::string latest =
-    getExecutorLatestRunPath(rootDir, slaveId, frameworkId, executorId);
 
-  if (os::exists(latest)) {
-    CHECK_SOME(os::rm(latest))
-      << "Failed to remove latest symlink '" << latest << "'";
-  }
+std::string getResourcesInfoPath(
+    const std::string& rootDir);
 
-  // Symlink the new executor directory to "latest".
-  Try<Nothing> symlink = ::fs::symlink(directory, latest);
 
-  CHECK_SOME(symlink)
-    << "Failed to symlink directory '" << directory
-    << "' to '" << latest << "'";
-
-  return directory;
-}
-
-
-inline std::string createSlaveDirectory(
+std::string createExecutorDirectory(
     const std::string& rootDir,
-    const SlaveID& slaveId)
-{
-  std::string directory = getSlavePath(rootDir, slaveId);
-
-  Try<Nothing> mkdir = os::mkdir(directory);
-
-  CHECK_SOME(mkdir)
-    << "Failed to create slave directory '" << directory << "'";
-
-  // Remove the previous "latest" symlink.
-  std::string latest = getLatestSlavePath(rootDir);
-
-  if (os::exists(latest)) {
-    CHECK_SOME(os::rm(latest))
-      << "Failed to remove latest symlink '" << latest << "'";
-  }
-
-  // Symlink the new slave directory to "latest".
-  Try<Nothing> symlink = ::fs::symlink(directory, latest);
+    const SlaveID& slaveId,
+    const FrameworkID& frameworkId,
+    const ExecutorID& executorId,
+    const ContainerID& containerId);
 
-  CHECK_SOME(symlink)
-    << "Failed to symlink directory '" << directory
-    << "' to '" << latest << "'";
 
-  return directory;
-}
+std::string createSlaveDirectory(
+    const std::string& rootDir,
+    const SlaveID& slaveId);
 
 } // namespace paths {
 } // namespace slave {