From 4fd23fb130a9f4d340517fcb20e8b0b4bc3f6513 Mon Sep 17 00:00:00 2001 From: Shu Zhang Date: Wed, 23 Dec 2015 17:26:50 -0800 Subject: [PATCH 1/5] add a factory method for creating hdfs env --- include/rocksdb/env.h | 4 ++++ util/env_hdfs.cc | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index e17ae3eae..e5f892a75 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -947,6 +947,10 @@ class WritableFileWrapper : public WritableFile { // *base_env must remain live while the result is in use. Env* NewMemEnv(Env* base_env); +// Returns a new environment that is used for HDFS environment. +// This is a factory method for HdfsEnv declared in hdfs/env_hdfs.h +Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname); + } // namespace rocksdb #endif // STORAGE_ROCKSDB_INCLUDE_ENV_H_ diff --git a/util/env_hdfs.cc b/util/env_hdfs.cc index e7844e8dc..21035e18f 100644 --- a/util/env_hdfs.cc +++ b/util/env_hdfs.cc @@ -594,6 +594,11 @@ Status HdfsEnv::NewLogger(const std::string& fname, return Status::OK(); } + // The factory method for creating an HDFS Env +Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { + *hdfs_env = new HdfsEnv(fsname); + return Status::OK(); +} } // namespace rocksdb #endif // ROCKSDB_HDFS_FILE_C @@ -607,6 +612,11 @@ namespace rocksdb { const EnvOptions& options) { return Status::NotSupported("Not compiled with hdfs support"); } + + Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { + return Status::NotSupported("Not compiled with hdfs support"); + } + } #endif From 4dfdd1d92876ffa6b8432812bbd952f04dd9752d Mon Sep 17 00:00:00 2001 From: Shu Zhang Date: Thu, 24 Dec 2015 20:32:29 -0800 Subject: [PATCH 2/5] format --- util/env_hdfs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/env_hdfs.cc b/util/env_hdfs.cc index 21035e18f..ba052a5f4 100644 --- a/util/env_hdfs.cc +++ b/util/env_hdfs.cc @@ -594,7 +594,7 @@ Status HdfsEnv::NewLogger(const std::string& fname, return Status::OK(); } - // The factory method for creating an HDFS Env +// The factory method for creating an HDFS Env Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { *hdfs_env = new HdfsEnv(fsname); return Status::OK(); From b4aa823661dcc701b3e05e464b84f81d6c827531 Mon Sep 17 00:00:00 2001 From: Shu Zhang Date: Thu, 24 Dec 2015 20:38:35 -0800 Subject: [PATCH 3/5] format --- util/env_hdfs.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/env_hdfs.cc b/util/env_hdfs.cc index ba052a5f4..fdb286f9c 100644 --- a/util/env_hdfs.cc +++ b/util/env_hdfs.cc @@ -596,8 +596,8 @@ Status HdfsEnv::NewLogger(const std::string& fname, // The factory method for creating an HDFS Env Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { - *hdfs_env = new HdfsEnv(fsname); - return Status::OK(); + *hdfs_env = new HdfsEnv(fsname); + return Status::OK(); } } // namespace rocksdb From b79ccbd573742f26979dc7efc95b15cf904a5307 Mon Sep 17 00:00:00 2001 From: Shu Zhang Date: Sat, 26 Dec 2015 19:50:28 -0800 Subject: [PATCH 4/5] indent --- util/env_hdfs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/env_hdfs.cc b/util/env_hdfs.cc index fdb286f9c..153ea5985 100644 --- a/util/env_hdfs.cc +++ b/util/env_hdfs.cc @@ -614,7 +614,7 @@ namespace rocksdb { } Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { - return Status::NotSupported("Not compiled with hdfs support"); + return Status::NotSupported("Not compiled with hdfs support"); } } From 2b7c810db8b1dc21f4bb3392e6e270f41cabd6e0 Mon Sep 17 00:00:00 2001 From: Shu Zhang Date: Sat, 26 Dec 2015 19:52:35 -0800 Subject: [PATCH 5/5] more foramt --- util/env_hdfs.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/util/env_hdfs.cc b/util/env_hdfs.cc index 153ea5985..7e12c747a 100644 --- a/util/env_hdfs.cc +++ b/util/env_hdfs.cc @@ -616,7 +616,6 @@ namespace rocksdb { Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { return Status::NotSupported("Not compiled with hdfs support"); } - } #endif