MySQL 8.0.40
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, const Range &range) 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 (const Range &range) noexcept
 Set the start and end offsets to read from, to avoid the possibility of overlapping reads from the other ranges in subsequent reads. More...
 
bool end_of_range () 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_field_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 () noexcept
 Read the page in the file buffer from the start offset, and reset the cursor to the beginning of the file buffer. 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

Range m_range {}
 
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.

Rows could be read in the from of chunks or ranges.

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,
const Range range 
)
inlinenoexcept

Constructor.

Parameters
[in]fileOpened file.
[in,out]indexIndex that the rows belong to.
[in]buffer_sizeSize of file buffer for reading.
[in]rangeOffsets of the chunk to read

◆ ~File_reader()

ddl::File_reader::~File_reader ( )
inlinenoexcept

Destructor.

Member Function Documentation

◆ end_of_range()

bool ddl::File_reader::end_of_range ( ) 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 ( const Range range)
noexcept

Set the start and end offsets to read from, to avoid the possibility of overlapping reads from the other ranges in subsequent reads.

Seek to the start offset, read the page and, position to the first record on the page

Parameters
[in]rangeStart and end offsets of the range to read from.
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 ( )
privatenoexcept

Read the page in the file buffer from the start offset, and reset the cursor to the beginning of the file buffer.

Returns
DB_SUCCESS or error code.

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_field_offsets

Offsets ddl::File_reader::m_field_offsets {}

Columns offsets.

◆ 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_ptr

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

Pointer current offset within file buffer.

◆ m_range

Range ddl::File_reader::m_range {}
private

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