OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 int8_t * tryZeroCopy (const ChunkKey &chunk_key, const SQLTypeInfo &sql_type, const size_t num_bytes)
 
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
 
virtual void dropTable (const int db_id, const int table_id)=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

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:

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 files_.

49  {
50  files_[chunk_key].insert(files_[chunk_key].end(), src, src + numBytes);
51 }
std::map< ChunkKey, std::vector< int8_t > > files_
std::string DummyPersistentForeignStorage::getType ( ) const
overridevirtual

Implements PersistentForeignStorageInterface.

Definition at line 42 of file DummyForeignStorage.cpp.

42  {
43  return "DUMMY";
44 }
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_, and files_mutex_.

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:301
std::map< ChunkKey, std::vector< int8_t > > files_
#define CHECK(condition)
Definition: Logger.h:291

Member Data Documentation

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

Definition at line 38 of file DummyForeignStorage.h.

Referenced by append(), and read().

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: