Struct orchestrator::default_memory::DefaultMemory

source ·
pub struct DefaultMemory { /* private fields */ }
Expand description

MUST be used only for testing, not recomended in production

saves password as it is, and doesn’t do any sanification…

in addition to that all users are admin by default

Implementations§

source§

impl DefaultMemory

source

pub fn init<S: ExecutorGlobalState>() -> Box<dyn Memory<S>>

Generates a new DefaultMemory

Trait Implementations§

source§

impl<S: ExecutorGlobalState> StateMemory<S> for DefaultMemory

source§

fn enable_executor<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, input: &'life1 S, output: &'life2 S, data: String, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError + Send + Sync + 'static>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

enable an executor. It should be already checked if it is a valid executor or not checks if adding this element creates a cycle or not

source§

fn add_exercise<'life0, 'async_trait>( &'life0 self, name: String, exercise_type: S, source: String, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError + Send + Sync + 'static>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

add an exercise to memory

source§

fn get_exercise<'life0, 'async_trait>( &'life0 self, name: String, ) -> Pin<Box<dyn Future<Output = Result<(TypeId, String), Box<dyn StdError + Send + Sync + 'static>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

get an exercise from memory type, source

source§

fn get_execution_plan<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Vec<(TypeId, TypeId, String)>, Box<dyn StdError + Send + Sync + 'static>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

from a particular state, which executor will be triggered? in which order?
source§

impl StatelessMemory for DefaultMemory

source§

fn get_authenticate<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<User<Authenticated>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

check if the given token is valid, and if so returns the correct user

source§

fn add_submission<'life0, 'async_trait>( &'life0 self, exercise_name: String, source: String, user: User<Authenticated>, ) -> Pin<Box<dyn Future<Output = Result<i64, Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

add submission (on success returns submission id)

source§

fn add_exercise_result<'life0, 'async_trait>( &'life0 self, submission_id: i64, user: User<Authenticated>, result: ExerciseResult, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

add exercise result

source§

fn register<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, username: &'life1 str, password: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<User<Unauthenticated>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

register User, it should not authenticate it
source§

fn login<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, username: &'life1 str, password: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<User<Authenticated>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

try to log in the relative user
source§

fn get_by_username<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<User<Unauthenticated>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

search an user from his username
source§

fn get_all_users<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<User<Unauthenticated>>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

prints out all users
source§

fn get_admin<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<User<Admin>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

get an authenticated admin from his token
source§

fn list_exercise_names<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Box<dyn StdError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

list exercises names

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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<S, Cur> Memory<S> for Cur

source§

fn as_stateless(&self) -> &dyn StatelessMemory

conversion into a StatelessMemory
source§

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

§

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

§

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.
§

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

§

fn vzip(self) -> V