pub struct SingleDbConnection { /* private fields */ }Expand description
A native database backed by a single Mutex<SqliteConnection> instead of a
pool. Costs exactly one file descriptor. Chosen via the single_connection
builder flag — useful for services that run many clients in one process
(where a per-client pool would exhaust the OS file-descriptor limit) and do
serial work per client. There is no connection reentrancy in the codebase,
so a non-reentrant Mutex is safe (see the design spec).
The connection is held in an Option so that disconnect can drop it and
genuinely release the underlying file descriptor (SQLite closes the fd when
the connection is dropped). After a disconnect, raw_query returns
PlatformStorageError::PoolNeedsConnection — the same contract as the
pooled NativeDbConnection — until reconnect re-establishes it.
Trait Implementations§
Source§impl ConnectionExt for SingleDbConnection
impl ConnectionExt for SingleDbConnection
Source§fn raw_query<T, F>(&self, fun: F) -> Result<T, ConnectionError>
fn raw_query<T, F>(&self, fun: F) -> Result<T, ConnectionError>
fn disconnect(&self) -> Result<(), ConnectionError>
fn reconnect(&self) -> Result<(), ConnectionError>
Auto Trait Implementations§
impl Freeze for SingleDbConnection
impl !RefUnwindSafe for SingleDbConnection
impl Send for SingleDbConnection
impl Sync for SingleDbConnection
impl Unpin for SingleDbConnection
impl UnsafeUnpin for SingleDbConnection
impl !UnwindSafe for SingleDbConnection
Blanket Implementations§
§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read more§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read more§fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<C> Fetch<IdentityCache> for Cwhere
C: ConnectionExt,
impl<C> Fetch<IdentityCache> for Cwhere
C: ConnectionExt,
type Key = ()
fn fetch( &self, _key: &<C as Fetch<IdentityCache>>::Key, ) -> Result<Option<IdentityCache>, StorageError>
Source§impl<C> Fetch<PendingRemove> for Cwhere
C: ConnectionExt,
impl<C> Fetch<PendingRemove> for Cwhere
C: ConnectionExt,
type Key = ()
fn fetch( &self, _key: &<C as Fetch<PendingRemove>>::Key, ) -> Result<Option<PendingRemove>, StorageError>
Source§impl<C> Fetch<StoredAssociationState> for Cwhere
C: ConnectionExt,
impl<C> Fetch<StoredAssociationState> for Cwhere
C: ConnectionExt,
type Key = (String, i64)
fn fetch( &self, key: &<C as Fetch<StoredAssociationState>>::Key, ) -> Result<Option<StoredAssociationState>, StorageError>
Source§impl<C> Fetch<StoredGroup> for Cwhere
C: ConnectionExt,
impl<C> Fetch<StoredGroup> for Cwhere
C: ConnectionExt,
type Key = GroupId
fn fetch( &self, key: &<C as Fetch<StoredGroup>>::Key, ) -> Result<Option<StoredGroup>, StorageError>
Source§impl<C> Fetch<StoredGroupIntent> for Cwhere
C: ConnectionExt,
impl<C> Fetch<StoredGroupIntent> for Cwhere
C: ConnectionExt,
type Key = i32
fn fetch( &self, key: &<C as Fetch<StoredGroupIntent>>::Key, ) -> Result<Option<StoredGroupIntent>, StorageError>
Source§impl<C> Fetch<StoredGroupMessage> for Cwhere
C: ConnectionExt,
impl<C> Fetch<StoredGroupMessage> for Cwhere
C: ConnectionExt,
type Key = Vec<u8>
fn fetch( &self, key: &<C as Fetch<StoredGroupMessage>>::Key, ) -> Result<Option<StoredGroupMessage>, StorageError>
Source§impl<C> Fetch<StoredIdentity> for Cwhere
C: ConnectionExt,
impl<C> Fetch<StoredIdentity> for Cwhere
C: ConnectionExt,
type Key = ()
fn fetch( &self, _key: &<C as Fetch<StoredIdentity>>::Key, ) -> Result<Option<StoredIdentity>, StorageError>
Source§impl<C> Fetch<StoredKeyStoreEntry> for Cwhere
C: ConnectionExt,
impl<C> Fetch<StoredKeyStoreEntry> for Cwhere
C: ConnectionExt,
type Key = Vec<u8>
fn fetch( &self, key: &<C as Fetch<StoredKeyStoreEntry>>::Key, ) -> Result<Option<StoredKeyStoreEntry>, StorageError>
Source§impl<C> Fetch<UploadedTopic> for Cwhere
C: ConnectionExt,
impl<C> Fetch<UploadedTopic> for Cwhere
C: ConnectionExt,
type Key = Vec<u8>
fn fetch( &self, key: &<C as Fetch<UploadedTopic>>::Key, ) -> Result<Option<UploadedTopic>, StorageError>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].