OmniSciDB  85c2d10cdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
types.h File Reference
#include <sstream>
#include <string>
#include <thread>
#include <vector>
#include "Logger/Logger.h"
+ Include dependency graph for types.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CHUNK_KEY_DB_IDX   0
 
#define CHUNK_KEY_TABLE_IDX   1
 
#define CHUNK_KEY_COLUMN_IDX   2
 
#define CHUNK_KEY_FRAGMENT_IDX   3
 

Typedefs

using ChunkKey = std::vector< int >
 

Functions

bool is_table_key (const ChunkKey &key)
 
bool has_table_prefix (const ChunkKey &key)
 
ChunkKey get_table_key (const ChunkKey &key)
 
std::pair< int, int > get_table_prefix (const ChunkKey &key)
 
bool is_column_key (const ChunkKey &key)
 
bool is_varlen_key (const ChunkKey &key)
 
bool is_varlen_data_key (const ChunkKey &key)
 
bool is_varlen_index_key (const ChunkKey &key)
 
bool in_same_table (const ChunkKey &left_key, const ChunkKey &right_key)
 
std::string show_chunk (const ChunkKey &key)
 

Macro Definition Documentation

Typedef Documentation

using ChunkKey = std::vector<int>

Definition at line 37 of file types.h.

Function Documentation

ChunkKey get_table_key ( const ChunkKey key)
inline

Definition at line 52 of file types.h.

References CHECK, CHUNK_KEY_DB_IDX, CHUNK_KEY_TABLE_IDX, and has_table_prefix().

Referenced by foreign_storage::CachingForeignStorageMgr::createOrRecoverDataWrapperIfNotExists(), MutableCachePersistentStorageMgr::deleteBuffersWithPrefix(), foreign_storage::ForeignStorageCache::evictThenEraseChunkUnlocked(), PersistentStorageMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().

52  {
53  CHECK(has_table_prefix(key));
55 }
std::vector< int > ChunkKey
Definition: types.h:37
#define CHUNK_KEY_DB_IDX
Definition: types.h:39
#define CHUNK_KEY_TABLE_IDX
Definition: types.h:40
bool has_table_prefix(const ChunkKey &key)
Definition: types.h:48
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::pair<int, int> get_table_prefix ( const ChunkKey key)
inline

Definition at line 57 of file types.h.

References CHECK, CHUNK_KEY_DB_IDX, CHUNK_KEY_TABLE_IDX, and has_table_prefix().

Referenced by foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::recoverDataWrapperFromDisk().

57  {
58  CHECK(has_table_prefix(key));
59  return std::pair<int, int>{key[CHUNK_KEY_DB_IDX], key[CHUNK_KEY_TABLE_IDX]};
60 }
#define CHUNK_KEY_DB_IDX
Definition: types.h:39
#define CHUNK_KEY_TABLE_IDX
Definition: types.h:40
bool has_table_prefix(const ChunkKey &key)
Definition: types.h:48
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool has_table_prefix ( const ChunkKey key)
inline

Definition at line 48 of file types.h.

Referenced by MutableCachePersistentStorageMgr::deleteBuffersWithPrefix(), get_table_key(), get_table_prefix(), PersistentStorageMgr::getChunkMetadataVecForKeyPrefix(), in_same_table(), PersistentStorageMgr::isChunkPrefixCacheable(), and PersistentStorageMgr::isForeignStorage().

48  {
49  return key.size() >= 2;
50 }

+ Here is the caller graph for this function:

bool in_same_table ( const ChunkKey left_key,
const ChunkKey right_key 
)
inline

Definition at line 78 of file types.h.

References CHECK, CHUNK_KEY_DB_IDX, CHUNK_KEY_TABLE_IDX, and has_table_prefix().

Referenced by File_Namespace::CachingFileMgr::clearForTable().

78  {
79  CHECK(has_table_prefix(left_key));
80  CHECK(has_table_prefix(right_key));
81  return (left_key[CHUNK_KEY_DB_IDX] == right_key[CHUNK_KEY_DB_IDX] &&
82  left_key[CHUNK_KEY_TABLE_IDX] == right_key[CHUNK_KEY_TABLE_IDX]);
83 }
#define CHUNK_KEY_DB_IDX
Definition: types.h:39
#define CHUNK_KEY_TABLE_IDX
Definition: types.h:40
bool has_table_prefix(const ChunkKey &key)
Definition: types.h:48
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool is_column_key ( const ChunkKey key)
inline

Definition at line 62 of file types.h.

62  {
63  return key.size() == 3;
64 }
bool is_table_key ( const ChunkKey key)
inline
bool is_varlen_data_key ( const ChunkKey key)
inline

Definition at line 70 of file types.h.

Referenced by foreign_storage::ForeignStorageCache::cacheMetadataVec(), foreign_storage::ForeignStorageCache::recoverCacheForTable(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().

70  {
71  return key.size() == 5 && key[4] == 1;
72 }

+ Here is the caller graph for this function:

bool is_varlen_index_key ( const ChunkKey key)
inline

Definition at line 74 of file types.h.

74  {
75  return key.size() == 5 && key[4] == 2;
76 }
bool is_varlen_key ( const ChunkKey key)
inline

Definition at line 66 of file types.h.

Referenced by foreign_storage::ForeignStorageCache::cacheMetadataVec(), foreign_storage::ForeignStorageCache::recoverCacheForTable(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().

66  {
67  return key.size() == 5;
68 }

+ Here is the caller graph for this function:

std::string show_chunk ( const ChunkKey key)
inline

Definition at line 85 of file types.h.

Referenced by File_Namespace::FileMgr::createBufferUnlocked(), File_Namespace::FileMgr::deleteBuffer(), File_Namespace::FileBuffer::dump(), foreign_storage::ForeignStorageCache::dumpCachedChunkEntries(), foreign_storage::ForeignStorageCache::dumpCachedMetadataEntries(), File_Namespace::FileMgr::fetchBuffer(), File_Namespace::FileBuffer::FileBuffer(), File_Namespace::FileMgr::getBuffer(), File_Namespace::FileInfo::openExistingFile(), File_Namespace::FileMgr::putBuffer(), and Fragmenter_Namespace::InsertOrderFragmenter::updateChunkStats().

85  {
86  std::ostringstream tss;
87  for (auto vecIt = key.begin(); vecIt != key.end(); ++vecIt) {
88  tss << *vecIt << ",";
89  }
90  return tss.str();
91 }

+ Here is the caller graph for this function: