]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/hdfs/env_hdfs.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / hdfs / env_hdfs.h
index 6005c366418cafea86e70dd72c72e5babed53f3f..c56f8fe48e096b116347be184dfc25d35f536ad9 100644 (file)
@@ -101,6 +101,8 @@ class HdfsEnv : public Env {
   Status NewLogger(const std::string& fname,
                    std::shared_ptr<Logger>* result) override;
 
+  Status IsDirectory(const std::string& path, bool* is_dir) override;
+
   void Schedule(void (*function)(void* arg), void* arg, Priority pri = LOW,
                 void* tag = nullptr,
                 void (*unschedFunction)(void* arg) = 0) override {
@@ -160,10 +162,7 @@ class HdfsEnv : public Env {
     return posixEnv->TimeToString(number);
   }
 
-  static uint64_t gettid() {
-    assert(sizeof(pthread_t) <= sizeof(uint64_t));
-    return (uint64_t)pthread_self();
-  }
+  static uint64_t gettid() { return Env::Default()->GetThreadID(); }
 
   uint64_t GetThreadID() const override { return HdfsEnv::gettid(); }
 
@@ -207,8 +206,7 @@ class HdfsEnv : public Env {
     std::string portStr = (rem == 0 ? remaining :
                            remaining.substr(0, rem));
 
-    tPort port;
-    port = atoi(portStr.c_str());
+    tPort port = static_cast<tPort>(atoi(portStr.c_str()));
     if (port == 0) {
       throw HdfsFatalException("Bad host-port for hdfs " + uri);
     }
@@ -236,8 +234,6 @@ class HdfsEnv : public Env {
 
 namespace ROCKSDB_NAMESPACE {
 
-static const Status notsup;
-
 class HdfsEnv : public Env {
 
  public:
@@ -258,75 +254,81 @@ class HdfsEnv : public Env {
       const std::string& /*fname*/,
       std::unique_ptr<RandomAccessFile>* /*result*/,
       const EnvOptions& /*options*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status NewWritableFile(const std::string& /*fname*/,
                                  std::unique_ptr<WritableFile>* /*result*/,
                                  const EnvOptions& /*options*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status NewDirectory(const std::string& /*name*/,
                               std::unique_ptr<Directory>* /*result*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status FileExists(const std::string& /*fname*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status GetChildren(const std::string& /*path*/,
                              std::vector<std::string>* /*result*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status DeleteFile(const std::string& /*fname*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status CreateDir(const std::string& /*name*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status CreateDirIfMissing(const std::string& /*name*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status DeleteDir(const std::string& /*name*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status GetFileSize(const std::string& /*fname*/,
                              uint64_t* /*size*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status GetFileModificationTime(const std::string& /*fname*/,
                                          uint64_t* /*time*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status RenameFile(const std::string& /*src*/,
                             const std::string& /*target*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status LinkFile(const std::string& /*src*/,
                           const std::string& /*target*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status LockFile(const std::string& /*fname*/,
                           FileLock** /*lock*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
-  virtual Status UnlockFile(FileLock* /*lock*/) override { return notsup; }
+  virtual Status UnlockFile(FileLock* /*lock*/) override {
+    return Status::NotSupported();
+  }
 
   virtual Status NewLogger(const std::string& /*fname*/,
                            std::shared_ptr<Logger>* /*result*/) override {
-    return notsup;
+    return Status::NotSupported();
+  }
+
+  Status IsDirectory(const std::string& /*path*/, bool* /*is_dir*/) override {
+    return Status::NotSupported();
   }
 
   virtual void Schedule(void (* /*function*/)(void* arg), void* /*arg*/,
@@ -346,7 +348,7 @@ class HdfsEnv : public Env {
   }
 
   virtual Status GetTestDirectory(std::string* /*path*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual uint64_t NowMicros() override { return 0; }
@@ -354,16 +356,16 @@ class HdfsEnv : public Env {
   virtual void SleepForMicroseconds(int /*micros*/) override {}
 
   virtual Status GetHostName(char* /*name*/, uint64_t /*len*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status GetCurrentTime(int64_t* /*unix_time*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual Status GetAbsolutePath(const std::string& /*db_path*/,
                                  std::string* /*outputpath*/) override {
-    return notsup;
+    return Status::NotSupported();
   }
 
   virtual void SetBackgroundThreads(int /*number*/,