Struct TursoPersistence
pub struct TursoPersistence {
source: Source,
table_prefix: String,
}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: StringImplementations§
§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(path: impl Into<PathBuf>) -> Self
pub fn open(path: impl Into<PathBuf>) -> 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(self, prefix: impl Into<String>) -> Self
pub fn table_prefix(self, prefix: impl Into<String>) -> Self
Overrides the prefix applied to every table name finmqtt creates.
Must consist only of ASCII alphanumeric characters and underscores and must not begin with a digit (it forms part of a SQL identifier).
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 From<TursoPersistence> for SessionPersistence
impl From<TursoPersistence> for SessionPersistence
§fn from(config: TursoPersistence) -> Self
fn from(config: TursoPersistence) -> Self
Auto Trait Implementations§
impl Freeze for TursoPersistence
impl !RefUnwindSafe for TursoPersistence
impl Send for TursoPersistence
impl Sync for TursoPersistence
impl Unpin for TursoPersistence
impl !UnwindSafe 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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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