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

#include <inputHandlerDaosFs.h>

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

Classes

class  DaosFsDirectory
 
class  readerDaosFs
 

Public Member Functions

 daosFs ()
 
 ~daosFs () override=default
 
std::unique_ptr< readernewReader (const std::string &aPath, copyRequest::stateType &state, const genericStat &inititalStat) override
 get a reader for the file at path More...
 
bool readLinkTarget (const std::string &path, std::vector< char > &target) override
 read link target from a symlink More...
 
std::unique_ptr< DirectorygetDirectory (const std::string &path) override
 
- Public Member Functions inherited from inputHandler::base
virtual ~base () override=default
 
virtual std::unique_ptr< acl::listgetAclData (const std::string &)
 
- Public Member Functions inherited from pathHandler
virtual ~pathHandler ()=default
 
- Public Member Functions inherited from daosFsCommon
dfs_obj_t * getDirObj (const std::string &path)
 
 daosFsCommon (daosOptions &aOpt, bool isWriter)
 
 ~daosFsCommon () override
 
bool pathExists (const std::string &path) override
 
std::unique_ptr< const genericStatgetStat (const std::string &path, bool followLink) override
 
std::string getXattr (const std::string &path, const std::string &name) override
 

Static Private Attributes

static factoryTemplate< daosFsfactory
 

Additional Inherited Members

- Static Public Member Functions inherited from inputHandler::base
static basenewHandler (const std::string &name)
 create an instance of an inputHandler, select by name More...
 
template<class T >
static void addAllowedNamesToOption (T &option)
 
- Public Attributes inherited from daosFsCommon
daos_handle_t poh
 
daos_handle_t coh
 
dfs_t * dfs
 
int flags
 
std::map< std::string, dfs_obj_t * > pathMap
 
- Protected Member Functions inherited from inputHandler::base
 base ()=default
 
- Static Protected Member Functions inherited from inputHandler::base
static std::map< std::string, factoryClass * > & getFactoryMap ()
 
- Protected Attributes inherited from daosFsCommon
daosOptionsopt
 

Detailed Description

Definition at line 15 of file inputHandlerDaosFs.h.

Constructor & Destructor Documentation

◆ daosFs()

inputHandler::daosFs::daosFs ( )

Definition at line 19 of file inputHandlerDaosFs.cpp.

19 : daosFsCommon(inputConfig, false){};

◆ ~daosFs()

inputHandler::daosFs::~daosFs ( )
overridedefault

Member Function Documentation

◆ getDirectory()

std::unique_ptr< base::Directory > inputHandler::daosFs::getDirectory ( const std::string &  path)
overridevirtual

Implements inputHandler::base.

Definition at line 235 of file inputHandlerDaosFs.cpp.

235  {
236  return std::unique_ptr<Directory>(new DaosFsDirectory(*this, path));
237  }

◆ newReader()

std::unique_ptr< base::reader > inputHandler::daosFs::newReader ( const std::string &  path,
copyRequest::stateType state,
const genericStat inititalStat 
)
overridevirtual

get a reader for the file at path

Returns
unique ptr to a file reader.
Exceptions
std::system_errorif file can't be opened File will be closed when the pointer goes out of scope.
Parameters
[in]path[in] path to the file to be opened for reading
[in,out]state[in,out] state may be set to vanished if the file does not exist
[in]inititalStat[in] genericStat data of the file encountered before reading, needed for checking unchangedness at the end

Implements inputHandler::base.

Definition at line 21 of file inputHandlerDaosFs.cpp.

23  {
24  return std::unique_ptr<base::reader>(new readerDaosFs(aPath,
25  state,
26  inititalStat,
27  *this));
28  }

◆ readLinkTarget()

bool inputHandler::daosFs::readLinkTarget ( const std::string &  ,
std::vector< char > &   
)
overridevirtual

read link target from a symlink

Parameters
[in]pathis the path to the link
[in,out]targetis a vector that the link target gets written into, must be large enough
Returns
true if link could be read, false if the link does not exist
Exceptions
std::system_errorif the link could not be read
std::runtime_errorif the target size is larger than target.size()

Reimplemented from inputHandler::base.

Definition at line 31 of file inputHandlerDaosFs.cpp.

32  {
33  timerInst(readlink);
34  auto linklength = readlink(path.c_str(), target.data(), target.size());
35  if (linklength == -1 && errno == ENOENT) {
36  return false;
37  }
38  throwcall::badval(linklength, -1, "could not read link ", path);
39  if (linklength >= static_cast<ssize_t>(target.size())) {
40  throw std::runtime_error("link size increased after stat for " + path);
41  }
42  target[linklength] = '\0';
43  return true;
44  }

References throwcall::badval(), and timerInst.

Here is the call graph for this function:

Member Data Documentation

◆ factory

factoryTemplate<daosFs> inputHandler::daosFs::factory
staticprivate

Definition at line 16 of file inputHandlerDaosFs.h.


The documentation for this class was generated from the following files:
inputHandler::inputConfig
static daosFsCommon::daosOptions inputConfig("daosFsIn")
throwcall::badval
T badval(T call, t badvalue, const Args &... args)
template function to wrap system calls that return a special bad value on failure
Definition: throwcall.h:54
timerInst
#define timerInst(subfunc)
Definition: timer.h:157
daosFsCommon::daosFsCommon
daosFsCommon(daosOptions &aOpt, bool isWriter)
Definition: daosFsCommon.cpp:34