MySQL 8.0.39
Source Code Documentation
temptable::Index Class Referenceabstract

Index interface. More...

#include <index.h>

Inheritance diagram for temptable::Index:
[legend]

Public Types

enum class  Lookup { FOUND , NOT_FOUND_CURSOR_POSITIONED_ON_NEXT , NOT_FOUND_CURSOR_UNDEFINED }
 Index lookup (search) result. More...
 

Public Member Functions

 Index (const Table &table, const KEY &mysql_index)
 Constructor. More...
 
virtual ~Index ()
 Destructor. More...
 
virtual Result insert (const Indexed_cells &indexed_cells, Cursor *insert_position)=0
 Insert a new entry into the index. More...
 
virtual Lookup lookup (const Indexed_cells &search_cells, Cursor *first) const =0
 Lookup (search) an indexed cells. More...
 
virtual Lookup lookup (const Indexed_cells &search_cells, Cursor *first, Cursor *after_last) const =0
 Lookup (search) an indexed cells. More...
 
virtual void erase (const Cursor &target)=0
 Erase the indexed cells pointer to by a cursor. More...
 
virtual void truncate ()=0
 Truncate the index, deleting all of its entries. More...
 
virtual Cursor begin () const =0
 Get a cursor to the first entry. More...
 
virtual Cursor end () const =0
 Get a cursor after the last entry. More...
 
size_t number_of_indexed_columns () const
 Get the number of indexed columns by this index. More...
 
const Indexed_columnindexed_column (size_t i) const
 Get the Nth indexed column. More...
 
const Tabletable () const
 Get the table of the index. More...
 
const KEYmysql_index () const
 Get the MySQL index structure which corresponds to this index. More...
 

Private Attributes

size_t m_number_of_indexed_columns
 Number of indexed columns. More...
 
const Tablem_table
 Table of the index. More...
 
std::array< Indexed_column, MAX_REF_PARTSm_indexed_columns
 Indexed columns metadata, from [0, m_number_of_indexed_columns). More...
 
const KEYm_mysql_index
 MySQL index. More...
 

Detailed Description

Index interface.

Member Enumeration Documentation

◆ Lookup

enum class temptable::Index::Lookup
strong

Index lookup (search) result.

Enumerator
FOUND 

The searched for indexed cells were found and the cursor is positioned on them.

NOT_FOUND_CURSOR_POSITIONED_ON_NEXT 

The searched for indexed cells were not found and the cursor is positioned on the next indexed cells in index order.

NOT_FOUND_CURSOR_UNDEFINED 

The searched for indexed cells were not found and the cursor position is undefined.

Constructor & Destructor Documentation

◆ Index()

temptable::Index::Index ( const Table table,
const KEY mysql_index 
)

Constructor.

Parameters
[in]tableTable where this index belongs, used only for fetching metadata of its columns.
[in]mysql_indexMySQL index, for querying metadata.

◆ ~Index()

temptable::Index::~Index ( )
virtual

Destructor.

Member Function Documentation

◆ begin()

virtual Cursor temptable::Index::begin ( ) const
pure virtual

Get a cursor to the first entry.

Returns
cursor to the first indexed cells in index order

Implemented in temptable::Tree, temptable::Hash_duplicates, and temptable::Hash_unique.

◆ end()

virtual Cursor temptable::Index::end ( ) const
pure virtual

Get a cursor after the last entry.

Returns
a cursor after the last indexed cells in index order

Implemented in temptable::Tree, temptable::Hash_duplicates, and temptable::Hash_unique.

◆ erase()

virtual void temptable::Index::erase ( const Cursor target)
pure virtual

Erase the indexed cells pointer to by a cursor.

Parameters
[in]targetPosition to erase.

Implemented in temptable::Tree, temptable::Hash_duplicates, and temptable::Hash_unique.

◆ indexed_column()

const Indexed_column & temptable::Index::indexed_column ( size_t  i) const
inline

Get the Nth indexed column.

Returns
the Nth indexed column
Parameters
[in]iIndex of the column to fetch, must be < `number_of_indexed_columns()`.

◆ insert()

virtual Result temptable::Index::insert ( const Indexed_cells indexed_cells,
Cursor insert_position 
)
pure virtual

Insert a new entry into the index.

Returns
Result::OK or another Result::* error code
Parameters
[in]indexed_cellsIndexed cells to insert.
[out]insert_positionIf insert succeeds (Result::OK) this will be set to the position inside the index where the new indexed cells where inserted.

Implemented in temptable::Tree, temptable::Hash_duplicates, and temptable::Hash_unique.

◆ lookup() [1/2]

virtual Lookup temptable::Index::lookup ( const Indexed_cells search_cells,
Cursor first 
) const
pure virtual

Lookup (search) an indexed cells.

Return values
Lookup::FOUNDthe provided search_cells were found and first was positioned on them (the first entry, if there are duplicates).
Lookup::NOT_FOUND_CURSOR_POSITIONED_ON_NEXTthe provided search_cells were not found and first was positioned on the next indexed cells in index order.
Lookup::NOT_FOUND_CURSOR_UNDEFINEDthe provided search_cells were not found and first is undefined.
Parameters
[in]search_cellsIndexed cells to search for.
[out]firstFirst indexed cells that were found, see above.

Implemented in temptable::Tree, temptable::Hash_duplicates, and temptable::Hash_unique.

◆ lookup() [2/2]

virtual Lookup temptable::Index::lookup ( const Indexed_cells search_cells,
Cursor first,
Cursor after_last 
) const
pure virtual

Lookup (search) an indexed cells.

Return values
Lookup::FOUNDthe provided search_cells were found, first was positioned on them (the first entry, if there are duplicates) and after_last was positioned after the last matching entry.
Lookup::NOT_FOUND_CURSOR_POSITIONED_ON_NEXTthe provided search_cells were not found and first and after_last were positioned on the next indexed cells in index order.
Lookup::NOT_FOUND_CURSOR_UNDEFINEDthe provided search_cells were not found and first and after_last are undefined.

Implemented in temptable::Tree, temptable::Hash_duplicates, and temptable::Hash_unique.

◆ mysql_index()

const KEY & temptable::Index::mysql_index ( ) const
inline

Get the MySQL index structure which corresponds to this index.

Returns
mysql index

◆ number_of_indexed_columns()

size_t temptable::Index::number_of_indexed_columns ( ) const
inline

Get the number of indexed columns by this index.

Returns
number of indexed columns

◆ table()

const Table & temptable::Index::table ( ) const
inline

Get the table of the index.

Returns
table

◆ truncate()

virtual void temptable::Index::truncate ( )
pure virtual

Truncate the index, deleting all of its entries.

Implemented in temptable::Tree, temptable::Hash_duplicates, and temptable::Hash_unique.

Member Data Documentation

◆ m_indexed_columns

std::array<Indexed_column, MAX_REF_PARTS> temptable::Index::m_indexed_columns
private

Indexed columns metadata, from [0, m_number_of_indexed_columns).

◆ m_mysql_index

const KEY* temptable::Index::m_mysql_index
private

MySQL index.

◆ m_number_of_indexed_columns

size_t temptable::Index::m_number_of_indexed_columns
private

Number of indexed columns.

◆ m_table

const Table& temptable::Index::m_table
private

Table of the index.


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