OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CachingForeignStorageMgr.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright 2020 OmniSci, Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #include "ForeignStorageCache.h"
21 #include "ForeignStorageMgr.h"
22 
23 namespace foreign_storage {
24 
25 /*
26  A version of the ForeignStorageMgr that incorporates disk caching.
27  */
29  public:
31 
32  void fetchBuffer(const ChunkKey& chunk_key,
33  AbstractBuffer* destination_buffer,
34  const size_t num_bytes) override;
36  const ChunkKey& chunk_key_prefix) override;
38  const ChunkKey& chunk_key_prefix);
39  void removeTableRelatedDS(const int db_id, const int table_id) override;
40  void refreshTable(const ChunkKey& table_key, const bool evict_cached_entries) override;
41  bool createDataWrapperIfNotExists(const ChunkKey& chunk_key) override;
42 
43  private:
44  void refreshTableInCache(const ChunkKey& table_key);
45  int getHighestCachedFragId(const ChunkKey& table_key);
46  void refreshAppendTableInCache(const ChunkKey& table_key,
47  const std::vector<ChunkKey>& old_chunk_keys);
48  void refreshNonAppendTableInCache(const ChunkKey& table_key,
49  const std::vector<ChunkKey>& old_chunk_keys);
50  void refreshChunksInCacheByFragment(const std::vector<ChunkKey>& old_chunk_keys,
51  int last_frag_id);
53  ChunkToBufferMap& required_buffers,
54  ChunkToBufferMap& optional_buffers);
55  void clearTable(const ChunkKey& table_key);
57 };
58 
59 } // namespace foreign_storage
void refreshAppendTableInCache(const ChunkKey &table_key, const std::vector< ChunkKey > &old_chunk_keys)
std::vector< int > ChunkKey
Definition: types.h:37
std::map< ChunkKey, AbstractBuffer * > ChunkToBufferMap
void refreshTableInCache(const ChunkKey &table_key)
void getChunkMetadataVecFromDataWrapper(ChunkMetadataVector &chunk_metadata, const ChunkKey &chunk_key_prefix)
void refreshNonAppendTableInCache(const ChunkKey &table_key, const std::vector< ChunkKey > &old_chunk_keys)
void getChunkMetadataVecForKeyPrefix(ChunkMetadataVector &chunk_metadata, const ChunkKey &chunk_key_prefix) override
void refreshChunksInCacheByFragment(const std::vector< ChunkKey > &old_chunk_keys, int last_frag_id)
bool createDataWrapperIfNotExists(const ChunkKey &chunk_key) override
std::vector< std::pair< ChunkKey, std::shared_ptr< ChunkMetadata >>> ChunkMetadataVector
An AbstractBuffer is a unit of data management for a data manager.
void populateChunkBuffersSafely(ForeignDataWrapper &data_wrapper, ChunkToBufferMap &required_buffers, ChunkToBufferMap &optional_buffers)
void refreshTable(const ChunkKey &table_key, const bool evict_cached_entries) override
void fetchBuffer(const ChunkKey &chunk_key, AbstractBuffer *destination_buffer, const size_t num_bytes) override
void removeTableRelatedDS(const int db_id, const int table_id) override
int getHighestCachedFragId(const ChunkKey &table_key)