Created
September 15, 2014 05:35
-
-
Save manpages/9a231f243c4da20223d4 to your computer and use it in GitHub Desktop.
Better layot for OTP structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ArchJS do | |
use Application | |
import ArchJS.Macros.Sup | |
defsup User, [] do | |
defsofo Sessions, ArchJS.User.Session | |
children = [ | |
worker(ArchJS.User.Registry, []), | |
worker(ArchJS.User.Sessions, []) | |
] | |
supervise(children, strategy: :one_for_one) | |
end | |
defsup Content, [] do | |
defsofo Threads, ArchJS.Content.Thread | |
children = [ | |
worker(ArchJS.Content.Registry, []), | |
worker(ArchJS.Content.Threads, []) | |
] | |
supervise(children, strategy: :one_for_one) | |
end | |
defsup Root, link: [name: __MODULE__] do | |
children = [ | |
worker(ArchJS.User, []), | |
worker(ArchJS.Content, []), | |
worker(ArchJS.Persist, []) | |
] | |
supervise(children, strategy: :one_for_one) | |
end | |
def start(_type, _args) do | |
ArchJS.Root.start_link | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment