MySQL 9.1.0
Source Code Documentation
Ha_clone_cbk Class Referenceabstract

#include <handler.h>

Public Member Functions

virtual int file_cbk (Ha_clone_file from_file, uint len)=0
 Callback providing data from current position of a file descriptor of specific length. More...
 
virtual int buffer_cbk (uchar *from_buffer, uint len)=0
 Callback providing data in buffer of specific length. More...
 
virtual int apply_file_cbk (Ha_clone_file to_file)=0
 Callback providing a file descriptor to write data starting from current position. More...
 
virtual int apply_buffer_cbk (uchar *&to_buffer, uint &len)=0
 Callback to get data in buffer. More...
 
virtual ~Ha_clone_cbk ()=default
 virtual destructor. More...
 
void set_hton (handlerton *hton)
 Set current storage engine handlerton. More...
 
handlertonget_hton ()
 Get current storage engine handlerton. More...
 
void set_client_buffer_size (uint size)
 Set caller's transfer buffer size. More...
 
uint get_client_buffer_size ()
 Get caller's transfer buffer size. More...
 
void set_loc_index (uint idx)
 Set current SE index. More...
 
uint get_loc_index ()
 Get current SE index. More...
 
void set_data_desc (const uchar *desc, uint len)
 Set data descriptor. More...
 
const ucharget_data_desc (uint *lenp)
 Get data descriptor. More...
 
const char * get_source_name ()
 Get SE source file name. More...
 
void set_source_name (const char *name)
 Set SE source file name. More...
 
const char * get_dest_name ()
 Get SE destination file name. More...
 
void set_dest_name (const char *name)
 Set SE destination file name. More...
 
void clear_flags ()
 Clear all flags set by SE. More...
 
void set_ack ()
 Mark that ACK is needed for the data transfer before returning from callback. More...
 
bool is_ack_needed () const
 Check if ACK is needed for the data transfer. More...
 
void set_os_buffer_cache ()
 Mark that the file descriptor is opened for read/write with OS buffer cache. More...
 
bool is_os_buffer_cache () const
 Check if the file descriptor is opened for read/write with OS buffer cache. More...
 
void set_zero_copy ()
 Mark that the file can be transferred with zero copy. More...
 
bool is_zero_copy () const
 Check if zero copy optimization is suggested. More...
 
void set_secure ()
 Mark that data needs secure transfer. More...
 
bool is_secure () const
 Check if data needs secure transfer. More...
 
void mark_state_change (uint64_t estimate)
 Set state information and notify state change. More...
 
bool is_state_change (uint64_t &estimate)
 Check if SE notified state change. More...
 

Protected Member Functions

 Ha_clone_cbk ()
 Constructor to initialize members. More...
 

Private Attributes

handlertonm_hton
 Handlerton for the SE. More...
 
uint m_loc_idx
 SE index in caller's locator array. More...
 
uint m_client_buff_size
 Caller's transfer buffer size. More...
 
const ucharm_data_desc
 SE's Serialized data descriptor. More...
 
uint m_desc_len
 SE's Serialized descriptor length. More...
 
const char * m_src_name
 Current source file name. More...
 
const char * m_dest_name
 Current destination file name. More...
 
uint64_t m_state_estimate
 Estimated bytes to be transferred. More...
 
int m_flag
 Flag storing data related options. More...
 
const int HA_CLONE_ACK = 0x01
 Acknowledgement is needed for the data transfer. More...
 
const int HA_CLONE_FILE_CACHE = 0x02
 Data file is opened for read/write with OS buffer cache. More...
 
const int HA_CLONE_ZERO_COPY = 0x04
 Data file can be transferred with zero copy. More...
 
const int HA_CLONE_SECURE = 0x08
 Data needs to be transferred securely over SSL connection. More...
 
const int HA_CLONE_STATE_CHANGE = 0x10
 State change notification by SE. More...
 

Constructor & Destructor Documentation

◆ Ha_clone_cbk()

Ha_clone_cbk::Ha_clone_cbk ( )
inlineprotected

Constructor to initialize members.

◆ ~Ha_clone_cbk()

virtual Ha_clone_cbk::~Ha_clone_cbk ( )
virtualdefault

virtual destructor.

Member Function Documentation

◆ apply_buffer_cbk()

virtual int Ha_clone_cbk::apply_buffer_cbk ( uchar *&  to_buffer,
uint &  len 
)
pure virtual

Callback to get data in buffer.

Parameters
[out]to_bufferdata buffer
[out]lendata length
Returns
error code

◆ apply_file_cbk()

virtual int Ha_clone_cbk::apply_file_cbk ( Ha_clone_file  to_file)
pure virtual

Callback providing a file descriptor to write data starting from current position.

Parameters
[in]to_filedestination file to write data
Returns
error code

◆ buffer_cbk()

virtual int Ha_clone_cbk::buffer_cbk ( uchar from_buffer,
uint  len 
)
pure virtual

Callback providing data in buffer of specific length.

Parameters
[in]from_buffersource buffer to read from
[in]lendata length
Returns
error code

◆ clear_flags()

void Ha_clone_cbk::clear_flags ( )
inline

Clear all flags set by SE.

◆ file_cbk()

virtual int Ha_clone_cbk::file_cbk ( Ha_clone_file  from_file,
uint  len 
)
pure virtual

Callback providing data from current position of a file descriptor of specific length.

Parameters
[in]from_filesource file to read from
[in]lendata length
Returns
error code

◆ get_client_buffer_size()

uint Ha_clone_cbk::get_client_buffer_size ( )
inline

Get caller's transfer buffer size.

Returns
buffer size in bytes

◆ get_data_desc()

const uchar * Ha_clone_cbk::get_data_desc ( uint *  lenp)
inline

Get data descriptor.

SE specific descriptor for the data transferred by the callbacks.

Parameters
[out]lenplength of the descriptor byte stream
Returns
pointer to the serialized data descriptor

◆ get_dest_name()

const char * Ha_clone_cbk::get_dest_name ( )
inline

Get SE destination file name.

Used for debug printing and error message.

Returns
null terminated string for destination file name

◆ get_hton()

handlerton * Ha_clone_cbk::get_hton ( )
inline

Get current storage engine handlerton.

Returns
SE handlerton

◆ get_loc_index()

uint Ha_clone_cbk::get_loc_index ( )
inline

Get current SE index.

Returns
SE index in locator array

◆ get_source_name()

const char * Ha_clone_cbk::get_source_name ( )
inline

Get SE source file name.

Used for debug printing and error message.

Returns
null terminated string for source file name

◆ is_ack_needed()

bool Ha_clone_cbk::is_ack_needed ( ) const
inline

Check if ACK is needed for the data transfer.

Returns
true if ACK is needed

◆ is_os_buffer_cache()

bool Ha_clone_cbk::is_os_buffer_cache ( ) const
inline

Check if the file descriptor is opened for read/write with OS buffer cache.

Currently clone avoids using zero copy (sendfile on linux), if SE is using O_DIRECT. This improves data copy performance.

Returns
true if O_DIRECT is not used

◆ is_secure()

bool Ha_clone_cbk::is_secure ( ) const
inline

Check if data needs secure transfer.

◆ is_state_change()

bool Ha_clone_cbk::is_state_change ( uint64_t &  estimate)
inline

Check if SE notified state change.

◆ is_zero_copy()

bool Ha_clone_cbk::is_zero_copy ( ) const
inline

Check if zero copy optimization is suggested.

◆ mark_state_change()

void Ha_clone_cbk::mark_state_change ( uint64_t  estimate)
inline

Set state information and notify state change.

Parameters
[in]estimateestimated bytes for current state.

◆ set_ack()

void Ha_clone_cbk::set_ack ( )
inline

Mark that ACK is needed for the data transfer before returning from callback.

Set by SE.

◆ set_client_buffer_size()

void Ha_clone_cbk::set_client_buffer_size ( uint  size)
inline

Set caller's transfer buffer size.

SE can adjust the data chunk size based on this parameter.

Parameters
[in]sizebuffer size in bytes

◆ set_data_desc()

void Ha_clone_cbk::set_data_desc ( const uchar desc,
uint  len 
)
inline

Set data descriptor.

SE specific descriptor for the data transferred by the callbacks.

Parameters
[in]descserialized data descriptor
[in]lenlength of the descriptor byte stream

◆ set_dest_name()

void Ha_clone_cbk::set_dest_name ( const char *  name)
inline

Set SE destination file name.

Parameters
[in]namenull terminated string for destination file name

◆ set_hton()

void Ha_clone_cbk::set_hton ( handlerton hton)
inline

Set current storage engine handlerton.

Parameters
[in]htonSE handlerton

◆ set_loc_index()

void Ha_clone_cbk::set_loc_index ( uint  idx)
inline

Set current SE index.

Parameters
[in]idxSE index in locator array

◆ set_os_buffer_cache()

void Ha_clone_cbk::set_os_buffer_cache ( )
inline

Mark that the file descriptor is opened for read/write with OS buffer cache.

For O_DIRECT, the flag is not set.

◆ set_secure()

void Ha_clone_cbk::set_secure ( )
inline

Mark that data needs secure transfer.

◆ set_source_name()

void Ha_clone_cbk::set_source_name ( const char *  name)
inline

Set SE source file name.

Parameters
[in]namenull terminated string for source file name

◆ set_zero_copy()

void Ha_clone_cbk::set_zero_copy ( )
inline

Mark that the file can be transferred with zero copy.

Member Data Documentation

◆ HA_CLONE_ACK

const int Ha_clone_cbk::HA_CLONE_ACK = 0x01
private

Acknowledgement is needed for the data transfer.

◆ HA_CLONE_FILE_CACHE

const int Ha_clone_cbk::HA_CLONE_FILE_CACHE = 0x02
private

Data file is opened for read/write with OS buffer cache.

◆ HA_CLONE_SECURE

const int Ha_clone_cbk::HA_CLONE_SECURE = 0x08
private

Data needs to be transferred securely over SSL connection.

◆ HA_CLONE_STATE_CHANGE

const int Ha_clone_cbk::HA_CLONE_STATE_CHANGE = 0x10
private

State change notification by SE.

◆ HA_CLONE_ZERO_COPY

const int Ha_clone_cbk::HA_CLONE_ZERO_COPY = 0x04
private

Data file can be transferred with zero copy.

◆ m_client_buff_size

uint Ha_clone_cbk::m_client_buff_size
private

Caller's transfer buffer size.

◆ m_data_desc

const uchar* Ha_clone_cbk::m_data_desc
private

SE's Serialized data descriptor.

◆ m_desc_len

uint Ha_clone_cbk::m_desc_len
private

SE's Serialized descriptor length.

◆ m_dest_name

const char* Ha_clone_cbk::m_dest_name
private

Current destination file name.

◆ m_flag

int Ha_clone_cbk::m_flag
private

Flag storing data related options.

◆ m_hton

handlerton* Ha_clone_cbk::m_hton
private

Handlerton for the SE.

◆ m_loc_idx

uint Ha_clone_cbk::m_loc_idx
private

SE index in caller's locator array.

◆ m_src_name

const char* Ha_clone_cbk::m_src_name
private

Current source file name.

◆ m_state_estimate

uint64_t Ha_clone_cbk::m_state_estimate
private

Estimated bytes to be transferred.


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