Implementing the QuizManager with Processes
Let's start creating our first GenServer, the quiz manager.
We'll cover the following...
We'll cover the following...
QuizManager
The quiz manager will start with an empty map:
-
We’ll add quizzes to it through a call to
:build_quiz
. -
Then, we’ll add templates to a quiz in the store through a call to
:add_template
. -
We’ll add a function to let our users look up a quiz by name.
Declaring our boundary
We’ll open up /lib/mastery/boundary/quiz_manager.ex
. It’s a straight Elixir module that looks like this:
Press + to interact
defmodule Mastery.Boundary.QuizManager doalias Mastery.Core.Quizuse GenServerend
-
We declare the module and setup our initial aliases for
Quiz
. -
Then we
use GenServer
. Theuse
function is an Elixir macro. As we know, macros are code that ...