Manager

Struct Manager 

Source
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,

Source

pub fn builder() -> ManagerBuilder<DBCP>

Creates a new builder for this struct.

Source§

impl<DBCP> Manager<DBCP>
where DBCP: DBProvider,

Source

pub async fn get_by_session_id(&self, session_id: i64) -> Result<Vec<Model>>

Get session by its ID.

Trait Implementations§

Source§

impl<DBCP> Child for Manager<DBCP>
where DBCP: DBProvider,

Source§

type WeakParent = Weak<DBCP>

Type of weak reference to the parent.
Source§

type FXPParent = Weak<DBCP>

For use of the child_build! and child_builder! macros.
Source§

type RcParent = Result<Arc<DBCP>, SimErrorAny>

Type of strong reference to the parent.
Source§

fn parent(&self) -> Self::RcParent

Return a strong reference to the parent.
Source§

fn parent_downgrade(&self) -> Self::WeakParent

Return a weak reference to the parent.
Source§

fn __fxplus_parent(parent: Self::WeakParent) -> Self::FXPParent

Source§

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>

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

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,

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>>
where AM: Into<T::ActiveModel> + Clone + Send + Sync + 'static + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: '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,

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,

Called when a record is modified by the user. Read more
Source§

impl<DBCP> DataController for Manager<DBCP>
where DBCP: DBProvider,

Source§

type CacheUpdate = CacheUpdates<ActiveModel>

The type of the update pool records that are produced by the data controller. Read more
Source§

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 Key = i64

The key type to be used with methods like Cache::get() or Cache::entry(). Read more
Source§

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,

Must return the value for the given key, if it exists, None otherwise. Read more
Source§

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,

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,

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 more
Source§

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 more
Source§

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>

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,

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

Returns true if the given key is considered the primary key. Read more
Source§

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,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, U> FXInto<U> for T
where U: FXFrom<T>,

Source§

fn fx_into(self) -> U

Source§

impl<T, U> FXTryInto<U> for T
where U: FXTryFrom<T>,

Source§

type Error = <U as FXTryFrom<T>>::Error

Source§

fn fx_try_into(self) -> Result<U, <T as FXTryInto<U>>::Error>

Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,