SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::FS::SmartFd Class Reference

Smart FileDescriptor. More...

#include <swcdb/fs/SmartFd.h>

+ Inheritance diagram for SWC::FS::SmartFd:
+ Collaboration diagram for SWC::FS::SmartFd:

Public Types

typedef std::shared_ptr< SmartFdPtr
 

Public Member Functions

SWC_CAN_INLINE SmartFd (const std::string &filepath, uint32_t flags, int32_t fd=-1, uint64_t pos=0)
 
SWC_CAN_INLINE SmartFd (std::string &&filepath, uint32_t flags, int32_t fd=-1, uint64_t pos=0) noexcept
 
virtual ~SmartFd () noexcept
 
constexpr SWC_CAN_INLINE const std::string & filepath () const noexcept
 
constexpr SWC_CAN_INLINE void flags (uint32_t flags) noexcept
 
constexpr SWC_CAN_INLINE uint32_t flags () const noexcept
 
constexpr SWC_CAN_INLINE void fd (int32_t fd) noexcept
 
constexpr SWC_CAN_INLINE int32_t fd () const noexcept
 
constexpr SWC_CAN_INLINE bool valid () const noexcept
 
constexpr SWC_CAN_INLINE int32_t invalidate () noexcept
 
constexpr SWC_CAN_INLINE void pos (uint64_t pos) noexcept
 
constexpr SWC_CAN_INLINE uint64_t pos () const noexcept
 
constexpr SWC_CAN_INLINE void forward (uint64_t nbytes) noexcept
 
std::string to_string () const
 
void print (std::ostream &out) const
 

Static Public Member Functions

static SWC_CAN_INLINE Ptr make_ptr (const std::string &filepath, uint32_t flags, int32_t fd=-1, uint64_t pos=0)
 
static SWC_CAN_INLINE Ptr make_ptr (std::string &&filepath, uint32_t flags, int32_t fd=-1, uint64_t pos=0)
 

Protected Attributes

const std::string m_filepath
 

Private Attributes

Core::Atomic< uint32_t > m_flags
 
Core::Atomic< int32_t > m_fd
 
Core::Atomic< uint64_t > m_pos
 

Detailed Description

Smart FileDescriptor.

Definition at line 34 of file SmartFd.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<SmartFd> SWC::FS::SmartFd::Ptr

Definition at line 37 of file SmartFd.h.

Constructor & Destructor Documentation

◆ SmartFd() [1/2]

SWC_CAN_INLINE SWC::FS::SmartFd::SmartFd ( const std::string &  filepath,
uint32_t  flags,
int32_t  fd = -1,
uint64_t  pos = 0 
)
inline

Definition at line 52 of file SmartFd.h.

Referenced by make_ptr().

+ Here is the caller graph for this function:

◆ SmartFd() [2/2]

SWC_CAN_INLINE SWC::FS::SmartFd::SmartFd ( std::string &&  filepath,
uint32_t  flags,
int32_t  fd = -1,
uint64_t  pos = 0 
)
inlinenoexcept

Definition at line 58 of file SmartFd.h.

◆ ~SmartFd()

SWC::FS::SmartFd::~SmartFd ( )
virtualnoexcept

Definition at line 13 of file SmartFd.cc.

Member Function Documentation

◆ fd() [1/2]

constexpr SWC_CAN_INLINE int32_t SWC::FS::SmartFd::fd ( ) const
inlineconstexprnoexcept

Definition at line 87 of file SmartFd.h.

References m_fd.

Referenced by fd(), and make_ptr().

+ Here is the caller graph for this function:

◆ fd() [2/2]

constexpr SWC_CAN_INLINE void SWC::FS::SmartFd::fd ( int32_t  fd)
inlineconstexprnoexcept

Definition at line 82 of file SmartFd.h.

References fd(), m_fd, and SWC::Core::AtomicBase< T, OrderT >::store().

+ Here is the call graph for this function:

◆ filepath()

constexpr SWC_CAN_INLINE const std::string& SWC::FS::SmartFd::filepath ( ) const
inlineconstexprnoexcept

Definition at line 67 of file SmartFd.h.

References m_filepath.

Referenced by SWC::FS::FileSystemHadoop::SmartFdHadoop::make_ptr(), SWC::FS::FileSystemHadoopJVM::SmartFdHadoopJVM::make_ptr(), and make_ptr().

+ Here is the caller graph for this function:

◆ flags() [1/2]

constexpr SWC_CAN_INLINE uint32_t SWC::FS::SmartFd::flags ( ) const
inlineconstexprnoexcept

Definition at line 77 of file SmartFd.h.

References m_flags.

Referenced by flags(), SWC::FS::FileSystemHadoop::SmartFdHadoop::make_ptr(), SWC::FS::FileSystemHadoopJVM::SmartFdHadoopJVM::make_ptr(), and make_ptr().

+ Here is the caller graph for this function:

◆ flags() [2/2]

constexpr SWC_CAN_INLINE void SWC::FS::SmartFd::flags ( uint32_t  flags)
inlineconstexprnoexcept

Definition at line 72 of file SmartFd.h.

References flags(), m_flags, and SWC::Core::AtomicBase< T, OrderT >::store().

+ Here is the call graph for this function:

◆ forward()

constexpr SWC_CAN_INLINE void SWC::FS::SmartFd::forward ( uint64_t  nbytes)
inlineconstexprnoexcept

Definition at line 113 of file SmartFd.h.

References SWC::Core::Atomic< T, OrderT >::fetch_add(), and m_pos.

+ Here is the call graph for this function:

◆ invalidate()

constexpr SWC_CAN_INLINE int32_t SWC::FS::SmartFd::invalidate ( )
inlineconstexprnoexcept

Definition at line 97 of file SmartFd.h.

References SWC::Core::AtomicBase< T, OrderT >::exchange(), m_fd, m_pos, and SWC::Core::AtomicBase< T, OrderT >::store().

+ Here is the call graph for this function:

◆ make_ptr() [1/2]

static SWC_CAN_INLINE Ptr SWC::FS::SmartFd::make_ptr ( const std::string &  filepath,
uint32_t  flags,
int32_t  fd = -1,
uint64_t  pos = 0 
)
inlinestatic

◆ make_ptr() [2/2]

static SWC_CAN_INLINE Ptr SWC::FS::SmartFd::make_ptr ( std::string &&  filepath,
uint32_t  flags,
int32_t  fd = -1,
uint64_t  pos = 0 
)
inlinestatic

Definition at line 46 of file SmartFd.h.

References fd(), filepath(), flags(), pos(), and SmartFd().

+ Here is the call graph for this function:

◆ pos() [1/2]

constexpr SWC_CAN_INLINE uint64_t SWC::FS::SmartFd::pos ( ) const
inlineconstexprnoexcept

Definition at line 108 of file SmartFd.h.

References m_pos.

Referenced by make_ptr(), and pos().

+ Here is the caller graph for this function:

◆ pos() [2/2]

constexpr SWC_CAN_INLINE void SWC::FS::SmartFd::pos ( uint64_t  pos)
inlineconstexprnoexcept

Definition at line 103 of file SmartFd.h.

References m_pos, pos(), and SWC::Core::AtomicBase< T, OrderT >::store().

+ Here is the call graph for this function:

◆ print()

void SWC::FS::SmartFd::print ( std::ostream &  out) const

Definition at line 20 of file SmartFd.cc.

References SWC::Core::AtomicBase< T, OrderT >::load(), m_fd, m_filepath, m_flags, and m_pos.

+ Here is the call graph for this function:

◆ to_string()

std::string SWC::FS::SmartFd::to_string ( ) const

Definition at line 15 of file SmartFd.cc.

References SWC::format(), SWC::Core::AtomicBase< T, OrderT >::load(), m_fd, m_filepath, m_flags, m_pos, and SWC_FMT_LU.

+ Here is the call graph for this function:

◆ valid()

constexpr SWC_CAN_INLINE bool SWC::FS::SmartFd::valid ( ) const
inlineconstexprnoexcept

Definition at line 92 of file SmartFd.h.

References m_fd.

Member Data Documentation

◆ m_fd

Core::Atomic<int32_t> SWC::FS::SmartFd::m_fd
private

Definition at line 128 of file SmartFd.h.

Referenced by fd(), invalidate(), print(), to_string(), and valid().

◆ m_filepath

const std::string SWC::FS::SmartFd::m_filepath
protected

Definition at line 123 of file SmartFd.h.

Referenced by filepath(), print(), and to_string().

◆ m_flags

Core::Atomic<uint32_t> SWC::FS::SmartFd::m_flags
private

Definition at line 127 of file SmartFd.h.

Referenced by flags(), print(), and to_string().

◆ m_pos

Core::Atomic<uint64_t> SWC::FS::SmartFd::m_pos
private

Definition at line 129 of file SmartFd.h.

Referenced by forward(), invalidate(), pos(), print(), and to_string().


The documentation for this class was generated from the following files: