OmniSciDB  2e3a973ef4
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;
37  void refreshTable(const ChunkKey& table_key, const bool evict_cached_entries) override;
38 
39  private:
40  void recoverDataWrapperFromDisk(const ChunkKey& table_key,
41  const ChunkMetadataVector& chunk_metadata);
42  void refreshTableInCache(const ChunkKey& table_key);
43  int getHighestCachedFragId(const ChunkKey& table_key);
44  void refreshAppendTableInCache(const ChunkKey& table_key,
45  const std::vector<ChunkKey>& old_chunk_keys);
46  void refreshNonAppendTableInCache(const ChunkKey& table_key,
47  const std::vector<ChunkKey>& old_chunk_keys);
48  void refreshChunksInCacheByFragment(const std::vector<ChunkKey>& old_chunk_keys,
49  int last_frag_id);
50  void createOrRecoverDataWrapperIfNotExists(const ChunkKey& chunk_key);
52 };
53 
54 } // namespace foreign_storage
void refreshAppendTableInCache(const ChunkKey &table_key, const std::vector< ChunkKey > &old_chunk_keys)
void refreshTableInCache(const ChunkKey &table_key)
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 createOrRecoverDataWrapperIfNotExists(const ChunkKey &chunk_key)
void refreshChunksInCacheByFragment(const std::vector< ChunkKey > &old_chunk_keys, int last_frag_id)
void recoverDataWrapperFromDisk(const ChunkKey &table_key, const ChunkMetadataVector &chunk_metadata)
An AbstractBuffer is a unit of data management for a data manager.
void refreshTable(const ChunkKey &table_key, const bool evict_cached_entries) override
std::vector< int > ChunkKey
Definition: types.h:37
std::vector< std::pair< ChunkKey, std::shared_ptr< ChunkMetadata > >> ChunkMetadataVector
void fetchBuffer(const ChunkKey &chunk_key, AbstractBuffer *destination_buffer, const size_t num_bytes) override
int getHighestCachedFragId(const ChunkKey &table_key)