Buffer for sorting in main memory.  
 More...
#include <ddl0impl-buffer.h>
Buffer for sorting in main memory. 
◆ DTuple
DTuple is an array of dfield_t objects. 
 
 
◆ DTuples
◆ Function
Callback for writing serialized data to to disk. 
- Parameters
- 
  
    | [in] | io_buffer | Buffer to persist - aligned to IO_BLOCK_SIZE. |  
 
- Returns
- DB_SUCCES or error code. 
 
 
◆ Key_sort_buffer()
  
  | 
        
          | ddl::Key_sort_buffer::Key_sort_buffer | ( | dict_index_t * | index, |  
          |  |  | size_t | size |  
          |  | ) |  |  |  | explicitnoexcept | 
 
Constructor. 
- Parameters
- 
  
    | [in,out] | index | Sort buffer is for this index. |  | [in] | size | Sort buffer size in bytes. |  
 
 
 
◆ ~Key_sort_buffer()
  
  | 
        
          | ddl::Key_sort_buffer::~Key_sort_buffer | ( |  | ) |  |  | inlinenoexcept | 
 
 
◆ alloc()
  
  | 
        
          | dfield_t * ddl::Key_sort_buffer::alloc | ( | size_t | n | ) |  |  | inlinenoexcept | 
 
Allocate fields from the heap. 
- Parameters
- 
  
    | [in] | n | Number of fields to allocate. |  
 
- Returns
- an array of n dfields. 
 
 
◆ back()
  
  | 
        
          | dfield_t *& ddl::Key_sort_buffer::back | ( |  | ) |  |  | inlinenoexcept | 
 
- Returns
- a references to the last element. 
 
 
◆ clear()
  
  | 
        
          | void ddl::Key_sort_buffer::clear | ( |  | ) |  |  | noexcept | 
 
Reset the sort buffer. 
clear the heap and entries. 
 
 
◆ compare()
Compare two merge data tuples. 
- Parameters
- 
  
    | [in] | lhs | Fields to compare on the LHS |  | [in] | rhs | Fields to compare on the RHS |  | [in,out] | dup | For capturing duplicates (or nullptr). |  
 
- Return values
- 
  
    | +ve | - if lhs > rhs |  | -ve | - if lhs < rhs |  | 0 | - if lhs == rhs |  
 
 
 
◆ deep_copy()
  
  | 
        
          | void ddl::Key_sort_buffer::deep_copy | ( | size_t | n_fields, |  
          |  |  | size_t | data_size |  
          |  | ) |  |  |  | noexcept | 
 
Deep copy the field data starting from the back. 
- Parameters
- 
  
    | [in] | n_fields | Number of fields to copy. |  | [in] | data_size | Size in bytes of the data to copy. |  
 
 
 
◆ empty()
  
  | 
        
          | bool ddl::Key_sort_buffer::empty | ( |  | ) | const |  | inlinenoexcept | 
 
- Returns
- true if the buffer is empty. 
 
 
◆ heap()
◆ is_clustered()
  
  | 
        
          | bool ddl::Key_sort_buffer::is_clustered | ( |  | ) | const |  | inlinenoexcept | 
 
- Returns
- true if the index is clustered. 
 
 
◆ is_fts()
  
  | 
        
          | bool ddl::Key_sort_buffer::is_fts | ( |  | ) | const |  | inlinenoexcept | 
 
- Returns
- true if the index is an FTS index. 
 
 
◆ is_unique()
  
  | 
        
          | bool ddl::Key_sort_buffer::is_unique | ( |  | ) | const |  | inlinenoexcept | 
 
- Returns
- true if the index has a unique constraint. 
 
 
◆ serialize()
Serialize the contents for storing to disk. 
- Parameters
- 
  
    | [in] | io_buffer | Buffer for serializing. |  | [in] | persist | Function for persisting the data. |  
 
- Returns
- DB_SUCCESS or error code. 
 
 
◆ size()
  
  | 
        
          | size_t ddl::Key_sort_buffer::size | ( |  | ) | const |  | inlinenoexcept | 
 
- Returns
- number of tuples stored so far. 
 
 
◆ sort()
  
  | 
        
          | void ddl::Key_sort_buffer::sort | ( | ddl::Dup * | dup | ) |  |  | noexcept | 
 
Sort the elements in m_dtuples. 
- Parameters
- 
  
    | [in,out] | dup | For collecting the duplicate rows. |  
 
 
 
◆ will_fit()
  
  | 
        
          | bool ddl::Key_sort_buffer::will_fit | ( | size_t | n | ) | const |  | inlinenoexcept | 
 
Check if n bytes will fit in the buffer. 
- Parameters
- 
  
    | [in] | n | Number of bytes to check. |  
 
- Returns
- true if n bytes will fit in the buffer. 
 
 
◆ m_buffer_size
      
        
          | size_t ddl::Key_sort_buffer::m_buffer_size {} | 
      
 
 
◆ m_dtuples
      
        
          | DTuples ddl::Key_sort_buffer::m_dtuples {} | 
      
 
 
◆ m_heap
Memory heap where allocated. 
 
 
◆ m_index
The index the tuples belong to. 
 
 
◆ m_n_tuples
      
        
          | size_t ddl::Key_sort_buffer::m_n_tuples {} | 
      
 
 
◆ m_total_size
      
        
          | size_t ddl::Key_sort_buffer::m_total_size {} | 
      
 
Total amount of data allocated from m_heap, which includes: i. 
one dfield_t[n_fields] array per row, allocated via alloc(n_fields) calls ii. actual field's data cloned into the m_heap, via deep_clone(...,) calls This is updated by alloc() and deep_clone(). It should roughly match the value of: mem_heap_get_size(m_heap)-mem_block_get_free(UT_LIST_GET_LAST(m_heap->base)). This, when combined with the memory consumption of m_dtuples, should not exceed the m_buffer_size budget 
 
 
The documentation for this struct was generated from the following files: