#define ROCKSDB_HDFS_FILE_C
#include <stdio.h>
-#include <sys/time.h>
#include <time.h>
#include <algorithm>
#include <iostream>
Status s;
ROCKS_LOG_DEBUG(mylog, "[hdfs] HdfsReadableFile preading %s\n",
filename_.c_str());
- ssize_t bytes_read = hdfsPread(fileSys_, hfile_, offset,
- (void*)scratch, (tSize)n);
+ tSize bytes_read =
+ hdfsPread(fileSys_, hfile_, offset, static_cast<void*>(scratch),
+ static_cast<tSize>(n));
ROCKS_LOG_DEBUG(mylog, "[hdfs] HdfsReadableFile pread %s\n",
filename_.c_str());
*result = Slice(scratch, (bytes_read < 0) ? 0 : bytes_read);
return Status::OK();
}
+Status HdfsEnv::IsDirectory(const std::string& path, bool* is_dir) {
+ hdfsFileInfo* pFileInfo = hdfsGetPathInfo(fileSys_, path.c_str());
+ if (pFileInfo != nullptr) {
+ if (is_dir != nullptr) {
+ *is_dir = (pFileInfo->mKind == kObjectKindDirectory);
+ }
+ hdfsFreeFileInfo(pFileInfo, 1);
+ return Status::OK();
+ }
+ return IOError(path, errno);
+}
+
// The factory method for creating an HDFS Env
Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) {
*hdfs_env = new HdfsEnv(fsname);