OmniSciDB  5ade3759e0
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 deviceId)
 
 AbstractBuffer (const int deviceId, const SQLTypeInfo sqlType)
 
virtual ~AbstractBuffer ()
 
virtual void read (int8_t *const dst, const size_t numBytes, const size_t offset=0, const MemoryLevel dstBufferType=CPU_LEVEL, const int dstDeviceId=-1)=0
 
virtual void write (int8_t *src, const size_t numBytes, const size_t offset=0, const MemoryLevel srcBufferType=CPU_LEVEL, const int srcDeviceId=-1)=0
 
virtual void reserve (size_t numBytes)=0
 
virtual void append (int8_t *src, const size_t numBytes, const MemoryLevel srcBufferType=CPU_LEVEL, const int deviceId=-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 tmpSqlType)
 
void syncEncoder (const AbstractBuffer *srcBuffer)
 

Public Attributes

std::unique_ptr< Encoderencoder
 
bool hasEncoder
 
SQLTypeInfo sqlType
 

Protected Attributes

size_t size_
 
bool isDirty_
 
bool isAppended_
 
bool isUpdated_
 
int deviceId_
 

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

◆ AbstractBuffer() [1/2]

Data_Namespace::AbstractBuffer::AbstractBuffer ( const int  deviceId)
inline

◆ AbstractBuffer() [2/2]

Data_Namespace::AbstractBuffer::AbstractBuffer ( const int  deviceId,
const SQLTypeInfo  sqlType 
)
inline

Definition at line 56 of file AbstractBuffer.h.

References initEncoder().

57  : size_(0)
58  , isDirty_(false)
59  , isAppended_(false)
60  , isUpdated_(false)
61  , deviceId_(deviceId) {
62  initEncoder(sqlType);
63  }
void initEncoder(const SQLTypeInfo tmpSqlType)
+ Here is the call graph for this function:

◆ ~AbstractBuffer()

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

Definition at line 64 of file AbstractBuffer.h.

References append(), Data_Namespace::CPU_LEVEL, getMemoryPtr(), pageCount(), pageSize(), read(), reserve(), reservedSize(), size(), src, and write().

64 {}
+ Here is the call graph for this function:

Member Function Documentation

◆ append()

virtual void Data_Namespace::AbstractBuffer::append ( int8_t *  src,
const size_t  numBytes,
const MemoryLevel  srcBufferType = CPU_LEVEL,
const int  deviceId = -1 
)
pure virtual

◆ clearDirtyBits()

void Data_Namespace::AbstractBuffer::clearDirtyBits ( )
inline

Definition at line 113 of file AbstractBuffer.h.

References isAppended_, isDirty_, and isUpdated_.

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

113  {
114  isAppended_ = false;
115  isUpdated_ = false;
116  isDirty_ = false;
117  }
+ Here is the caller graph for this function:

◆ getDeviceId()

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

Definition at line 88 of file AbstractBuffer.h.

References deviceId_, and getType().

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 call graph for this function:
+ Here is the caller graph for this function:

◆ getMemoryPtr()

◆ getPinCount()

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

Reimplemented in Buffer_Namespace::Buffer.

Definition at line 94 of file AbstractBuffer.h.

94 { return 0; }

◆ getType()

virtual MemoryLevel Data_Namespace::AbstractBuffer::getType ( ) const
pure virtual

◆ initEncoder()

void Data_Namespace::AbstractBuffer::initEncoder ( const SQLTypeInfo  tmpSqlType)
inline

Definition at line 118 of file AbstractBuffer.h.

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

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

118  {
119  hasEncoder = true;
120  sqlType = tmpSqlType;
121  encoder.reset(Encoder::Create(this, sqlType));
122  LOG_IF(FATAL, encoder == nullptr)
123  << "Failed to create encoder for SQL Type " << sqlType.get_type_name();
124  }
static Encoder * Create(Data_Namespace::AbstractBuffer *buffer, const SQLTypeInfo sqlType)
Definition: Encoder.cpp:26
#define LOG_IF(severity, condition)
Definition: Logger.h:273
std::string get_type_name() const
Definition: sqltypes.h:426
std::unique_ptr< Encoder > encoder
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAppended()

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

Definition at line 97 of file AbstractBuffer.h.

References isAppended_.

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

+ Here is the caller graph for this function:

◆ isDirty()

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

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

Definition at line 96 of file AbstractBuffer.h.

References isDirty_.

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:

◆ isUpdated()

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

Definition at line 98 of file AbstractBuffer.h.

References isUpdated_.

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:

◆ pageCount()

virtual size_t Data_Namespace::AbstractBuffer::pageCount ( ) const
pure virtual

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

Referenced by ~AbstractBuffer().

+ Here is the caller graph for this function:

◆ pageSize()

virtual size_t Data_Namespace::AbstractBuffer::pageSize ( ) const
pure virtual

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

Referenced by ~AbstractBuffer().

+ Here is the caller graph for this function:

◆ pin()

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

Reimplemented in Buffer_Namespace::Buffer.

Definition at line 92 of file AbstractBuffer.h.

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

92 { return 0; }
+ Here is the caller graph for this function:

◆ read()

virtual void Data_Namespace::AbstractBuffer::read ( int8_t *const  dst,
const size_t  numBytes,
const size_t  offset = 0,
const MemoryLevel  dstBufferType = CPU_LEVEL,
const int  dstDeviceId = -1 
)
pure virtual

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

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

+ Here is the caller graph for this function:

◆ reserve()

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

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

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

+ Here is the caller graph for this function:

◆ reservedSize()

virtual size_t Data_Namespace::AbstractBuffer::reservedSize ( ) const
pure virtual

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

Referenced by ~AbstractBuffer().

+ Here is the caller graph for this function:

◆ setAppended()

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

Definition at line 107 of file AbstractBuffer.h.

References isAppended_, and isDirty_.

107  {
108  isAppended_ = true;
109  isDirty_ = true;
110  }

◆ setDirty()

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

Definition at line 100 of file AbstractBuffer.h.

References isDirty_.

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

+ Here is the caller graph for this function:

◆ setSize()

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

Definition at line 112 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().

112 { size_ = size; }
virtual size_t size() const =0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUpdated()

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

Definition at line 102 of file AbstractBuffer.h.

References isDirty_, and isUpdated_.

102  {
103  isUpdated_ = true;
104  isDirty_ = true;
105  }

◆ size()

virtual size_t Data_Namespace::AbstractBuffer::size ( ) const
pure virtual

◆ syncEncoder()

void Data_Namespace::AbstractBuffer::syncEncoder ( const AbstractBuffer srcBuffer)
inline

Definition at line 126 of file AbstractBuffer.h.

References encoder, hasEncoder, initEncoder(), and sqlType.

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

126  {
127  hasEncoder = srcBuffer->hasEncoder;
128  if (hasEncoder) {
129  if (!encoder) { // Encoder not initialized
130  initEncoder(srcBuffer->sqlType);
131  }
132  encoder->copyMetadata(srcBuffer->encoder.get());
133  }
134  }
void initEncoder(const SQLTypeInfo tmpSqlType)
std::unique_ptr< Encoder > encoder
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unPin()

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

Reimplemented in Buffer_Namespace::Buffer.

Definition at line 93 of file AbstractBuffer.h.

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

93 { return 0; }
+ Here is the caller graph for this function:

◆ write()

virtual void Data_Namespace::AbstractBuffer::write ( int8_t *  src,
const size_t  numBytes,
const size_t  offset = 0,
const MemoryLevel  srcBufferType = CPU_LEVEL,
const int  srcDeviceId = -1 
)
pure virtual

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

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ deviceId_

int Data_Namespace::AbstractBuffer::deviceId_
protected

◆ encoder

◆ hasEncoder

bool Data_Namespace::AbstractBuffer::hasEncoder

◆ isAppended_

◆ isDirty_

◆ isUpdated_

bool Data_Namespace::AbstractBuffer::isUpdated_
protected

◆ size_

◆ sqlType


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