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
impl DefaultMemory
sourcepub fn init<S: ExecutorGlobalState>() -> Box<dyn Memory<S>>
pub fn init<S: ExecutorGlobalState>() -> Box<dyn Memory<S>>
Generates a new DefaultMemory
Trait Implementations§
source§impl<S: ExecutorGlobalState> StateMemory<S> for DefaultMemory
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,
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,
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,
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,
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
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,
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,
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,
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,
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,
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,
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,
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
Auto Trait Implementations§
impl !Freeze for DefaultMemory
impl !RefUnwindSafe for DefaultMemory
impl Send for DefaultMemory
impl Sync for DefaultMemory
impl Unpin for DefaultMemory
impl UnwindSafe for DefaultMemory
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<S, Cur> Memory<S> for Cur
impl<S, Cur> Memory<S> for Cur
source§fn as_stateless(&self) -> &dyn StatelessMemory
fn as_stateless(&self) -> &dyn StatelessMemory
conversion into a StatelessMemory