ewmscp  ..
daosFsCommon.h
Go to the documentation of this file.
1 #ifndef __daosFsCommon_h__
2 #define __daosFsCommon_h__
3 #include "ioHandle.h"
4 #include "pathHandler.h"
5 #include <daos.h>
6 #include <daos_fs.h>
7 #include <daos_obj.h>
8 #include <Options.h>
9 
10 #include <forward_list>
11 class daosFsCommon: virtual public pathHandler {
12  public:
13  daos_handle_t poh;
14  daos_handle_t coh;
15  dfs_t* dfs;
16  int flags;
17  std::map<std::string, dfs_obj_t*> pathMap;
18  dfs_obj_t* getDirObj(const std::string& path);
19 
20  class daosOptions {
21  public:
22  daosOptions(const std::string& optPrefix);
26  };
27 protected:
29 public:
31  friend class daosFsIoCommon;
32  protected:
33  public:
34  void fill(daosFsCommon& handler);
35  ~attrDataType() override = default;
36  void add(const std::string& name, const std::string& value);
37  void set(ioHandle* handle) override;
38  };
39  daosFsCommon(daosOptions& aOpt, bool isWriter);
40  ~daosFsCommon() override;
41  bool pathExists(const std::string& path) override;
42  std::unique_ptr<const genericStat> getStat(const std::string& path,
43  bool followLink) override;
44  std::string getXattr(const std::string& path,
45  const std::string& name) override;
46 };
47 
50 class daosFsIoCommon: virtual public ioHandle {
51  protected:
52  const std::string& path;
53  dfs_obj_t* obj;
55  public:
57  friend class daosFsIoCommon;
58  protected:
60  public:
61  ~attrDataType() override = default;
62  void add(const std::string& name, const std::string& value);
63  void set(ioHandle* handle) override;
64  };
65  daosFsIoCommon(const std::string& aPath, daosFsCommon& aHandler);
66  void setXattr(const std::string& name, const std::string& value) override;
67  std::string getXattr(const std::string& name) override;
68  void removeXattr(const std::string& name) override;
69  std::unique_ptr<const genericStat> getStat() override;
70  std::unique_ptr<ioHandle::attrDataType> getAttrData(const outputHandler::base* aOutputHandler) override;
71 };
72 
73 #endif
daosFsCommon::daosOptions
Definition: daosFsCommon.h:20
daosFsIoCommon::obj
dfs_obj_t * obj
Definition: daosFsCommon.h:53
daosFsCommon::attrDataType::set
void set(ioHandle *handle) override
set this set of attributes on the file described by handle
daosFsCommon::coh
daos_handle_t coh
Definition: daosFsCommon.h:14
options::single< std::string >
ioHandle::attrDataType
class for asttribute data, abstract base to be implemented for specific handlers
Definition: ioHandle.h:22
daosFsCommon::pathExists
bool pathExists(const std::string &path) override
Definition: daosFsCommon.cpp:58
daosFsIoCommon::getStat
std::unique_ptr< const genericStat > getStat() override
Definition: daosFsCommon.cpp:123
daosFsCommon::flags
int flags
Definition: daosFsCommon.h:16
daosFsCommon::~daosFsCommon
~daosFsCommon() override
Definition: daosFsCommon.cpp:44
daosFsIoCommon::attrDataType::~attrDataType
~attrDataType() override=default
daosFsIoCommon::getXattr
std::string getXattr(const std::string &name) override
get one extended attribute value
Definition: daosFsCommon.cpp:135
daosFsIoCommon::attrDataType::set
void set(ioHandle *handle) override
set this set of attributes on the file described by handle
Definition: daosFsCommon.cpp:164
daosFsIoCommon::attrDataType::fill
void fill(daosFsIoCommon &handler)
Definition: daosFsCommon.cpp:170
daosFsCommon::attrDataType::add
void add(const std::string &name, const std::string &value)
Options.h
daosFsCommon::attrDataType
Definition: daosFsCommon.h:30
daosFsCommon
Definition: daosFsCommon.h:11
daosFsCommon::opt
daosOptions & opt
Definition: daosFsCommon.h:28
daosFsCommon::daosOptions::daosOptions
daosOptions(const std::string &optPrefix)
Definition: daosFsCommon.cpp:13
daosFsIoCommon::attrDataType
Definition: daosFsCommon.h:56
daosFsIoCommon::removeXattr
void removeXattr(const std::string &name) override
Definition: daosFsCommon.cpp:151
daosFsCommon::getDirObj
dfs_obj_t * getDirObj(const std::string &path)
Definition: daosFsCommon.cpp:21
outputHandler::base
Definition: outputHandler.h:17
ioHandle.h
daosFsCommon::poh
daos_handle_t poh
Definition: daosFsCommon.h:13
daosFsCommon::daosOptions::poolName
options::single< std::string > poolName
Definition: daosFsCommon.h:24
daosFsCommon::dfs
dfs_t * dfs
Definition: daosFsCommon.h:15
daosFsCommon::getStat
std::unique_ptr< const genericStat > getStat(const std::string &path, bool followLink) override
Definition: daosFsCommon.cpp:68
daosFsCommon::pathMap
std::map< std::string, dfs_obj_t * > pathMap
Definition: daosFsCommon.h:17
daosFsCommon::daosOptions::containerName
options::single< std::string > containerName
Definition: daosFsCommon.h:23
pathHandler
Definition: pathHandler.h:6
daosFsCommon::getXattr
std::string getXattr(const std::string &path, const std::string &name) override
Definition: daosFsCommon.cpp:92
daosFsIoCommon
base class for daosFs reader and writer class with the common stuff like fd, path and xattr handling
Definition: daosFsCommon.h:50
daosFsIoCommon::daosFsIoCommon
daosFsIoCommon(const std::string &aPath, daosFsCommon &aHandler)
Definition: daosFsCommon.cpp:115
pathHandler.h
daosFsCommon::attrDataType::fill
void fill(daosFsCommon &handler)
ioHandle
class as base for inputHandler::base::reader and outputHandler::base::writer containing the common pa...
Definition: ioHandle.h:15
daosFsIoCommon::setXattr
void setXattr(const std::string &name, const std::string &value) override
Definition: daosFsCommon.cpp:129
daosFsIoCommon::path
const std::string & path
Definition: daosFsCommon.h:52
daosFsCommon::attrDataType::~attrDataType
~attrDataType() override=default
daosFsIoCommon::handler
daosFsCommon & handler
Definition: daosFsCommon.h:54
daosFsIoCommon::attrDataType::add
void add(const std::string &name, const std::string &value)
Definition: daosFsCommon.cpp:161
daosFsCommon::daosFsCommon
daosFsCommon(daosOptions &aOpt, bool isWriter)
Definition: daosFsCommon.cpp:34
daosFsIoCommon::getAttrData
std::unique_ptr< ioHandle::attrDataType > getAttrData(const outputHandler::base *aOutputHandler) override
get attributes in the optimal way for setting with aOutputHandler
Definition: daosFsCommon.cpp:184
daosFsCommon::daosOptions::sysName
options::single< std::string > sysName
Definition: daosFsCommon.h:25