Packages
honeydew
0.0.1
1.5.0
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc7
1.0.0-rc6
1.0.0-rc5
1.0.0-rc4
1.0.0-rc3
1.0.0-rc2
1.0.0-rc1
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Pluggable local/clusterable job queue focused on safety.
Current section
Files
Jump to
Current section
Files
lib/honeydew.ex
defmodule Honeydew do
use Application
def start(_type, _args) do
import Supervisor.Spec
# used for random ids for job backlog set (otherwise some jobs would be seen as identical and not added to the set)
:random.seed(:erlang.now)
children = [
supervisor(Honeydew.HomeSupervisor, [])
]
opts = [strategy: :simple_one_for_one, name: Honeydew.Supervisor]
Supervisor.start_link(children, opts)
end
def start_pool(honey_module, honey_init_args, opts) do
# make sure the module exists
try do
apply(honey_module, :__info__, [:attributes])
rescue UndefinedFunctionError ->
raise ~s(Honeydew can't find the worker module named "#{honey_module}")
end
# start a HomeSupervisor
Supervisor.start_child(Honeydew.Supervisor, [honey_module, honey_init_args, opts])
end
#
# Process names
#
@doc "The process name for the HomeSupervisor of the given honey module."
def home_supervisor(honey_module) do
Honeydew
|> Module.concat(honey_module)
|> Module.concat(HomeSupervisor)
end
@doc "The process name for the JobList server of the given honey module."
def job_list(honey_module) do
Honeydew
|> Module.concat(honey_module)
|> Module.concat(JobList)
end
@doc "The process name for the HoneySupervisor of the given honey module."
def honey_supervisor(honey_module) do
Honeydew
|> Module.concat(honey_module)
|> Module.concat(HoneySupervisor)
end
defmacro __using__(_env) do
quote do
use Honeydew.Honey
end
end
end