pub mod store;
pub enum Command {
- Insert(todo!()),
+ Insert(data::TicketDraft),
}
// Start the system by spawning the server the thread.
// 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 store = store::TicketStore::new();
+ loop {
+ match receiver.recv() {
+ Ok(Command::Insert(ticket)) => _ = store.add_ticket(ticket),
+ Err(err) => println!("Error during receive: {:?}", err),
+ }
+ }
+}
// 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);
}