ewmscp  ..
Public Member Functions | Protected Member Functions | Friends | List of all members
daosFsIoCommon::attrDataType Class Reference

#include <daosFsCommon.h>

Inheritance diagram for daosFsIoCommon::attrDataType:
[legend]
Collaboration diagram for daosFsIoCommon::attrDataType:
[legend]

Public Member Functions

 ~attrDataType () override=default
 
void add (const std::string &name, const std::string &value)
 
void set (ioHandle *handle) override
 set this set of attributes on the file described by handle More...
 

Protected Member Functions

void fill (daosFsIoCommon &handler)
 

Friends

class daosFsIoCommon
 

Additional Inherited Members

- Protected Attributes inherited from ioHandle::attrDataType
std::forward_list< std::pair< std::string, std::string > > xattrs
 

Detailed Description

Definition at line 56 of file daosFsCommon.h.

Constructor & Destructor Documentation

◆ ~attrDataType()

daosFsIoCommon::attrDataType::~attrDataType ( )
overridevirtualdefault

Reimplemented from ioHandle::attrDataType.

Member Function Documentation

◆ add()

void daosFsIoCommon::attrDataType::add ( const std::string &  name,
const std::string &  value 
)

Definition at line 161 of file daosFsCommon.cpp.

161  {
162  xattrs.emplace_front(name, value);
163 }

References ioHandle::attrDataType::xattrs.

◆ fill()

void daosFsIoCommon::attrDataType::fill ( daosFsIoCommon handler)
protected

Definition at line 170 of file daosFsCommon.cpp.

170  {
171  char buf[0x10000];
172  static timer::anchor la("listxattr");
174  daos_size_t size(sizeof(buf));
175  throwcall::good0(dfs_listxattr(aHandler.handler.dfs, aHandler.obj, buf, &size),
176  "can't get xattrs for ", aHandler.path);
177  li.stop();
178  for (auto readPtr = &buf[0]; readPtr < &buf[size];) {
179  add(readPtr, aHandler.getXattr(readPtr));
180  while (*readPtr++);
181  }
182 }

References daosFsCommon::dfs, daosFsIoCommon::getXattr(), throwcall::good0(), daosFsIoCommon::handler, daosFsIoCommon::obj, daosFsIoCommon::path, and timer::instanceUnscoped::stop().

Here is the call graph for this function:

◆ set()

void daosFsIoCommon::attrDataType::set ( ioHandle handle)
overridevirtual

set this set of attributes on the file described by handle

Exceptions
std::system_errorif attr setting fails
Parameters
[in]handle[in] handler for output file to set attrs on

Implements ioHandle::attrDataType.

Definition at line 164 of file daosFsCommon.cpp.

164  {
165  for (const auto& item : xattrs) {
166  handle->setXattr(item.first, item.second);
167  }
168 }

References ioHandle::setXattr().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ daosFsIoCommon

friend class daosFsIoCommon
friend

Definition at line 57 of file daosFsCommon.h.


The documentation for this class was generated from the following files:
ioHandle::setXattr
virtual void setXattr(const std::string &, const std::string &)
Definition: ioHandle.h:43
ioHandle::attrDataType::xattrs
std::forward_list< std::pair< std::string, std::string > > xattrs
Definition: ioHandle.h:24
timer::instanceUnscoped
Definition: timer.h:95
timer::anchor
Definition: timer.h:22
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40
daosFsIoCommon::attrDataType::add
void add(const std::string &name, const std::string &value)
Definition: daosFsCommon.cpp:161