complete threads till 06
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
|
||||
use data::TicketDraft;
|
||||
use store::TicketStore;
|
||||
|
||||
pub mod data;
|
||||
pub mod store;
|
||||
|
||||
pub enum Command {
|
||||
Insert(todo!()),
|
||||
Insert(TicketDraft),
|
||||
}
|
||||
|
||||
// Start the system by spawning the server thread.
|
||||
@@ -20,4 +23,14 @@ pub fn launch() -> Sender<Command> {
|
||||
// Enter a loop: wait for a command to show up in
|
||||
// the channel, then execute it, then start waiting
|
||||
// for the next command.
|
||||
pub fn server(receiver: Receiver<Command>) {}
|
||||
pub fn server(receiver: Receiver<Command>) {
|
||||
let mut tickStor = TicketStore::new();
|
||||
'aLoop: loop {
|
||||
let command = receiver.recv().ok().unwrap();
|
||||
match command {
|
||||
Command::Insert(a) => {
|
||||
tickStor.add_ticket(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ fn ready() {
|
||||
// since our server doesn't expose any **read** actions.
|
||||
// We have no way to know if the inserts are actually happening and if they
|
||||
// are happening correctly.
|
||||
let move_forward = false;
|
||||
let move_forward = true;
|
||||
|
||||
assert!(move_forward);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user