ewmscp  ..
Public Member Functions | Private Attributes | List of all members
inputHandler::daosFs::DaosFsDirectory Class Reference

#include <inputHandlerDaosFs.h>

Inheritance diagram for inputHandler::daosFs::DaosFsDirectory:
[legend]
Collaboration diagram for inputHandler::daosFs::DaosFsDirectory:
[legend]

Public Member Functions

 DaosFsDirectory (daosFs &aHandler, const std::string &path)
 
 ~DaosFsDirectory () noexcept(false) override
 
std::unique_ptr< Entry > getNextEntry (bool ignoreMissing) override
 

Private Attributes

daosFshandler
 
dfs_obj_t * dir
 
daos_anchor_t anchor
 

Detailed Description

Definition at line 40 of file inputHandlerDaosFs.h.

Constructor & Destructor Documentation

◆ DaosFsDirectory()

inputHandler::daosFs::DaosFsDirectory::DaosFsDirectory ( daosFs aHandler,
const std::string &  path 
)

Definition at line 192 of file inputHandlerDaosFs.cpp.

192  : Directory(aPath), handler(aHandler) {
193  timerInst(opendir);
194  throwcall::good0(dfs_open(handler.dfs, handler.getDirObj(path), path.c_str(), 0666, O_RDONLY, 0, 0, nullptr, &dir),
195  "can't open direcory ", path);
196  }

References daosFsCommon::dfs, dir, daosFsCommon::getDirObj(), throwcall::good0(), handler, and timerInst.

Here is the call graph for this function:

◆ ~DaosFsDirectory()

inputHandler::daosFs::DaosFsDirectory::~DaosFsDirectory ( )
overridenoexcept

Definition at line 197 of file inputHandlerDaosFs.cpp.

197  {
198  if (isUnwinding()) {
199  if (dfs_release(dir) != 0) {
201  "", "close directory during unwind ",
202  std::system_category().default_error_condition(errno).message());
203  }
204  } else {
205  timerInst(closedir);
206  throwcall::good0(dfs_release(dir), "can't close directory ", path);
207  }
208  }

References errMsg::debug, errMsg::emit(), throwcall::good0(), and timerInst.

Here is the call graph for this function:

Member Function Documentation

◆ getNextEntry()

std::unique_ptr< base::Directory::Entry > inputHandler::daosFs::DaosFsDirectory::getNextEntry ( bool  ignoreMissing)
override

Definition at line 209 of file inputHandlerDaosFs.cpp.

209  {
210  while (true) {
211  struct dirent entry;
212  uint32_t n=1;
213  throwcall::good0(dfs_readdir(handler.dfs, dir, &anchor, &n, &entry),"can't read dir enry");
214  if (n==1) {
215  if (entry.d_name[entry.d_name[0] != '.' ? 0 : entry.d_name[1] != '.' ? 1 : 2] == '\0') {
216  continue; // skip . .. and empty strings
217  }
218  struct stat statbuf;
219  {
220  timerInst(fstatat);
221  auto result = dfs_stat(handler.dfs, dir, entry.d_name, &statbuf);
222  if (result != 0 && errno == ENOENT && ignoreMissing) {
223  continue;
224  }
225  throwcall::good0(result, "can't stat ", entry.d_name);
226  }
227  auto genStat = std::unique_ptr<const genericStat>(new genericStat(statbuf, std::chrono::nanoseconds(1)));
228  return std::unique_ptr<Entry>(new Entry(entry.d_name, genStat));
229  } else {
230  break;
231  }
232  }
233  return nullptr;
234  }

References throwcall::good0(), and timerInst.

Here is the call graph for this function:

Member Data Documentation

◆ anchor

daos_anchor_t inputHandler::daosFs::DaosFsDirectory::anchor
private

Definition at line 43 of file inputHandlerDaosFs.h.

◆ dir

dfs_obj_t* inputHandler::daosFs::DaosFsDirectory::dir
private

Definition at line 42 of file inputHandlerDaosFs.h.

Referenced by DaosFsDirectory().

◆ handler

daosFs& inputHandler::daosFs::DaosFsDirectory::handler
private

Definition at line 41 of file inputHandlerDaosFs.h.

Referenced by DaosFsDirectory().


The documentation for this class was generated from the following files:
errMsg::location
class for defining the location of a error message in the source code.
Definition: errMsgQueue.h:14
genericStat
generic stat abstraction class Used to abstract the variants of the stat structure.
Definition: genericStat.h:12
errMsg::level::debug
@ debug
inputHandler::daosFs::DaosFsDirectory::anchor
daos_anchor_t anchor
Definition: inputHandlerDaosFs.h:43
daosFsCommon::getDirObj
dfs_obj_t * getDirObj(const std::string &path)
Definition: daosFsCommon.cpp:21
daosFsCommon::dfs
dfs_t * dfs
Definition: daosFsCommon.h:15
errMsg::emit
void emit(level aLogLevel, const location &loc, const std::string &aObject, const std::string &aAction, const Args &... args)
function to create and enqueue a message, this is the only way that messages should be created!
Definition: errMsgQueue.h:148
timerInst
#define timerInst(subfunc)
Definition: timer.h:157
inputHandler::daosFs::DaosFsDirectory::handler
daosFs & handler
Definition: inputHandlerDaosFs.h:41
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40
inputHandler::daosFs::DaosFsDirectory::dir
dfs_obj_t * dir
Definition: inputHandlerDaosFs.h:42