Struct TursoPersistence
pub struct TursoPersistence {
source: Source,
table_prefix: String,
pending_limit_bytes: usize,
}tokio and turso only.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§
§impl TursoPersistence
impl TursoPersistence
pub fn new(database: Database) -> Self
pub fn new(database: Database) -> Self
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.
pub fn open<P: Into<PathBuf>>(path: P) -> Self
pub fn open<P: Into<PathBuf>>(path: P) -> Self
Persists session state to a local turso database file at path, which
finmqtt opens and owns, using the default finmqtt_ table prefix.
fn with_source(source: Source) -> Self
pub fn table_prefix<S: Into<String>>(self, prefix: S) -> Self
pub fn table_prefix<S: Into<String>>(self, prefix: S) -> Self
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).
pub const fn pending_limit_bytes(self, bytes: usize) -> Self
pub const fn pending_limit_bytes(self, bytes: usize) -> Self
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.
pub(crate) async fn build(self) -> Result<(JournaledSession, TursoStore)>
pub(crate) async fn build(self) -> Result<(JournaledSession, TursoStore)>
Opens the store and loads any persisted session.
Trait Implementations§
§impl Debug for TursoPersistence
impl Debug for TursoPersistence
§impl From<TursoPersistence> for SessionPersistence
impl From<TursoPersistence> for SessionPersistence
§fn from(config: TursoPersistence) -> Self
fn from(config: TursoPersistence) -> Self
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