Skip to main content

StoreCallbacks

Struct StoreCallbacks 

Source
#[repr(C)]
pub struct StoreCallbacks { pub get: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, output: *mut BufferFFI) -> i32, pub contains_key: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, result: *mut u8) -> i32, pub prefix: extern "C" fn(ctx: *mut FFIContext, prefix: *const u8, prefix_len: usize, iterator_out: *mut *mut StoreIteratorFFI) -> i32, pub range: extern "C" fn(ctx: *mut FFIContext, start: *const u8, start_len: usize, start_bound_type: u8, end: *const u8, end_len: usize, end_bound_type: u8, iterator_out: *mut *mut StoreIteratorFFI) -> i32, pub iterator_next: extern "C" fn(iterator: *mut StoreIteratorFFI, key_out: *mut BufferFFI, value_out: *mut BufferFFI) -> i32, pub iterator_free: extern "C" fn(iterator: *mut StoreIteratorFFI), }
Expand description

Store access callbacks (read-only access to underlying store)

Fields§

§get: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, output: *mut BufferFFI) -> i32

Get a value from store by key

§Parameters

  • ctx: FFI context
  • key: Key bytes
  • key_len: Length of key
  • output: Buffer to receive value

§Returns

  • 0 if value exists and retrieved, 1 if key not found, negative on error
§contains_key: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, result: *mut u8) -> i32

Check if a key exists in store

§Parameters

  • ctx: FFI context
  • key: Key bytes
  • key_len: Length of key
  • result: Pointer to receive result (1 if exists, 0 if not)

§Returns

  • 0 on success, negative error code on failure
§prefix: extern "C" fn(ctx: *mut FFIContext, prefix: *const u8, prefix_len: usize, iterator_out: *mut *mut StoreIteratorFFI) -> i32

Create an iterator for store keys with a given prefix

§Parameters

  • ctx: FFI context
  • prefix: Prefix bytes
  • prefix_len: Length of prefix
  • iterator_out: Pointer to receive iterator handle

§Returns

  • 0 on success, negative error code on failure
§range: extern "C" fn(ctx: *mut FFIContext, start: *const u8, start_len: usize, start_bound_type: u8, end: *const u8, end_len: usize, end_bound_type: u8, iterator_out: *mut *mut StoreIteratorFFI) -> i32

Create an iterator for store keys in a range

§Parameters

  • ctx: FFI context
  • start: Start key bytes
  • start_len: Length of start key
  • start_bound_type: Bound type for start (0=Unbounded, 1=Included, 2=Excluded)
  • end: End key bytes
  • end_len: Length of end key
  • end_bound_type: Bound type for end (0=Unbounded, 1=Included, 2=Excluded)
  • iterator_out: Pointer to receive iterator handle

§Returns

  • 0 on success, negative error code on failure
§iterator_next: extern "C" fn(iterator: *mut StoreIteratorFFI, key_out: *mut BufferFFI, value_out: *mut BufferFFI) -> i32

Get the next key-value pair from a store iterator

§Parameters

  • iterator: Iterator handle
  • key_out: Buffer to receive key
  • value_out: Buffer to receive value

§Returns

  • 0 on success, 1 if end of iteration, negative on error
§iterator_free: extern "C" fn(iterator: *mut StoreIteratorFFI)

Free a store iterator

§Parameters

  • iterator: Iterator to free

Trait Implementations§

Source§

impl Clone for StoreCallbacks

Source§

fn clone(&self) -> StoreCallbacks

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StoreCallbacks

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.