#[doc(hidden)]
pub mod binlog;
mod binlog_kind;
mod capabilities;
#[doc(hidden)]
pub mod capability_ffi;
#[doc(hidden)]
pub mod clone;
mod clone_kind;
mod cost_constants;
#[doc(hidden)]
pub mod database;
#[doc(hidden)]
pub mod dict;
mod dict_kind;
#[doc(hidden)]
pub mod discovery;
#[doc(hidden)]
pub mod engine_log;
#[doc(hidden)]
pub mod ffi;
#[doc(hidden)]
pub mod fk_hooks;
mod flags;
#[doc(hidden)]
pub mod lifecycle;
#[doc(hidden)]
pub mod misc_optimizer;
#[doc(hidden)]
pub mod misc_stats;
mod notification_kind;
#[doc(hidden)]
pub mod notifications;
#[doc(hidden)]
pub mod page_track;
mod panic_function;
mod recover_xa_state;
mod result;
#[doc(hidden)]
pub mod savepoint_ffi;
#[doc(hidden)]
pub mod sdi;
#[doc(hidden)]
pub mod secondary_engine;
#[doc(hidden)]
pub mod secondary_engine_fail_reason;
mod secondary_engine_kind;
mod stat_print_sink;
mod stat_type;
#[doc(hidden)]
pub mod statistics_callbacks;
#[doc(hidden)]
pub mod status;
mod table_statistics;
#[doc(hidden)]
pub mod tablespace;
mod tablespace_kind;
mod tablespace_statistics;
mod transaction;
#[doc(hidden)]
pub mod txn_context;
#[doc(hidden)]
pub mod txn_ffi;
#[doc(hidden)]
pub mod txn_row_ffi;
#[doc(hidden)]
pub mod xa;
mod xa_recover_collector;
mod xa_state_list_collector;
pub use binlog_kind::{BinlogCommand, BinlogFunc};
pub use capabilities::HtonCapabilities;
pub use clone_kind::{HaCloneMode, HaCloneType};
pub use cost_constants::CostConstants;
pub use dict_kind::{DictInitMode, DictRecoveryMode};
pub use flags::HtonFlags;
pub use notification_kind::{HaNotificationType, SelectExecutedIn};
pub use panic_function::HaPanicFunction;
pub use recover_xa_state::RecoverXaState;
pub use secondary_engine_kind::{
SecondaryEngineGraphSimplificationRequest, SecondaryEngineOptimizerRequest,
};
pub use stat_print_sink::StatPrintSink;
pub use stat_type::HaStatType;
pub use table_statistics::TableStatistics;
pub use tablespace_kind::{TablespaceType, TsCommandType};
pub use tablespace_statistics::TablespaceStatistics;
pub use transaction::TxnSession;
pub use xa_recover_collector::XaRecoverCollector;
pub use xa_state_list_collector::XaStateListCollector;
use crate::engine::EngineResult;
use crate::sys;
pub trait Handlerton: Send + Sync {
fn capabilities(&self) -> HtonCapabilities {
HtonCapabilities::empty()
}
fn flags(&self) -> HtonFlags {
HtonFlags::CAN_RECREATE
}
fn savepoint_offset(&self) -> u32 {
0
}
fn close_connection(&self, _thd: Option<&sys::THD>) -> EngineResult {
Ok(())
}
fn kill_connection(&self, _thd: Option<&sys::THD>) {}
fn pre_dd_shutdown(&self) {}
fn reset_plugin_vars(&self, _thd: Option<&sys::THD>) {}
fn begin_transaction(&self) -> Box<dyn TxnSession> {
Box::new(NoopTxnSession)
}
fn commit_by_xid(&self, xid: Option<&sys::XID>) -> EngineResult {
let _ = xid;
Err(crate::engine::EngineError::Unsupported)
}
fn rollback_by_xid(&self, xid: Option<&sys::XID>) -> EngineResult {
let _ = xid;
Err(crate::engine::EngineError::Unsupported)
}
fn set_prepared_in_tc(&self, thd: Option<&sys::THD>) -> EngineResult {
let _ = thd;
Err(crate::engine::EngineError::Unsupported)
}
fn set_prepared_in_tc_by_xid(&self, xid: Option<&sys::XID>) -> EngineResult {
let _ = xid;
Err(crate::engine::EngineError::Unsupported)
}
fn recover_prepared_in_tc(&self, collector: &mut XaStateListCollector) -> EngineResult {
let _ = collector;
Ok(())
}
fn recover(&self, collector: &mut XaRecoverCollector) {
let _ = collector;
}
fn panic(&self, flag: HaPanicFunction) -> EngineResult {
let _ = flag;
Ok(())
}
fn start_consistent_snapshot(&self, _thd: Option<&sys::THD>) -> EngineResult {
Ok(())
}
fn flush_logs(&self, _binlog_group_flush: bool) -> EngineResult {
Ok(())
}
fn show_status(
&self,
_thd: Option<&sys::THD>,
_sink: &StatPrintSink<'_>,
_stat: HaStatType,
) -> EngineResult {
Ok(())
}
fn partition_flags(&self) -> u32 {
0
}
fn fill_is_table(&self, _thd: Option<&sys::THD>) -> EngineResult {
Ok(())
}
fn upgrade_logs(&self, _thd: Option<&sys::THD>) -> EngineResult {
Ok(())
}
fn finish_upgrade(&self, _thd: Option<&sys::THD>, _failed_upgrade: bool) -> EngineResult {
Ok(())
}
fn is_reserved_db_name(&self, _name: &str) -> bool {
false
}
fn discover(&self, _thd: Option<&sys::THD>, _db: &str, _name: &str) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn find_files(
&self,
_thd: Option<&sys::THD>,
_db: &str,
_path: &str,
_wild: Option<&str>,
_dir: bool,
) -> EngineResult {
Ok(())
}
fn table_exists_in_engine(&self, _thd: Option<&sys::THD>, _db: &str, _name: &str) -> bool {
false
}
fn is_supported_system_table(
&self,
_db: &str,
_table_name: &str,
_is_sql_layer_system_table: bool,
) -> bool {
false
}
fn notify_after_select(&self, _thd: Option<&sys::THD>, _executed_in: SelectExecutedIn) {}
fn notify_create_table(&self, _db: &str, _table_name: &str) {}
fn notify_drop_table(&self) {}
fn notify_exclusive_mdl(
&self,
_thd: Option<&sys::THD>,
_mdl_key: Option<&sys::MdlKey>,
_kind: HaNotificationType,
) -> EngineResult {
Ok(())
}
fn notify_alter_table(
&self,
_thd: Option<&sys::THD>,
_mdl_key: Option<&sys::MdlKey>,
_kind: HaNotificationType,
) -> EngineResult {
Ok(())
}
#[allow(clippy::too_many_arguments)]
fn notify_rename_table(
&self,
_thd: Option<&sys::THD>,
_mdl_key: Option<&sys::MdlKey>,
_kind: HaNotificationType,
_old_db: &str,
_old_name: &str,
_new_db: &str,
_new_name: &str,
) -> EngineResult {
Ok(())
}
fn notify_truncate_table(
&self,
_thd: Option<&sys::THD>,
_mdl_key: Option<&sys::MdlKey>,
_kind: HaNotificationType,
) -> EngineResult {
Ok(())
}
fn binlog_func(&self, _thd: Option<&sys::THD>, _func: BinlogFunc) -> EngineResult {
Ok(())
}
fn binlog_log_query(
&self,
_thd: Option<&sys::THD>,
_command: BinlogCommand,
_query: &str,
_db: &str,
_table: &str,
) {
}
fn acl_notify(&self, _thd: Option<&sys::THD>) {}
fn drop_database(&self, _path: &str) {}
fn is_valid_tablespace_name(&self, _cmd: TsCommandType, _tablespace_name: &str) -> bool {
true
}
fn get_tablespace(
&self,
_thd: Option<&sys::THD>,
_db_name: &str,
_table_name: &str,
) -> EngineResult {
Ok(())
}
fn alter_tablespace(
&self,
_thd: Option<&sys::THD>,
_ts_info: Option<&sys::StAlterTablespace>,
) -> EngineResult {
Ok(())
}
fn tablespace_filename_ext(&self) -> Option<&'static core::ffi::CStr> {
None
}
fn upgrade_tablespace(&self, _thd: Option<&sys::THD>) -> EngineResult {
Ok(())
}
fn upgrade_space_version(&self, _tablespace: Option<&sys::DdTablespace>) -> EngineResult {
Ok(())
}
fn get_tablespace_type(
&self,
_tablespace: Option<&sys::DdTablespace>,
) -> Option<TablespaceType> {
None
}
fn get_tablespace_type_by_name(&self, _tablespace_name: &str) -> Option<TablespaceType> {
None
}
fn dict_init(&self, _mode: DictInitMode, _version: u32) -> EngineResult {
Ok(())
}
fn ddse_dict_init(&self, _mode: DictInitMode, _version: u32) -> EngineResult {
Ok(())
}
fn dict_register_dd_table_id(&self, _table_id: u64) {}
fn dict_cache_reset(&self, _schema_name: &str, _table_name: &str) {}
fn dict_cache_reset_tables_and_tablespaces(&self) {}
fn dict_recover(&self, _mode: DictRecoveryMode, _version: u32) -> EngineResult {
Ok(())
}
fn dict_get_server_version(&self) -> Option<u32> {
None
}
fn dict_set_server_version(&self) -> EngineResult {
Ok(())
}
fn sdi_create(&self, _tablespace: Option<&sys::DdTablespace>) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn sdi_drop(&self, _tablespace: Option<&sys::DdTablespace>) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn sdi_get_keys(
&self,
_tablespace: Option<&sys::DdTablespace>,
_vector: Option<&sys::SdiVector>,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn sdi_get(
&self,
_tablespace: Option<&sys::DdTablespace>,
_key: Option<&sys::SdiKey>,
_buf: &mut [u8],
_len_out: &mut u64,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn sdi_set(
&self,
_tablespace: Option<&sys::DdTablespace>,
_table: Option<&sys::DdTable>,
_key: Option<&sys::SdiKey>,
_payload: &[u8],
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn sdi_delete(
&self,
_tablespace: Option<&sys::DdTablespace>,
_table: Option<&sys::DdTable>,
_key: Option<&sys::SdiKey>,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn lock_hton_log(&self) -> EngineResult {
Ok(())
}
fn unlock_hton_log(&self) -> EngineResult {
Ok(())
}
fn collect_hton_log_info(&self, _json: Option<&sys::JsonDom>) -> EngineResult {
Ok(())
}
fn check_fk_column_compat(
&self,
_child: Option<&sys::HaFkColumnType>,
_parent: Option<&sys::HaFkColumnType>,
_check_charsets: bool,
) -> bool {
true
}
fn se_before_commit(&self) {}
fn se_after_commit(&self) {}
fn se_before_rollback(&self) {}
fn prepare_secondary_engine(
&self,
_thd: Option<&sys::THD>,
_lex: Option<&sys::Lex>,
) -> EngineResult {
Ok(())
}
fn optimize_secondary_engine(
&self,
_thd: Option<&sys::THD>,
_lex: Option<&sys::Lex>,
) -> EngineResult {
Ok(())
}
fn compare_secondary_engine_cost(
&self,
_thd: Option<&sys::THD>,
_join: Option<&sys::Join>,
_optimizer_cost: f64,
) -> EngineResult<Option<(bool, bool, f64)>> {
Ok(None)
}
fn secondary_engine_modify_access_path_cost(
&self,
_thd: Option<&sys::THD>,
_hypergraph: Option<&sys::JoinHypergraph>,
_access_path: Option<&sys::AccessPath>,
) -> EngineResult {
Ok(())
}
fn external_engine_explain_check(&self, _thd: Option<&sys::THD>) -> bool {
false
}
fn set_secondary_engine_offload_fail_reason(
&self,
_thd: Option<&sys::THD>,
_reason: &str,
) -> EngineResult {
Ok(())
}
fn secondary_engine_check_optimizer_request(
&self,
_thd: Option<&sys::THD>,
_hypergraph: Option<&sys::JoinHypergraph>,
_access_path: Option<&sys::AccessPath>,
_current_subgraph_pairs: i32,
_current_subgraph_pairs_limit: i32,
_is_root_access_path: bool,
) -> SecondaryEngineOptimizerRequest {
SecondaryEngineOptimizerRequest::keep_going()
}
fn secondary_engine_pre_prepare_hook(&self, _thd: Option<&sys::THD>) -> bool {
false
}
fn is_dict_readonly(&self) -> bool {
false
}
fn rm_tmp_tables(&self, _thd: Option<&sys::THD>) -> EngineResult {
Ok(())
}
fn get_cost_constants(&self, _storage_category: u32) -> Option<CostConstants> {
None
}
fn replace_native_transaction_in_thd(&self, _thd: Option<&sys::THD>) {}
fn push_to_engine(&self, _thd: Option<&sys::THD>) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn rotate_encryption_master_key(&self) -> EngineResult {
Ok(())
}
fn redo_log_set_state(&self, _thd: Option<&sys::THD>, _enable: bool) -> EngineResult {
Ok(())
}
fn get_table_statistics(
&self,
_db_name: &str,
_table_name: &str,
_se_private_id: u64,
_flags: u32,
) -> EngineResult<Option<TableStatistics>> {
Ok(None)
}
fn get_index_column_cardinality(
&self,
_db_name: &str,
_table_name: &str,
_index_name: &str,
_index_ordinal_position: u32,
_column_ordinal_position: u32,
_se_private_id: u64,
) -> EngineResult<Option<u64>> {
Ok(None)
}
fn get_tablespace_statistics(
&self,
_tablespace_name: &str,
_file_name: &str,
) -> EngineResult<Option<TablespaceStatistics>> {
Ok(None)
}
fn post_ddl(&self, _thd: Option<&sys::THD>) {}
fn post_recover(&self) {}
fn clone_capability(&self) -> u64 {
0
}
fn clone_begin(
&self,
_thd: Option<&sys::THD>,
_clone_type: HaCloneType,
_mode: HaCloneMode,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn clone_copy(
&self,
_thd: Option<&sys::THD>,
_task_id: u32,
_cbk: Option<&sys::HaCloneCbk>,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn clone_ack(
&self,
_thd: Option<&sys::THD>,
_task_id: u32,
_in_err: i32,
_cbk: Option<&sys::HaCloneCbk>,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn clone_end(&self, _thd: Option<&sys::THD>, _task_id: u32, _in_err: i32) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn clone_apply_begin(
&self,
_thd: Option<&sys::THD>,
_mode: HaCloneMode,
_data_dir: &str,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn clone_apply(
&self,
_thd: Option<&sys::THD>,
_task_id: u32,
_in_err: i32,
_cbk: Option<&sys::HaCloneCbk>,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn clone_apply_end(
&self,
_thd: Option<&sys::THD>,
_task_id: u32,
_in_err: i32,
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn page_track_start(&self) -> EngineResult<u64> {
Err(crate::engine::EngineError::Unsupported)
}
fn page_track_stop(&self) -> EngineResult<u64> {
Err(crate::engine::EngineError::Unsupported)
}
fn page_track_purge(&self, _purge_id: u64) -> EngineResult<u64> {
Err(crate::engine::EngineError::Unsupported)
}
fn page_track_get_page_ids(
&self,
_start_id: u64,
_stop_id: u64,
_buffer: &mut [u8],
) -> EngineResult {
Err(crate::engine::EngineError::Unsupported)
}
fn page_track_get_num_page_ids(&self, _start_id: u64, _stop_id: u64) -> EngineResult<u64> {
Err(crate::engine::EngineError::Unsupported)
}
fn page_track_get_status(&self) {}
}
#[derive(Debug)]
struct NoopTxnSession;
impl TxnSession for NoopTxnSession {
fn commit(&mut self, _all: bool) -> EngineResult {
Ok(())
}
fn rollback(&mut self, _all: bool) -> EngineResult {
Ok(())
}
}