OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data_Namespace::AbstractBuffer Class Referenceabstract

An AbstractBuffer is a unit of data management for a data manager. More...

#include <AbstractBuffer.h>

+ Inheritance diagram for Data_Namespace::AbstractBuffer:
+ Collaboration diagram for Data_Namespace::AbstractBuffer:

Public Member Functions

 AbstractBuffer (const int device_id)
 
 AbstractBuffer (const int device_id, const SQLTypeInfo sql_type)
 
virtual ~AbstractBuffer ()
 
virtual void read (int8_t *const dst, const size_t num_bytes, const size_t offset=0, const MemoryLevel dst_buffer_type=CPU_LEVEL, const int dst_device_id=-1)=0
 
virtual void write (int8_t *src, const size_t num_bytes, const size_t offset=0, const MemoryLevel src_buffer_type=CPU_LEVEL, const int src_device_id=-1)=0
 
virtual void reserve (size_t num_bytes)=0
 
virtual void append (int8_t *src, const size_t num_bytes, const MemoryLevel src_buffer_type=CPU_LEVEL, const int device_id=-1)=0
 
virtual int8_t * getMemoryPtr ()=0
 
virtual size_t pageCount () const =0
 
virtual size_t pageSize () const =0
 
virtual size_t size () const =0
 
virtual size_t reservedSize () const =0
 
virtual int getDeviceId () const
 
virtual MemoryLevel getType () const =0
 
virtual int pin ()
 
virtual int unPin ()
 
virtual int getPinCount ()
 
virtual bool isDirty () const
 
virtual bool isAppended () const
 
virtual bool isUpdated () const
 
virtual void setDirty ()
 
virtual void setUpdated ()
 
virtual void setAppended ()
 
void setSize (const size_t size)
 
void clearDirtyBits ()
 
void initEncoder (const SQLTypeInfo tmp_sql_type)
 
void syncEncoder (const AbstractBuffer *src_buffer)
 

Public Attributes

std::unique_ptr< Encoderencoder
 
bool has_encoder
 
SQLTypeInfo sql_type
 

Protected Attributes

size_t size_
 
bool is_dirty_
 
bool is_appended_
 
bool is_updated_
 
int device_id_
 

Detailed Description

An AbstractBuffer is a unit of data management for a data manager.

Definition at line 47 of file AbstractBuffer.h.

Constructor & Destructor Documentation

Data_Namespace::AbstractBuffer::AbstractBuffer ( const int  device_id)
inline
Data_Namespace::AbstractBuffer::AbstractBuffer ( const int  device_id,
const SQLTypeInfo  sql_type 
)
inline

Definition at line 56 of file AbstractBuffer.h.

References initEncoder().

57  : size_(0)
58  , is_dirty_(false)
59  , is_appended_(false)
60  , is_updated_(false)
61  , device_id_(device_id) {
62  initEncoder(sql_type);
63  }
void initEncoder(const SQLTypeInfo tmp_sql_type)

+ Here is the call graph for this function:

virtual Data_Namespace::AbstractBuffer::~AbstractBuffer ( )
inlinevirtual

Definition at line 64 of file AbstractBuffer.h.

64 {}

Member Function Documentation

virtual void Data_Namespace::AbstractBuffer::append ( int8_t *  src,
const size_t  num_bytes,
const MemoryLevel  src_buffer_type = CPU_LEVEL,
const int  device_id = -1 
)
pure virtual
void Data_Namespace::AbstractBuffer::clearDirtyBits ( )
inline

Definition at line 112 of file AbstractBuffer.h.

References is_appended_, is_dirty_, and is_updated_.

Referenced by File_Namespace::FileMgr::putBuffer(), and Buffer_Namespace::BufferMgr::putBuffer().

112  {
113  is_appended_ = false;
114  is_updated_ = false;
115  is_dirty_ = false;
116  }

+ Here is the caller graph for this function:

virtual int Data_Namespace::AbstractBuffer::getDeviceId ( ) const
inlinevirtual

Definition at line 87 of file AbstractBuffer.h.

References device_id_.

Referenced by Data_Namespace::DataMgr::copy(), File_Namespace::FileMgr::fetchBuffer(), Buffer_Namespace::BufferMgr::fetchBuffer(), Data_Namespace::DataMgr::free(), File_Namespace::FileMgr::putBuffer(), and Buffer_Namespace::BufferMgr::putBuffer().

+ Here is the caller graph for this function:

virtual int Data_Namespace::AbstractBuffer::getPinCount ( )
inlinevirtual

Reimplemented in Buffer_Namespace::Buffer.

Definition at line 93 of file AbstractBuffer.h.

93 { return 0; }
virtual MemoryLevel Data_Namespace::AbstractBuffer::getType ( ) const
pure virtual
void Data_Namespace::AbstractBuffer::initEncoder ( const SQLTypeInfo  tmp_sql_type)
inline

Definition at line 117 of file AbstractBuffer.h.

References Encoder::Create(), encoder, logger::FATAL, SQLTypeInfoCore< TYPE_FACET_PACK >::get_type_name(), has_encoder, LOG_IF, and sql_type.

Referenced by AbstractBuffer(), Chunk_NS::Chunk::init_encoder(), File_Namespace::FileBuffer::readMetadata(), and syncEncoder().

117  {
118  has_encoder = true;
119  sql_type = tmp_sql_type;
120  encoder.reset(Encoder::Create(this, sql_type));
121  LOG_IF(FATAL, encoder == nullptr)
122  << "Failed to create encoder for SQL Type " << sql_type.get_type_name();
123  }
static Encoder * Create(Data_Namespace::AbstractBuffer *buffer, const SQLTypeInfo sqlType)
Definition: Encoder.cpp:26
#define LOG_IF(severity, condition)
Definition: Logger.h:276
std::string get_type_name() const
Definition: sqltypes.h:429
std::unique_ptr< Encoder > encoder

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool Data_Namespace::AbstractBuffer::isAppended ( ) const
inlinevirtual

Definition at line 96 of file AbstractBuffer.h.

References is_appended_.

Referenced by File_Namespace::FileMgr::putBuffer(), and Buffer_Namespace::BufferMgr::putBuffer().

+ Here is the caller graph for this function:

virtual bool Data_Namespace::AbstractBuffer::isDirty ( ) const
inlinevirtual

Reimplemented in File_Namespace::FileBuffer, and Buffer_Namespace::Buffer.

Definition at line 95 of file AbstractBuffer.h.

References is_dirty_.

Referenced by StringNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), File_Namespace::FileMgr::fetchBuffer(), File_Namespace::FileMgr::putBuffer(), and Buffer_Namespace::BufferMgr::putBuffer().

+ Here is the caller graph for this function:

virtual bool Data_Namespace::AbstractBuffer::isUpdated ( ) const
inlinevirtual

Definition at line 97 of file AbstractBuffer.h.

References is_updated_.

Referenced by File_Namespace::FileMgr::fetchBuffer(), Buffer_Namespace::BufferMgr::fetchBuffer(), File_Namespace::FileMgr::putBuffer(), and Buffer_Namespace::BufferMgr::putBuffer().

+ Here is the caller graph for this function:

virtual size_t Data_Namespace::AbstractBuffer::pageCount ( ) const
pure virtual
virtual size_t Data_Namespace::AbstractBuffer::pageSize ( ) const
pure virtual
virtual int Data_Namespace::AbstractBuffer::pin ( )
inlinevirtual

Reimplemented in Buffer_Namespace::Buffer.

Definition at line 91 of file AbstractBuffer.h.

Referenced by Buffer_Namespace::BufferMgr::fetchBuffer().

91 { return 0; }

+ Here is the caller graph for this function:

virtual void Data_Namespace::AbstractBuffer::read ( int8_t *const  dst,
const size_t  num_bytes,
const size_t  offset = 0,
const MemoryLevel  dst_buffer_type = CPU_LEVEL,
const int  dst_device_id = -1 
)
pure virtual

Implemented in File_Namespace::FileBuffer, and Buffer_Namespace::Buffer.

Referenced by StringNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), File_Namespace::FileMgr::fetchBuffer(), and Buffer_Namespace::BufferMgr::fetchBuffer().

+ Here is the caller graph for this function:

virtual void Data_Namespace::AbstractBuffer::reserve ( size_t  num_bytes)
pure virtual

Implemented in Buffer_Namespace::Buffer, and File_Namespace::FileBuffer.

Referenced by StringNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), File_Namespace::FileMgr::fetchBuffer(), and Buffer_Namespace::BufferMgr::fetchBuffer().

+ Here is the caller graph for this function:

virtual size_t Data_Namespace::AbstractBuffer::reservedSize ( ) const
pure virtual
virtual void Data_Namespace::AbstractBuffer::setAppended ( )
inlinevirtual

Definition at line 106 of file AbstractBuffer.h.

References is_appended_, and is_dirty_.

106  {
107  is_appended_ = true;
108  is_dirty_ = true;
109  }
virtual void Data_Namespace::AbstractBuffer::setDirty ( )
inlinevirtual

Definition at line 99 of file AbstractBuffer.h.

References is_dirty_.

Referenced by StringNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), and File_Namespace::FileMgr::init().

+ Here is the caller graph for this function:

void Data_Namespace::AbstractBuffer::setSize ( const size_t  size)
inline

Definition at line 111 of file AbstractBuffer.h.

References size(), and size_.

Referenced by File_Namespace::FileMgr::fetchBuffer(), Buffer_Namespace::BufferMgr::fetchBuffer(), File_Namespace::FileMgr::init(), and File_Namespace::FileMgr::putBuffer().

111 { size_ = size; }
virtual size_t size() const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void Data_Namespace::AbstractBuffer::setUpdated ( )
inlinevirtual

Definition at line 101 of file AbstractBuffer.h.

References is_dirty_, and is_updated_.

101  {
102  is_updated_ = true;
103  is_dirty_ = true;
104  }
virtual size_t Data_Namespace::AbstractBuffer::size ( ) const
pure virtual
void Data_Namespace::AbstractBuffer::syncEncoder ( const AbstractBuffer src_buffer)
inline

Definition at line 125 of file AbstractBuffer.h.

References encoder, has_encoder, initEncoder(), and sql_type.

Referenced by File_Namespace::FileMgr::fetchBuffer(), Buffer_Namespace::BufferMgr::fetchBuffer(), File_Namespace::FileMgr::init(), File_Namespace::FileMgr::putBuffer(), and Buffer_Namespace::BufferMgr::putBuffer().

125  {
126  has_encoder = src_buffer->has_encoder;
127  if (has_encoder) {
128  if (!encoder) { // Encoder not initialized
129  initEncoder(src_buffer->sql_type);
130  }
131  encoder->copyMetadata(src_buffer->encoder.get());
132  }
133  }
void initEncoder(const SQLTypeInfo tmp_sql_type)
std::unique_ptr< Encoder > encoder

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual int Data_Namespace::AbstractBuffer::unPin ( )
inlinevirtual

Reimplemented in Buffer_Namespace::Buffer.

Definition at line 92 of file AbstractBuffer.h.

Referenced by Buffer_Namespace::BufferMgr::fetchBuffer(), and Chunk_NS::Chunk::unpin_buffer().

92 { return 0; }

+ Here is the caller graph for this function:

virtual void Data_Namespace::AbstractBuffer::write ( int8_t *  src,
const size_t  num_bytes,
const size_t  offset = 0,
const MemoryLevel  src_buffer_type = CPU_LEVEL,
const int  src_device_id = -1 
)
pure virtual

Implemented in File_Namespace::FileBuffer, and Buffer_Namespace::Buffer.

Referenced by Data_Namespace::DataMgr::copy(), File_Namespace::FileMgr::putBuffer(), and Buffer_Namespace::BufferMgr::putBuffer().

+ Here is the caller graph for this function:

Member Data Documentation

int Data_Namespace::AbstractBuffer::device_id_
protected
bool Data_Namespace::AbstractBuffer::has_encoder
bool Data_Namespace::AbstractBuffer::is_updated_
protected

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