OmniSciDB  2e3a973ef4
MutableCachePersistentStorageMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "PersistentStorageMgr.h"
20 
21 /*
22  A PersistentStorageMgr with additional functionality for caching mutable tables to disk.
23  */
25  public:
26  MutableCachePersistentStorageMgr(const std::string& data_dir,
27  const size_t num_reader_threads,
28  const DiskCacheConfig& disk_cache_config);
29  AbstractBuffer* createBuffer(const ChunkKey& chunk_key,
30  const size_t page_size,
31  const size_t initial_size) override;
32  void deleteBuffer(const ChunkKey& chunk_key, const bool purge) override;
33  void deleteBuffersWithPrefix(const ChunkKey& chunk_key_prefix,
34  const bool purge) override;
35  AbstractBuffer* putBuffer(const ChunkKey& chunk_key,
36  AbstractBuffer* source_buffer,
37  const size_t num_bytes) override;
38  void checkpoint() override;
39  void checkpoint(const int db_id, const int tb_id) override;
40  void removeTableRelatedDS(const int db_id, const int table_id) override;
41 
42  private:
43  std::map<const ChunkKey, AbstractBuffer*> cached_buffer_map_;
44 };
AbstractBuffer * createBuffer(const ChunkKey &chunk_key, const size_t page_size, const size_t initial_size) override
An AbstractBuffer is a unit of data management for a data manager.
std::map< const ChunkKey, AbstractBuffer * > cached_buffer_map_
void deleteBuffersWithPrefix(const ChunkKey &chunk_key_prefix, const bool purge) override
void removeTableRelatedDS(const int db_id, const int table_id) override
MutableCachePersistentStorageMgr(const std::string &data_dir, const size_t num_reader_threads, const DiskCacheConfig &disk_cache_config)
std::vector< int > ChunkKey
Definition: types.h:37
void deleteBuffer(const ChunkKey &chunk_key, const bool purge) override
AbstractBuffer * putBuffer(const ChunkKey &chunk_key, AbstractBuffer *source_buffer, const size_t num_bytes) override