Struct TursoPersistence
pub struct TursoPersistence {
source: Source,
table_prefix: String,
pending_limit_bytes: usize,
}Expand description
Configures session persistence backed by a turso database.
Build one with new to share a database the caller already
owns, or open to let finmqtt manage a local database file,
then pass it to
ClientBuilder::persistence.
Fields§
§source: Source§table_prefix: String§pending_limit_bytes: usizeImplementations§
Source§impl TursoPersistence
impl TursoPersistence
Sourcepub fn new(database: Database) -> TursoPersistence
pub fn new(database: Database) -> TursoPersistence
Persists session state to database, using the default finmqtt_
table prefix.
finmqtt opens its own connection from database; the caller keeps
ownership and may share it with its own tables.
Sourcepub fn open<P>(path: P) -> TursoPersistence
pub fn open<P>(path: P) -> TursoPersistence
Persists session state to a local turso database file at path, which
finmqtt opens and owns, using the default finmqtt_ table prefix.
Sourcepub fn table_prefix<S>(self, prefix: S) -> TursoPersistence
pub fn table_prefix<S>(self, prefix: S) -> TursoPersistence
Overrides the prefix for the names of all tables that finmqtt creates.
Must consist only of ASCII alphanumeric characters and _ and
must not begin with a digit (it forms part of a SQL identifier).
Sourcepub const fn pending_limit_bytes(self, bytes: usize) -> TursoPersistence
pub const fn pending_limit_bytes(self, bytes: usize) -> TursoPersistence
Limits the memory used for session changes that are not yet persisted.
Once the changes would take more than bytes, the next persist writes
the whole session instead. This bounds memory while the storage keeps
failing. By default there is no limit.
Trait Implementations§
Source§impl Debug for TursoPersistence
impl Debug for TursoPersistence
Source§impl From<TursoPersistence> for SessionPersistence
Available on crate feature turso only.
impl From<TursoPersistence> for SessionPersistence
turso only.Source§fn from(config: TursoPersistence) -> SessionPersistence
fn from(config: TursoPersistence) -> SessionPersistence
Auto Trait Implementations§
impl !RefUnwindSafe for TursoPersistence
impl !UnwindSafe for TursoPersistence
impl Freeze for TursoPersistence
impl Send for TursoPersistence
impl Sync for TursoPersistence
impl Unpin for TursoPersistence
impl UnsafeUnpin for TursoPersistence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more