25 #ifndef DATAMGR_MEMORY_FILE_GLOBAL_FILEMGR_H
26 #define DATAMGR_MEMORY_FILE_GLOBAL_FILEMGR_H
32 #include "../Shared/heavyai_shared_mutex.h"
34 #include "../AbstractBuffer.h"
35 #include "../AbstractBufferMgr.h"
40 using namespace Data_Namespace;
42 namespace File_Namespace {
59 std::shared_ptr<ForeignStorageInterface>
fsi,
60 std::string base_path =
".",
61 const size_t num_reader_threads = 0,
70 const size_t numBytes = 0)
override {
71 return getFileMgr(key)->createBuffer(key, pageSize, numBytes);
75 return getFileMgr(key)->isBufferOnDevice(key);
83 return getFileMgr(key)->deleteBuffer(key, purge);
86 void deleteBuffersWithPrefix(
const ChunkKey& keyPrefix,
87 const bool purge =
true)
override;
91 return getFileMgr(key)->getBuffer(key, numBytes);
96 const size_t numBytes)
override {
97 return getFileMgr(key)->fetchBuffer(key, destBuffer, numBytes);
108 const size_t numBytes = 0)
override {
109 return getFileMgr(key)->putBuffer(key, d, numBytes);
114 LOG(
FATAL) <<
"Operation not supported";
120 inline MgrType
getMgrType()
override {
return GLOBAL_FILE_MGR; };
122 inline std::string
printSlabs()
override {
return "Not Implemented"; }
131 const ChunkKey& keyPrefix)
override {
132 return getFileMgr(keyPrefix)->getChunkMetadataVecForKeyPrefix(chunkMetadataVec,
140 void checkpoint()
override;
141 void checkpoint(
const int32_t db_id,
const int32_t tb_id)
override;
149 size_t getNumChunks()
override;
151 void compactDataFiles(
const int32_t db_id,
const int32_t tb_id);
154 AbstractBufferMgr* findFileMgrUnlocked(
const int32_t db_id,
const int32_t tb_id);
155 void deleteFileMgr(
const int32_t db_id,
const int32_t tb_id);
158 AbstractBufferMgr*
findFileMgr(
const int32_t db_id,
const int32_t tb_id) {
160 return findFileMgrUnlocked(db_id, tb_id);
162 void setFileMgrParams(
const int32_t db_id,
165 AbstractBufferMgr* getFileMgr(
const int32_t db_id,
const int32_t tb_id);
167 return getFileMgr(key[0], key[1]);
174 void writeFileMgrData(
FileMgr* fileMgr = 0);
180 void removeTableRelatedDS(
const int32_t db_id,
const int32_t tb_id)
override;
181 void setTableEpoch(
const int32_t db_id,
const int32_t tb_id,
const int32_t start_epoch);
182 size_t getTableEpoch(
const int32_t db_id,
const int32_t tb_id);
183 void resetTableEpochFloor(
const int32_t db_id,
const int32_t tb_id);
184 StorageStats getStorageStats(
const int32_t db_id,
const int32_t tb_id);
187 std::shared_ptr<FileMgr> getSharedFileMgr(
const int db_id,
const int table_id);
190 void setFileMgr(
const int db_id,
const int table_id, std::shared_ptr<FileMgr> file_mgr);
191 void closeFileMgr(
const int32_t db_id,
192 const int32_t tb_id);
195 std::shared_ptr<ForeignStorageInterface>
fsi_;
198 bool existsDiffBetweenFileMgrParamsAndFileMgr(
231 #endif // DATAMGR_MEMORY_FILE_GLOBAL_FILEMGR_H
AbstractBuffer * putBuffer(const ChunkKey &key, AbstractBuffer *d, const size_t numBytes=0) override
Puts the contents of d into the Chunk with the given key.
std::vector< int > ChunkKey
std::string getBasePath() const
int32_t epoch_
number of threads used when loading data
std::shared_ptr< ForeignStorageInterface > fsi_
heavyai::shared_lock< heavyai::shared_mutex > read_lock
bool isBufferOnDevice(const ChunkKey &key) override
AbstractBuffer * createBuffer(const ChunkKey &key, size_t pageSize=0, const size_t numBytes=0) override
Creates a chunk with the specified key and page size.
std::map< TablePair, std::shared_ptr< FileMgr > > ownedFileMgrs_
void setDBConvert(bool val)
bool isAllocationCapped() override
AbstractBuffer * alloc(const size_t numBytes) override
This file includes the class specification for the FILE manager (FileMgr), and related data structure...
bool getDBConvert() const
AbstractBufferMgr * getFileMgr(const ChunkKey &key)
#define DEFAULT_METADATA_PAGE_SIZE
int32_t getDBVersion() const
std::string getStringMgrType() override
std::shared_lock< T > shared_lock
std::map< TablePair, AbstractBufferMgr * > allFileMgrs_
size_t getAllocated() override
void init(LogOptions const &log_opts)
const size_t metadata_page_size_
used to set FileMgr page_size_
~GlobalFileMgr() override
int32_t omnisci_db_version_
used to set FileMgr metadta_page_size_
An AbstractBuffer is a unit of data management for a data manager.
size_t getMetadataPageSize() const
void getChunkMetadataVecForKeyPrefix(ChunkMetadataVector &chunkMetadataVec, const ChunkKey &keyPrefix) override
std::string printSlabs() override
#define DEFAULT_PAGE_SIZE
void deleteBuffer(const ChunkKey &key, const bool purge=true) override
Deletes the chunk with the specified key.
MgrType getMgrType() override
size_t getMaxSize() override
size_t getPageSize() const
AbstractBuffer * getBuffer(const ChunkKey &key, const size_t numBytes=0) override
Returns the a pointer to the chunk with the specified key.
void free(AbstractBuffer *buffer) override
size_t num_reader_threads_
The OS file system path containing the files.
std::map< TablePair, int32_t > max_rollback_epochs_per_table_
AbstractBufferMgr * findFileMgr(const int32_t db_id, const int32_t tb_id)
std::map< TablePair, StorageStats > lazy_initialized_stats_
void fetchBuffer(const ChunkKey &key, AbstractBuffer *destBuffer, const size_t numBytes) override
std::shared_timed_mutex shared_mutex
size_t getNumReaderThreads()
Returns number of threads defined by parameter num-reader-threads which should be used during initial...
int32_t max_rollback_epochs
size_t getInUseSize() override
heavyai::shared_mutex fileMgrs_mutex_