lecture 05

This commit is contained in:
SowinskiBraeden committed 2026-10-08 20:59:37 -07:00
1 parent 14dc7cdbac
commit 06c4362a87
19 files changed
+439

No files matched your search

@@ -0,0 +1,26 @@
defmodule Counter.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
@registry Counter.Registry
@table Counter.Table
use Application
@impl true
def start(_type, _args) do
children = [
{Registry, name: @registry, keys: :unique}, # recall same as {Registry, [name: @registry, keys: :unique]}
# Starts a worker by calling: Counter.Worker.start_link(arg)
# {DynamicSupervisor, name: Counter.DynamicSupervisor, strategy: :one_for_one}
Counter.DynamicSupervisor # no argument passed so we can just use this
]
:ets.new(@table, [:named_table, :public])
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Counter.Supervisor]
Supervisor.start_link(children, opts)
end
end