MySQL 8.3.0
Source Code Documentation
ddl::File_reader Struct Reference

Read rows from the temporary file. More...

#include <ddl0impl-file-reader.h>

Inheritance diagram for ddl::File_reader:
[legend]

Public Types

using Offsets = std::vector< ulint, ut::allocator< ulint > >
 

Public Member Functions

 File_reader (const Unique_os_file_descriptor &file, dict_index_t *index, size_t buffer_size, os_offset_t size) noexcept
 Constructor. More...
 
 ~File_reader () noexcept
 Destructor. More...
 
dberr_t prepare () noexcept
 Prepare the file for reading. More...
 
dberr_t get_tuple (Builder *builder, mem_heap_t *heap, dtuple_t *&dtuple) noexcept
 The current row as a tuple. More...
 
dberr_t read (os_offset_t offset) noexcept
 Seek to the offset and read the page in. More...
 
void set_offset (os_offset_t offset) noexcept
 Set the range or rows to traverse. More...
 
bool eof () const noexcept
 
uint64_t get_n_rows_read () const noexcept
 

Public Attributes

dict_index_tm_index {}
 Index that the records belong to. More...
 
const mrec_tm_mrec {}
 Pointer to current row. More...
 
Offsets m_offsets {}
 Columns offsets. More...
 
const Unique_os_file_descriptorm_file
 File handle to read from. More...
 

Private Types

using Bounds = std::pair< const byte *, const byte * >
 

Private Member Functions

dberr_t seek (os_offset_t offset) noexcept
 Seek to the start of the range and load load the page. More...
 
dberr_t read_next () noexcept
 Advance page number to the next and read in. More...
 
dberr_t next () noexcept
 Advance the "cursor". More...
 
- Private Member Functions inherited from ut::Non_copyable
 Non_copyable (const Non_copyable &)=delete
 
Non_copyableoperator= (const Non_copyable &)=delete
 
 Non_copyable ()=default
 
 ~Non_copyable ()=default
 

Private Attributes

os_offset_t m_size {}
 Size of the file in bytes. More...
 
os_offset_t m_offset {}
 Offset to read. More...
 
const bytem_ptr {}
 Pointer current offset within file buffer. More...
 
Bounds m_bounds {}
 File buffer bounds. More...
 
bytem_aux_buf {}
 Auxiliary buffer for records that span across pages. More...
 
size_t m_buffer_size {}
 IO buffer size in bytes. More...
 
ut::unique_ptr_aligned< byte[]> m_aligned_buffer {}
 Aligned IO buffer. More...
 
IO_buffer m_io_buffer {}
 File buffer for reading. More...
 
uint64_t m_n_rows_read {}
 Number of rows read from the file. More...
 
friend File_cursor
 

Detailed Description

Read rows from the temporary file.

Member Typedef Documentation

◆ Bounds

using ddl::File_reader::Bounds = std::pair<const byte *, const byte *>
private

◆ Offsets

Constructor & Destructor Documentation

◆ File_reader()

ddl::File_reader::File_reader ( const Unique_os_file_descriptor file,
dict_index_t index,
size_t  buffer_size,
os_offset_t  size 
)
inlinenoexcept

Constructor.

Parameters
[in]fileOpened file.
[in,out]indexIndex that the rows belong to.
[in]buffer_sizeSize of file buffer for reading.
[in]sizeFile size in bytes.

◆ ~File_reader()

ddl::File_reader::~File_reader ( )
inlinenoexcept

Destructor.

Member Function Documentation

◆ eof()

bool ddl::File_reader::eof ( ) const
inlinenoexcept
Returns
true if the range first == second.

◆ get_n_rows_read()

uint64_t ddl::File_reader::get_n_rows_read ( ) const
inlinenoexcept
Returns
the number of rows read from the file.

◆ get_tuple()

dberr_t ddl::File_reader::get_tuple ( Builder builder,
mem_heap_t heap,
dtuple_t *&  dtuple 
)
noexcept

The current row as a tuple.

Note: the tuple only does a shallow copy.

Parameters
[in,out]builderIndex builder instance.
[in,out]heapHeap to use for allocation.
[out]dtupleRow converted to a tuple.
Returns
DB_SUCCESS or error code.

◆ next()

dberr_t ddl::File_reader::next ( void  )
privatenoexcept

Advance the "cursor".

Returns
DB_SUCCESS or error code.

◆ prepare()

dberr_t ddl::File_reader::prepare ( )
noexcept

Prepare the file for reading.

Returns
DB_SUCCESS or error code.

◆ read()

dberr_t ddl::File_reader::read ( os_offset_t  offset)
noexcept

Seek to the offset and read the page in.

Parameters
[in]offsetOffset to read in.
Returns
DB_SUCCESS or error code.

◆ read_next()

dberr_t ddl::File_reader::read_next ( )
privatenoexcept

Advance page number to the next and read in.

Returns
DB_SUCCESS or error code.

◆ seek()

dberr_t ddl::File_reader::seek ( os_offset_t  offset)
privatenoexcept

Seek to the start of the range and load load the page.

Parameters
[in]offsetOffset to read in.
Returns
DB_SUCCESS or error code.

◆ set_offset()

void ddl::File_reader::set_offset ( os_offset_t  offset)
inlinenoexcept

Set the range or rows to traverse.

Parameters
[in]offsetNew offset to read from.

Member Data Documentation

◆ File_cursor

friend ddl::File_reader::File_cursor
private

◆ m_aligned_buffer

ut::unique_ptr_aligned<byte[]> ddl::File_reader::m_aligned_buffer {}
private

Aligned IO buffer.

◆ m_aux_buf

byte* ddl::File_reader::m_aux_buf {}
private

Auxiliary buffer for records that span across pages.

◆ m_bounds

Bounds ddl::File_reader::m_bounds {}
private

File buffer bounds.

◆ m_buffer_size

size_t ddl::File_reader::m_buffer_size {}
private

IO buffer size in bytes.

◆ m_file

const Unique_os_file_descriptor& ddl::File_reader::m_file

File handle to read from.

◆ m_index

dict_index_t* ddl::File_reader::m_index {}

Index that the records belong to.

◆ m_io_buffer

IO_buffer ddl::File_reader::m_io_buffer {}
private

File buffer for reading.

◆ m_mrec

const mrec_t* ddl::File_reader::m_mrec {}

Pointer to current row.

◆ m_n_rows_read

uint64_t ddl::File_reader::m_n_rows_read {}
private

Number of rows read from the file.

◆ m_offset

os_offset_t ddl::File_reader::m_offset {}
private

Offset to read.

◆ m_offsets

Offsets ddl::File_reader::m_offsets {}

Columns offsets.

◆ m_ptr

const byte* ddl::File_reader::m_ptr {}
private

Pointer current offset within file buffer.

◆ m_size

os_offset_t ddl::File_reader::m_size {}
private

Size of the file in bytes.


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