Struct OpfsSAHPoolUtil

Source
pub struct OpfsSAHPoolUtil { /* private fields */ }
Expand description

A OpfsSAHPoolUtil instance is exposed to clients in order to manipulate an OpfsSAHPool object without directly exposing that object and allowing for some semantic changes compared to that class.

Implementations§

Source§

impl OpfsSAHPoolUtil

Source

pub async fn add_capacity(&self, n: u32) -> Result<u32, OpfsSAHError>

Adds n entries to the current pool.

Source

pub async fn reduce_capacity(&self, n: u32) -> Result<u32, OpfsSAHError>

Removes up to n entries from the pool, with the caveat that it can only remove currently-unused entries.

Source

pub fn get_capacity(&self) -> u32

Returns the number of files currently contained in the SAH pool.

Source

pub async fn reserve_minimum_capacity( &self, min: u32, ) -> Result<(), OpfsSAHError>

Removes up to n entries from the pool, with the caveat that it can only remove currently-unused entries.

Source§

impl OpfsSAHPoolUtil

Source

pub fn import_db(&self, path: &str, bytes: &[u8]) -> Result<(), OpfsSAHError>

Imports the contents of an SQLite database, provided as a byte array under the given name, overwriting any existing content.

If the database is imported with WAL mode enabled, it will be forced to write back to legacy mode, see https://sqlite.org/forum/forumpost/67882c5b04.

If the imported DB is encrypted, use import_db_unchecked instead.

Source

pub fn import_db_unchecked( &self, path: &str, bytes: &[u8], ) -> Result<(), OpfsSAHError>

import_db without checking, can be used to import encrypted database.

Source

pub fn export_db(&self, path: &str) -> Result<Vec<u8>, OpfsSAHError>

Export the database.

Source

pub fn delete_db(&self, path: &str) -> Result<bool, OpfsSAHError>

Delete the specified database, please make sure that the database is closed.

Source

pub async fn clear_all(&self) -> Result<(), OpfsSAHError>

Delete all database, please make sure that all database is closed.

Source

pub fn exists(&self, path: &str) -> Result<bool, OpfsSAHError>

Does the database exists.

Source

pub fn list(&self) -> Vec<String>

List all file paths.

Source

pub fn count(&self) -> u32

Number of files.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.