WT_COLLATOR

Type Alias WT_COLLATOR 

Source
pub type WT_COLLATOR = __wt_collator;
Expand description

The interface implemented by applications to provide custom ordering of records.

Applications register their implementation with WiredTiger by calling WT_CONNECTION::add_collator. See @ref custom_collators for more information.

@snippet ex_extending.c add collator nocase

@snippet ex_extending.c add collator prefix10

Aliased Type§

#[repr(C)]
pub struct WT_COLLATOR { pub compare: Option<unsafe extern "C" fn(*mut __wt_collator, *mut __wt_session, *const __wt_item, *const __wt_item, *mut i32) -> i32>, pub customize: Option<unsafe extern "C" fn(*mut __wt_collator, *mut __wt_session, *const i8, *mut __wt_config_item, *mut *mut __wt_collator) -> i32>, pub terminate: Option<unsafe extern "C" fn(*mut __wt_collator, *mut __wt_session) -> i32>, }

Fields§

§compare: Option<unsafe extern "C" fn(*mut __wt_collator, *mut __wt_session, *const __wt_item, *const __wt_item, *mut i32) -> i32>

Callback to compare keys.

@param[out] cmp set to -1 if key1 < key2, 0 if key1 == key2, 1 if key1 > key2. @returns zero for success, non-zero to indicate an error.

@snippet ex_all.c Implement WT_COLLATOR

@snippet ex_extending.c case insensitive comparator

@snippet ex_extending.c n character comparator

§customize: Option<unsafe extern "C" fn(*mut __wt_collator, *mut __wt_session, *const i8, *mut __wt_config_item, *mut *mut __wt_collator) -> i32>

If non-NULL, this callback is called to customize the collator for each data source. If the callback returns a non-NULL collator, that instance is used instead of this one for all comparisons.

§terminate: Option<unsafe extern "C" fn(*mut __wt_collator, *mut __wt_session) -> i32>

If non-NULL a callback performed when the data source is closed for customized extractors otherwise when the database is closed.

The WT_COLLATOR::terminate callback is intended to allow cleanup, the handle will not be subsequently accessed by WiredTiger.