pub struct Manager<DBCP>where
DBCP: DBProvider,{ /* private fields */ }Expand description
The manager and the data controller for the session model.
Implementations§
Source§impl<DBCP> Manager<DBCP>where
DBCP: DBProvider,
impl<DBCP> Manager<DBCP>where
DBCP: DBProvider,
Sourcepub fn builder() -> ManagerBuilder<DBCP>
pub fn builder() -> ManagerBuilder<DBCP>
Creates a new builder for this struct.
Source§impl<DBCP> Manager<DBCP>where
DBCP: DBProvider,
impl<DBCP> Manager<DBCP>where
DBCP: DBProvider,
Trait Implementations§
Source§impl<DBCP> Child for Manager<DBCP>where
DBCP: DBProvider,
impl<DBCP> Child for Manager<DBCP>where
DBCP: DBProvider,
Source§type WeakParent = Weak<DBCP>
type WeakParent = Weak<DBCP>
Type of weak reference to the parent.
Source§type FXPParent = Weak<DBCP>
type FXPParent = Weak<DBCP>
For use of the
child_build! and child_builder! macros.Source§fn parent_downgrade(&self) -> Self::WeakParent
fn parent_downgrade(&self) -> Self::WeakParent
Return a weak reference to the parent.
fn __fxplus_parent(parent: Self::WeakParent) -> Self::FXPParent
Source§impl<DBCP> DCCommon<Entity, DBCP, true> for Manager<DBCP>where
DBCP: DBProvider,
impl<DBCP> DCCommon<Entity, DBCP, true> for Manager<DBCP>where
DBCP: DBProvider,
Source§fn delete_many_condition(
dm: DeleteMany<Entity>,
keys: Vec<Self::Key>,
) -> DeleteMany<Entity>
fn delete_many_condition( dm: DeleteMany<Entity>, keys: Vec<Self::Key>, ) -> DeleteMany<Entity>
Provide correct condition for SeaORM’s
DeleteMany operation. See, for example,
CustomerManager::delete_many_condition
source code.Source§fn db_provider(&self) -> <Self as Child>::RcParent
fn db_provider(&self) -> <Self as Child>::RcParent
Where we get our database connection from.
Source§fn wbdc_write_back<'life0, 'async_trait>(
&'life0 self,
update_records: Arc<UpdateIterator<Self>>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn wbdc_write_back<'life0, 'async_trait>(
&'life0 self,
update_records: Arc<UpdateIterator<Self>>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Try to send given update records to the database in the most efficient way. This task is accomplished by: Read more
Source§fn wbdbc_on_new<'life0, 'life1, 'life2, 'async_trait, AM>(
&'life0 self,
_key: &'life1 Self::Key,
value: &'life2 AM,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>
fn wbdbc_on_new<'life0, 'life1, 'life2, 'async_trait, AM>( &'life0 self, _key: &'life1 Self::Key, value: &'life2 AM, ) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>
For every new data record added this method respond with [
CacheUpdates::Insert(record_active_mode)] update.
The DataControllerOp depends on the IMMUTABLE flag: if it is set to true, the operation is
DataControllerOp::Insert, otherwise it is DataControllerOp::Nop.Source§fn wbdc_on_delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_key: &'life1 Self::Key,
update: Option<&'life2 CacheUpdates<T::ActiveModel>>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn wbdc_on_delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_key: &'life1 Self::Key,
update: Option<&'life2 CacheUpdates<T::ActiveModel>>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute record deletion. Read more
Source§fn wbdc_on_change<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
value: &'life2 Self::Value,
old_value: Self::Value,
prev_update: Option<Self::CacheUpdate>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn wbdc_on_change<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
value: &'life2 Self::Value,
old_value: Self::Value,
prev_update: Option<Self::CacheUpdate>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a record is modified by the user. Read more
Source§impl<DBCP> DataController for Manager<DBCP>where
DBCP: DBProvider,
impl<DBCP> DataController for Manager<DBCP>where
DBCP: DBProvider,
Source§type CacheUpdate = CacheUpdates<ActiveModel>
type CacheUpdate = CacheUpdates<ActiveModel>
The type of the update pool records that are produced by the data controller. Read more
Source§type Error = SimErrorAny
type Error = SimErrorAny
The error type that the data controller can return. Note that this is the only error type the the cache
controller is using!
Source§type Value = Model
type Value = Model
The record type to be stored in the cache and maintained by the data controller.
Source§fn get_for_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Self::Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_for_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Self::Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Must return the value for the given key, if it exists,
None otherwise. Read moreSource§fn primary_key_of(&self, value: &Self::Value) -> Self::Key
fn primary_key_of(&self, value: &Self::Value) -> Self::Key
Returns the primary key for the given value. Read more
Source§fn write_back<'life0, 'async_trait>(
&'life0 self,
update_records: Arc<UpdateIterator<Self>>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_back<'life0, 'async_trait>(
&'life0 self,
update_records: Arc<UpdateIterator<Self>>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Given a list of update records, must apply these updates to the underlying backend. Read more
Source§fn on_new<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
value: &'life2 Self::Value,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_new<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
value: &'life2 Self::Value,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a new record is added to the cache. On success, it must return a
DataControllerResponse with the
operation type set to what the data controller considers appropriate for the new record. For example, if it is
known that the new record will have exactly the same field values after being written to the backend as it had
when submitted to this method, then the operation can be set to DataControllerOp::Insert. Read moreSource§fn on_delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
update: Option<&'life2 CacheUpdates<ActiveModel>>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
update: Option<&'life2 CacheUpdates<ActiveModel>>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when there is a
delete request for the given key has been received. Don’t mix it up with the invalidate
request which is only clearing a cache entry. Read moreSource§fn on_change<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
value: &'life2 Self::Value,
old_value: Self::Value,
prev_update: Option<Self::CacheUpdate>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_change<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
value: &'life2 Self::Value,
old_value: Self::Value,
prev_update: Option<Self::CacheUpdate>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a record is modified by the user. Read more
Source§fn secondary_keys_of(&self, _value: &Self::Value) -> Vec<Self::Key>
fn secondary_keys_of(&self, _value: &Self::Value) -> Vec<Self::Key>
Returns a list of secondary keys for the given value. Default implementation returns an empty vector. Read more
Source§fn get_primary_key_for<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Key>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_primary_key_for<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Key>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Take a key and return its corresponding primary key. This operation may require a backend request. Read more
Source§fn is_primary(&self, _key: &Self::Key) -> bool
fn is_primary(&self, _key: &Self::Key) -> bool
Returns
true if the given key is considered the primary key. Read moreSource§fn on_access<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_key: &'life1 Self::Key,
_value: &'life2 Self::Value,
prev_update: Option<Self::CacheUpdate>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_access<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_key: &'life1 Self::Key,
_value: &'life2 Self::Value,
prev_update: Option<Self::CacheUpdate>,
) -> Pin<Box<dyn Future<Output = Result<DataControllerResponse<Self>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
This method is called on every access to the given key in the cache. It can be used to implement various related
functionality like updateing the access time column in the backend, or calculating related metrics or
statistics. Read more
Source§impl<DBCP> Debug for Manager<DBCP>where
DBCP: DBProvider,
impl<DBCP> Debug for Manager<DBCP>where
DBCP: DBProvider,
impl<DBCP> FXStruct for Manager<DBCP>where
DBCP: DBProvider,
Auto Trait Implementations§
impl<DBCP> Freeze for Manager<DBCP>
impl<DBCP> RefUnwindSafe for Manager<DBCP>where
DBCP: RefUnwindSafe,
impl<DBCP> Send for Manager<DBCP>
impl<DBCP> Sync for Manager<DBCP>
impl<DBCP> Unpin for Manager<DBCP>
impl<DBCP> UnwindSafe for Manager<DBCP>where
DBCP: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.