Trait mariadb::storage::Handler

source ·
pub trait Handler: 'static {
    type Handlerton: Handlerton;

    const SUPPORTS_INDEX: bool = false;
    const MAX_SUPPORTED_RECORD_LENGTH: usize = 65_535usize;

    // Required methods
    fn new(table: &TableShare<'_>, mem_root: MemRoot<'_>) -> Self;
    fn open(name: &Path, mode: Mode, open_options: OpenOp) -> StorageResult;

    // Provided methods
    fn create(
        &self,
        name: &CStr,
        form: TableShare<'_>,
        create_info: &CreateInfo<'_>
    ) { ... }
    fn table_flags(&self) -> TableFlags { ... }
    fn write_row(buf: &CStr) { ... }
    fn update_row() { ... }
    fn delete_row() { ... }
    fn delete_all_rows() { ... }
    fn store_lock(&self) { ... }
    fn scan_time(&self, ctx: HandlerCtx<'_>) -> IoAndCpuCost { ... }
    fn rnd_pos_time(&self, ctx: HandlerCtx<'_>, rows: usize) -> IoAndCpuCost { ... }
}

Required Associated Types§

Provided Associated Constants§

source

const SUPPORTS_INDEX: bool = false

Set this to true if index support is available. If so, this type must also implement IndexHandler.

source

const MAX_SUPPORTED_RECORD_LENGTH: usize = 65_535usize

Required Methods§

source

fn new(table: &TableShare<'_>, mem_root: MemRoot<'_>) -> Self

Create a new handler

§When is this called?
  • Every time there is a new connection
source

fn open(name: &Path, mode: Mode, open_options: OpenOp) -> StorageResult

Open a table, the name will be the name of the file.

Closing happens by dropping this item.

§When is this called?

Not for every request, more to come…

Provided Methods§

source

fn create( &self, name: &CStr, form: TableShare<'_>, create_info: &CreateInfo<'_> )

Create a new table and exit

This should

§When is this called?
  • SQL CREATE TABLE statements
source

fn table_flags(&self) -> TableFlags

source

fn write_row(buf: &CStr)

This is an INSERT statement

source

fn update_row()

source

fn delete_row()

source

fn delete_all_rows()

Delete all rows

§When is this called?
  • SQL DELETE with no WHERE clause
source

fn store_lock(&self)

source

fn scan_time(&self, ctx: HandlerCtx<'_>) -> IoAndCpuCost

Time for a full table data scan

source

fn rnd_pos_time(&self, ctx: HandlerCtx<'_>, rows: usize) -> IoAndCpuCost

Cost of fetching rows records through rnd_pos.

Object Safety§

This trait is not object safe.

Implementors§