OmniSciDB  2e3a973ef4
DummyPersistentForeignStorage Class Reference

#include <DummyForeignStorage.h>

+ Inheritance diagram for DummyPersistentForeignStorage:
+ Collaboration diagram for DummyPersistentForeignStorage:

Public Member Functions

void append (const std::vector< ForeignStorageColumnBuffer > &column_buffers) override
 
void read (const ChunkKey &chunk_key, const SQLTypeInfo &sql_type, int8_t *dest, const size_t numBytes) override
 
std::string getType () const override
 
- Public Member Functions inherited from PersistentForeignStorageInterface
virtual ~PersistentForeignStorageInterface ()
 
virtual void prepareTable (const int, const std::string &type, TableDescriptor &, std::list< ColumnDescriptor > &)
 
virtual void registerTable (Catalog_Namespace::Catalog *catalog, std::pair< int, int > table_key, const std::string &type, const TableDescriptor &td, const std::list< ColumnDescriptor > &cols, Data_Namespace::AbstractBufferMgr *mgr)=0
 

Private Member Functions

void append (const ChunkKey &chunk_key, const SQLTypeInfo &sql_type, const int8_t *src, const size_t numBytes)
 

Private Attributes

std::map< ChunkKey, std::vector< int8_t > > files_
 
std::mutex files_mutex_
 

Detailed Description

Definition at line 21 of file DummyForeignStorage.h.

Member Function Documentation

◆ append() [1/2]

void DummyPersistentForeignStorage::append ( const std::vector< ForeignStorageColumnBuffer > &  column_buffers)
overridevirtual

Implements PersistentForeignStorageInterface.

Definition at line 19 of file DummyForeignStorage.cpp.

References append(), and files_mutex_.

Referenced by append().

20  {
21  std::lock_guard<std::mutex> files_lock(files_mutex_);
22  for (const auto& column_buffer : column_buffers) {
23  append(column_buffer.chunk_key,
24  column_buffer.sql_type,
25  &column_buffer.buff[0],
26  column_buffer.buff.size());
27  }
28 }
void append(const std::vector< ForeignStorageColumnBuffer > &column_buffers) override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ append() [2/2]

void DummyPersistentForeignStorage::append ( const ChunkKey chunk_key,
const SQLTypeInfo sql_type,
const int8_t *  src,
const size_t  numBytes 
)
private

Definition at line 46 of file DummyForeignStorage.cpp.

References parse_ast::end, and files_.

49  {
50  files_[chunk_key].insert(files_[chunk_key].end(), src, src + numBytes);
51 }
int64_t * src
std::map< ChunkKey, std::vector< int8_t > > files_

◆ getType()

std::string DummyPersistentForeignStorage::getType ( ) const
overridevirtual

Implements PersistentForeignStorageInterface.

Definition at line 42 of file DummyForeignStorage.cpp.

42  {
43  return "DUMMY";
44 }

◆ read()

void DummyPersistentForeignStorage::read ( const ChunkKey chunk_key,
const SQLTypeInfo sql_type,
int8_t *  dest,
const size_t  numBytes 
)
overridevirtual

Implements PersistentForeignStorageInterface.

Definition at line 30 of file DummyForeignStorage.cpp.

References CHECK, CHECK_EQ, files_, files_mutex_, and src.

33  {
34  std::lock_guard<std::mutex> files_lock(files_mutex_);
35  const auto it = files_.find(chunk_key);
36  CHECK(it != files_.end());
37  const auto& src = it->second;
38  CHECK_EQ(numBytes, src.size());
39  memcpy(dest, &src[0], numBytes);
40 }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
int64_t * src
std::map< ChunkKey, std::vector< int8_t > > files_
#define CHECK(condition)
Definition: Logger.h:197

Member Data Documentation

◆ files_

std::map<ChunkKey, std::vector<int8_t> > DummyPersistentForeignStorage::files_
private

Definition at line 38 of file DummyForeignStorage.h.

Referenced by append(), and read().

◆ files_mutex_

std::mutex DummyPersistentForeignStorage::files_mutex_
private

Definition at line 39 of file DummyForeignStorage.h.

Referenced by append(), and read().


The documentation for this class was generated from the following files: