#include <swcdb/fs/HadoopJVM/FileSystem.h>
Classes | |
struct | Service |
struct | SmartFdHadoopJVM |
Public Member Functions | |
FileSystemHadoopJVM (Configurables *config) | |
FileSystemHadoopJVM (FileSystemHadoopJVM &&)=delete | |
FileSystemHadoopJVM (const FileSystemHadoopJVM &)=delete | |
FileSystemHadoopJVM & | operator= (FileSystemHadoopJVM &&)=delete |
FileSystemHadoopJVM & | operator= (const FileSystemHadoopJVM &)=delete |
virtual | ~FileSystemHadoopJVM () noexcept |
Type SWC_CONST_FUNC | get_type () const noexcept override |
std::string | to_string () const override |
void | stop () override |
Service::Ptr | setup_connection () |
bool | initialize (Service::Ptr &fs) |
Service::Ptr | get_fs (int &err) |
void | need_reconnect (int &err, Service::Ptr &fs) |
bool | exists (int &err, const std::string &name) override |
void | remove (int &err, const std::string &name) override |
size_t | length (int &err, const std::string &name) override |
void | mkdirs (int &err, const std::string &name) override |
void | readdir (int &err, const std::string &name, DirentList &results) override |
void | rmdir (int &err, const std::string &name) override |
void | rename (int &err, const std::string &from, const std::string &to) override |
void | write (int &err, SmartFd::Ptr &smartfd, uint8_t replication, StaticBuffer &buffer) override |
void | read (int &err, const std::string &name, StaticBuffer *dst) override |
void | combi_pread (int &err, SmartFd::Ptr &smartfd, uint64_t offset, uint32_t amount, StaticBuffer *dst) override |
void | create (int &err, SmartFd::Ptr &smartfd, uint8_t replication) override |
void | open (int &err, SmartFd::Ptr &smartfd) override |
size_t | read (int &err, SmartFd::Ptr &smartfd, void *dst, size_t amount) override |
size_t | read (int &err, SmartFd::Ptr &smartfd, StaticBuffer *dst, size_t amount) override |
size_t | pread (int &err, SmartFd::Ptr &smartfd, uint64_t offset, void *dst, size_t amount) override |
size_t | pread (int &err, SmartFd::Ptr &smartfd, uint64_t offset, StaticBuffer *dst, size_t amount) override |
size_t | append (int &err, SmartFd::Ptr &smartfd, StaticBuffer &buffer, Flags flags) override |
void | seek (int &err, SmartFd::Ptr &smartfd, size_t offset) override |
void | flush (int &err, SmartFd::Ptr &smartfd) override |
void | sync (int &err, SmartFd::Ptr &smartfd) override |
void | close (int &err, SmartFd::Ptr &smartfd) override |
![]() | |
FileSystem (const Configurables *config, ImplOptions impl_opts) | |
FileSystem (FileSystem &&)=delete | |
FileSystem (const FileSystem &)=delete | |
FileSystem & | operator= (FileSystem &&)=delete |
FileSystem & | operator= (const FileSystem &)=delete |
virtual | ~FileSystem () noexcept |
virtual Type | get_type_underlying () const noexcept |
virtual void | get_abspath (const std::string &name, std::string &abspath, size_t reserve=0) |
void | fd_open_incr () noexcept |
void | fd_open_decr () noexcept |
bool | need_fds () const noexcept |
size_t | fds_open () const noexcept |
virtual void | exists (Callback::ExistsCb_t &&cb, const std::string &name) |
virtual void | remove (Callback::RemoveCb_t &&cb, const std::string &name) |
virtual void | length (Callback::LengthCb_t &&cb, const std::string &name) |
virtual void | mkdirs (Callback::MkdirsCb_t &&cb, const std::string &name) |
virtual void | readdir (Callback::ReaddirCb_t &&cb, const std::string &name) |
virtual void | rmdir (Callback::RmdirCb_t &&cb, const std::string &name) |
virtual void | rename (Callback::RenameCb_t &&cb, const std::string &from, const std::string &to) |
void | default_write (int &err, SmartFd::Ptr &smartfd, uint8_t replication, StaticBuffer &buffer) |
virtual void | write (Callback::WriteCb_t &&cb, SmartFd::Ptr &smartfd, uint8_t replication, StaticBuffer &&buffer) |
void | default_read (int &err, const std::string &name, StaticBuffer *dst) |
virtual void | read (Callback::ReadAllCb_t &&cb, const std::string &name) |
void | default_combi_pread (int &err, SmartFd::Ptr &smartfd, uint64_t offset, uint32_t amount, StaticBuffer *dst) |
virtual void | combi_pread (Callback::CombiPreadCb_t &&cb, SmartFd::Ptr &smartfd, uint64_t offset, uint32_t amount) |
virtual void | create (Callback::CreateCb_t &&cb, SmartFd::Ptr &smartfd, uint8_t replication) |
virtual void | open (Callback::OpenCb_t &&cb, SmartFd::Ptr &smartfd) |
size_t | default_read (int &err, SmartFd::Ptr &smartfd, StaticBuffer *dst, size_t amount) |
virtual void | read (Callback::ReadCb_t &&cb, SmartFd::Ptr &smartfd, size_t amount) |
size_t | default_pread (int &err, SmartFd::Ptr &smartfd, uint64_t offset, StaticBuffer *dst, size_t amount) |
virtual void | pread (Callback::PreadCb_t &&cb, SmartFd::Ptr &smartfd, uint64_t offset, size_t amount) |
virtual void | append (Callback::AppendCb_t &&cb, SmartFd::Ptr &smartfd, StaticBuffer &buffer, Flags flags) |
virtual void | seek (Callback::CloseCb_t &&cb, SmartFd::Ptr &smartfd, size_t offset) |
virtual void | flush (Callback::FlushCb_t &&cb, SmartFd::Ptr &smartfd) |
virtual void | sync (Callback::SyncCb_t &&cb, SmartFd::Ptr &smartfd) |
virtual void | close (Callback::CloseCb_t &&cb, SmartFd::Ptr &smartfd) |
Private Member Functions | |
SmartFdHadoopJVM::Ptr | get_fd (SmartFd::Ptr &smartfd) |
Private Attributes | |
const Config::Property::Value_int32_g::Ptr | cfg_use_delay |
const Config::Property::Value_int32_g::Ptr | cfg_r_buffer_size |
const Config::Property::Value_int32_g::Ptr | cfg_w_buffer_size |
const Config::Property::Value_int32_g::Ptr | cfg_block_size |
Core::Atomic< int32_t > | m_nxt_fd |
std::mutex | m_mutex |
std::condition_variable | m_cv |
bool | m_connecting |
Service::Ptr | m_fs |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< FileSystem > | Ptr |
![]() | |
const ImplOptions | impl_options |
const std::string | path_root |
const std::string | path_data |
const Config::Settings::Ptr | settings |
const Config::Property::Value_int32_g::Ptr | cfg_fds_max |
Core::AtomicBool | m_run |
Statistics | statistics |
Definition at line 21 of file FileSystem.h.
SWC::FS::FileSystemHadoopJVM::FileSystemHadoopJVM | ( | Configurables * | config | ) |
Definition at line 130 of file FileSystem.cc.
|
delete |
|
delete |
|
virtualnoexcept |
Definition at line 148 of file FileSystem.cc.
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 614 of file FileSystem.cc.
References SWC::FS::Statistics::APPEND_SYNC, SWC::Core::Buffer< T >::base, flags, SWC::FS::FLUSH, get_fd(), get_fs(), need_reconnect(), SWC::Core::Buffer< T >::size, SWC::FS::FileSystem::statistics, SWC_FS_APPEND_FINISH, SWC_FS_APPEND_START, SWC::FS::SYNC, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 721 of file FileSystem.cc.
References SWC::FS::Statistics::CLOSE_SYNC, SWC::FS::FileSystem::fd_open_decr(), SWC::Error::FS_BAD_FILE_HANDLE, get_fd(), get_fs(), SWC::LOG_WARN, SWC::FS::FileSystem::statistics, SWC_FS_CLOSE_FINISH, SWC_FS_CLOSE_START, SWC_LOGF, and SWC::FS::Statistics::tracker().
|
inlineoverridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 88 of file FileSystem.h.
References SWC::FS::FileSystem::default_combi_pread().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 481 of file FileSystem.cc.
References SWC::Core::Atomic< T, OrderT >::add_rslt(), cfg_block_size, cfg_w_buffer_size, SWC::FS::Statistics::CREATE_SYNC, SWC::FS::FileSystem::fd_open_incr(), SWC::FS::FileSystem::fds_open(), SWC::Error::FS_PATH_NOT_FOUND, SWC::Error::FS_PERMISSION_DENIED, SWC::Config::Property::Value_int32_g::get(), SWC::FS::FileSystem::get_abspath(), get_fd(), get_fs(), m_nxt_fd, need_reconnect(), SWC::FS::OPEN_FLAG_OVERWRITE, SWC::FS::FileSystem::statistics, SWC_FS_CREATE_FINISH, SWC_FS_CREATE_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 337 of file FileSystem.cc.
References SWC::FS::Statistics::EXISTS_SYNC, SWC::FS::FileSystem::get_abspath(), get_fs(), need_reconnect(), SWC::Error::OK, SWC::FS::FileSystem::statistics, SWC_FS_EXISTS_FINISH, SWC_FS_EXISTS_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 679 of file FileSystem.cc.
References SWC::FS::Statistics::FLUSH_SYNC, get_fd(), get_fs(), need_reconnect(), SWC::FS::FileSystem::statistics, SWC_FS_FLUSH_FINISH, SWC_FS_FLUSH_START, and SWC::FS::Statistics::tracker().
|
private |
FileSystemHadoopJVM::Service::Ptr SWC::FS::FileSystemHadoopJVM::get_fs | ( | int & | err | ) |
Definition at line 297 of file FileSystem.cc.
References cfg_use_delay, SWC::Config::Property::Value_int32_g::get(), m_connecting, m_cv, m_fs, m_mutex, SWC::FS::FileSystem::m_run, SWC::Error::OK, SWC::Error::SERVER_NOT_READY, SWC::Error::SERVER_SHUTTING_DOWN, and setup_connection().
Referenced by append(), close(), create(), exists(), flush(), length(), mkdirs(), open(), pread(), read(), readdir(), remove(), rename(), rmdir(), seek(), and sync().
|
overridevirtualnoexcept |
Reimplemented from SWC::FS::FileSystem.
Definition at line 150 of file FileSystem.cc.
References SWC::FS::HADOOP_JVM.
bool SWC::FS::FileSystemHadoopJVM::initialize | ( | Service::Ptr & | fs | ) |
Definition at line 224 of file FileSystem.cc.
References SWC::Error::get_text(), SWC::LOG_ERROR, SWC::LOG_INFO, SWC::FS::FileSystem::settings, SWC_FMT_LD, and SWC_LOGF.
Referenced by setup_connection().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 371 of file FileSystem.cc.
References SWC::FS::FileSystem::get_abspath(), get_fs(), SWC::FS::Statistics::LENGTH_SYNC, need_reconnect(), SWC::FS::FileSystem::statistics, SWC_FS_LENGTH_FINISH, SWC_FS_LENGTH_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 393 of file FileSystem.cc.
References SWC::FS::FileSystem::get_abspath(), get_fs(), SWC::FS::Statistics::MKDIRS_SYNC, need_reconnect(), SWC::FS::FileSystem::statistics, SWC_FS_MKDIRS_FINISH, SWC_FS_MKDIRS_START, and SWC::FS::Statistics::tracker().
void SWC::FS::FileSystemHadoopJVM::need_reconnect | ( | int & | err, |
Service::Ptr & | fs | ||
) |
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 519 of file FileSystem.cc.
References SWC::Core::Atomic< T, OrderT >::add_rslt(), cfg_r_buffer_size, SWC::FS::FileSystem::fd_open_incr(), SWC::FS::FileSystem::fds_open(), SWC::Error::FS_PATH_NOT_FOUND, SWC::Error::FS_PERMISSION_DENIED, SWC::Config::Property::Value_int32_g::get(), SWC::FS::FileSystem::get_abspath(), get_fd(), get_fs(), m_nxt_fd, need_reconnect(), SWC::FS::Statistics::OPEN_SYNC, SWC::FS::FileSystem::statistics, SWC_FS_OPEN_FINISH, SWC_FS_OPEN_START, and SWC::FS::Statistics::tracker().
|
delete |
|
delete |
|
inlineoverridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 109 of file FileSystem.h.
References SWC::FS::FileSystem::default_pread().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 583 of file FileSystem.cc.
References SWC::Error::FS_EOF, get_fd(), get_fs(), need_reconnect(), SWC::FS::Statistics::PREAD_SYNC, SWC::FS::FileSystem::statistics, SWC_FS_PREAD_FINISH, SWC_FS_PREAD_START, and SWC::FS::Statistics::tracker().
|
inlineoverridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 84 of file FileSystem.h.
References SWC::FS::FileSystem::default_read().
|
inlineoverridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 101 of file FileSystem.h.
References SWC::FS::FileSystem::default_read().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 553 of file FileSystem.cc.
References SWC::Error::FS_EOF, get_fd(), get_fs(), need_reconnect(), SWC::FS::Statistics::READ_SYNC, SWC::FS::FileSystem::statistics, SWC_FS_READ_FINISH, SWC_FS_READ_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 408 of file FileSystem.cc.
References SWC::Core::Vector< T, SizeT, GROW_SZ >::emplace_back(), SWC::FS::FileSystem::get_abspath(), get_fs(), need_reconnect(), SWC::FS::Statistics::READDIR_SYNC, SWC::Core::Vector< T, SizeT, GROW_SZ >::reserve(), SWC::Core::Vector< T, SizeT, GROW_SZ >::size(), SWC::FS::FileSystem::statistics, SWC_FS_READDIR_FINISH, SWC_FS_READDIR_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 354 of file FileSystem.cc.
References SWC::FS::FileSystem::get_abspath(), get_fs(), need_reconnect(), SWC::Error::OK, SWC::FS::Statistics::REMOVE_SYNC, SWC::FS::FileSystem::statistics, SWC_FS_REMOVE_FINISH, SWC_FS_REMOVE_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 463 of file FileSystem.cc.
References SWC::Condition::from(), SWC::FS::FileSystem::get_abspath(), get_fs(), need_reconnect(), SWC::FS::Statistics::RENAME_SYNC, SWC::FS::FileSystem::statistics, SWC_FS_RENAME_FINISH, SWC_FS_RENAME_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 446 of file FileSystem.cc.
References SWC::FS::FileSystem::get_abspath(), get_fs(), need_reconnect(), SWC::Error::OK, SWC::FS::Statistics::RMDIR_SYNC, SWC::FS::FileSystem::statistics, SWC_FS_RMDIR_FINISH, SWC_FS_RMDIR_START, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 655 of file FileSystem.cc.
References get_fd(), get_fs(), need_reconnect(), SWC::FS::Statistics::SEEK_SYNC, SWC::FS::FileSystem::statistics, SWC_FS_SEEK_FINISH, SWC_FS_SEEK_START, and SWC::FS::Statistics::tracker().
FileSystemHadoopJVM::Service::Ptr SWC::FS::FileSystemHadoopJVM::setup_connection | ( | ) |
Definition at line 173 of file FileSystem.cc.
References cfg_block_size, SWC::Config::Property::Value_int32_g::get(), SWC::FS::FileSystem::get_abspath(), initialize(), SWC::LOG_DEBUG, SWC::LOG_ERROR, SWC::LOG_WARN, SWC::FS::FileSystem::m_run, SWC::Core::AtomicBase< T, OrderT >::store(), SWC_LOGF, and SWC::Config::Property::Value_int32_g::value.
Referenced by get_fs().
|
overridevirtual |
Reimplemented from SWC::FS::FileSystem.
Definition at line 162 of file FileSystem.cc.
References m_cv, m_fs, m_mutex, SWC::FS::FileSystem::m_run, SWC::FS::FileSystem::stop(), and SWC::Core::AtomicBase< T, OrderT >::store().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 700 of file FileSystem.cc.
References get_fd(), get_fs(), need_reconnect(), SWC::FS::FileSystem::statistics, SWC_FS_SYNC_FINISH, SWC_FS_SYNC_START, SWC::FS::Statistics::SYNC_SYNC, and SWC::FS::Statistics::tracker().
|
overridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 154 of file FileSystem.cc.
References SWC::format(), SWC::FS::FileSystem::path_data, and SWC::FS::FileSystem::path_root.
Referenced by SWC::FS::FileSystemHadoopJVM::SmartFdHadoopJVM::file().
|
inlineoverridevirtual |
Implements SWC::FS::FileSystem.
Definition at line 79 of file FileSystem.h.
References SWC::FS::FileSystem::default_write().
|
private |
Definition at line 164 of file FileSystem.h.
Referenced by create(), and setup_connection().
|
private |
Definition at line 162 of file FileSystem.h.
Referenced by open().
|
private |
Definition at line 161 of file FileSystem.h.
Referenced by get_fs().
|
private |
Definition at line 163 of file FileSystem.h.
Referenced by create().
|
private |
Definition at line 169 of file FileSystem.h.
Referenced by get_fs().
|
private |
Definition at line 168 of file FileSystem.h.
|
private |
Definition at line 170 of file FileSystem.h.
Referenced by get_fs(), need_reconnect(), and stop().
|
private |
Definition at line 167 of file FileSystem.h.
Referenced by get_fs(), need_reconnect(), and stop().
|
private |
Definition at line 166 of file FileSystem.h.