19 #include "../AbstractBufferMgr.h" 22 #include <unordered_map> 27 const std::vector<int8_t>
buff;
34 virtual void append(
const std::vector<ForeignStorageColumnBuffer>& column_buffers) = 0;
38 const size_t num_bytes) = 0;
41 const size_t num_bytes) {
45 const std::string&
type,
47 std::list<ColumnDescriptor>& ) {}
49 std::pair<int, int> table_key,
50 const std::string&
type,
52 const std::list<ColumnDescriptor>& cols,
53 Data_Namespace::AbstractBufferMgr* mgr) = 0;
54 virtual std::string getType()
const = 0;
62 void read(int8_t*
const dst,
63 const size_t numBytes,
64 const size_t offset = 0,
66 const int dstDeviceId = -1)
override;
69 const size_t numBytes,
71 const int deviceId = -1)
override;
77 std::vector<int8_t>
moveBuffer() {
return std::move(buff_); }
80 const size_t numBytes,
81 const size_t offset = 0,
83 const int srcDeviceId = -1)
override {
109 int8_t* tryZeroCopy(
const size_t numBytes);
123 void checkpoint()
override;
126 const size_t pageSize = 0,
127 const size_t initialSize = 0)
override;
130 const size_t numBytes = 0)
override;
132 void fetchBuffer(
const ChunkKey& key,
134 const size_t numBytes = 0)
override;
137 const ChunkKey& keyPrefix)
override;
141 mapd_shared_lock<mapd_shared_mutex> chunk_index_write_lock(chunk_index_mutex_);
142 return chunk_index_.size();
150 const bool purge =
true)
override {
156 const size_t numBytes = 0)
override {
214 std::map<ChunkKey, std::unique_ptr<ForeignStorageBuffer>>
chunk_index_;
220 static Data_Namespace::AbstractBufferMgr* lookupBufferManager(
const int db_id,
223 static void registerPersistentStorageInterface(
224 std::unique_ptr<PersistentForeignStorageInterface> persistent_foreign_storage);
226 static void destroy();
229 static void prepareTable(
const int db_id,
231 std::list<ColumnDescriptor>& cols);
235 const std::list<ColumnDescriptor>& cols);
238 static std::unordered_map<std::string,
239 std::unique_ptr<PersistentForeignStorageInterface>>
243 static std::map<std::pair<int, int>, std::unique_ptr<ForeignStorageBufferMgr>>
void reserve(size_t numBytes) override
PersistentForeignStorageInterface * persistent_foreign_storage_
void deleteBuffer(const ChunkKey &key, const bool purge=true) override
virtual ~PersistentForeignStorageInterface()
void checkpoint(const int db_id, const int tb_id) override
class for a per-database catalog. also includes metadata for the current database and the current use...
void clearSlabs() override
size_t reservedSize() const override
const ChunkKey chunk_key_
std::string getStringMgrType() override
std::vector< int8_t > moveBuffer()
size_t pageSize() const override
void write(int8_t *src, const size_t numBytes, const size_t offset=0, const Data_Namespace::MemoryLevel srcBufferType=Data_Namespace::CPU_LEVEL, const int srcDeviceId=-1) override
bool isAllocationCapped() override
void free(Data_Namespace::AbstractBuffer *buffer) override
MgrType getMgrType() override
int8_t * getMemoryPtr() override
This file contains the class specification and related data structures for Catalog.
Data_Namespace::AbstractBuffer * putBuffer(const ChunkKey &key, Data_Namespace::AbstractBuffer *srcBuffer, const size_t numBytes=0) override
bool isBufferOnDevice(const ChunkKey &key) override
size_t read(FILE *f, const size_t offset, const size_t size, int8_t *buf)
Reads the specified number of bytes from the offset position in file f into buf.
std::shared_timed_mutex mapd_shared_mutex
virtual void prepareTable(const int, const std::string &type, TableDescriptor &, std::list< ColumnDescriptor > &)
size_t getAllocated() override
size_t getNumChunks() override
mapd_shared_mutex chunk_index_mutex_
An AbstractBuffer is a unit of data management for a data manager.
static std::map< std::pair< int, int >, std::unique_ptr< ForeignStorageBufferMgr > > managers_map_
size_t append(FILE *f, const size_t size, int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
static std::mutex persistent_storage_interfaces_mutex_
std::map< ChunkKey, std::unique_ptr< ForeignStorageBuffer > > chunk_index_
std::vector< int8_t > buff_
virtual int8_t * tryZeroCopy(const ChunkKey &chunk_key, const SQLTypeInfo &sql_type, const size_t num_bytes)
const SQLTypeInfo sql_type
Data_Namespace::AbstractBuffer * alloc(const size_t numBytes=0) override
size_t getMaxSize() override
static std::map< std::pair< int, int >, PersistentForeignStorageInterface * > table_persistent_storage_interface_map_
Data_Namespace::MemoryLevel getType() const override
std::vector< int > ChunkKey
static std::unordered_map< std::string, std::unique_ptr< PersistentForeignStorageInterface > > persistent_storage_interfaces_
size_t getInUseSize() override
std::string printSlabs() override
PersistentForeignStorageInterface * persistent_foreign_storage_
void deleteBuffersWithPrefix(const ChunkKey &keyPrefix, const bool purge=true) override
size_t pageCount() const override
const std::vector< int8_t > buff
void removeTableRelatedDS(const int db_id, const int table_id) override