Module jobs_server

Behaviours: gen_server.

Authors: : Ulf Wiger (ulf@wiger.net).

Data Types

counter()

abstract datatype: counter()

ctx_options()

ctx_options() = [{_Ctxt::env | opts, _App::user | atom(), [option()]}]

info_category()

info_category() = queues | group_rates | counters

job_class()

job_class() = any()

mod_args()

mod_args() = {atom(), list()}

mod_fun()

mod_fun() = {atom(), atom()}

option()

option() = {queues, [q_spec()]} | {config, file:name()} | {group_rates, [{q_name(), [option()]}]} | {counters, [{q_name(), [option()]}]} | {interval, integer()}

q_check_interval()

q_check_interval() = integer() | infinity | mfa()

q_modifier()

q_modifier() = {q_modifier_name(), integer()} | {q_modifier_name(), integer(), q_modifier_remote()} | {q_modifier_name(), fun((integer(), q_modifier_remote()) -> integer())} | {q_modifier_name(), mod_fun()}

q_modifier_name()

q_modifier_name() = cpu | memory | any()

q_modifier_remote()

q_modifier_remote() = {avg | max, integer()}

q_modifiers()

q_modifiers() = [q_modifier()]

q_name()

q_name() = any()

q_opt()

q_opt() = {regulators, [q_reg_opt()]} | {type, q_opt_type()} | {producer, q_producer()} | passive | {passive, fifo} | {action, q_opt_action()} | q_opt_action() | {check_interval, q_check_interval()} | {max_time, integer()} | {max_size, integer()} | {mod, atom()} | {standard_rate, integer()} | {standard_counter, integer()}

q_opt_action()

q_opt_action() = approve | reject

q_opt_type()

q_opt_type() = fifo | lifo | {producer, q_producer()} | {action, q_opt_action()}

q_opts()

q_opts() = [q_opt()]

q_producer()

q_producer() = function() | mfa() | mod_args()

q_reg_counter()

q_reg_counter() = {limit, integer()} | {increment, integer()} | {modifiers, q_modifiers()} | {name, any()}

q_reg_opt()

q_reg_opt() = {rate, q_reg_rate()} | {counter, q_reg_counter()} | {named_counter, any(), integer()} | {group_rate, q_reg_rate()}

q_reg_rate()

q_reg_rate() = {limit, integer()} | {modifiers, q_modifiers()} | {name, any()}

q_spec()

q_spec() = {q_name(), q_std_type(), q_opts()} | {q_name(), q_opts()}

q_std_type()

q_std_type() = standard_rate | standard_counter

queue_name()

queue_name() = any()

reg_obj()

abstract datatype: reg_obj()

regulator()

regulator() = #rr{} | #cr{} | regulator_ref()

regulator_ref()

regulator_ref() = #group_rate{} | #counter{}

timestamp()

timestamp() = integer()

Function Index

add_counter/2
add_group_rate/2
add_queue/2
ask/0
ask/1
ask_queue/2Invoke the Q:handle_call/3 function (if it exists).
auto_restore/1
code_change/3
delete_counter/1
delete_group_rate/1
delete_queue/1
dequeue/2
done/1
enqueue/2
handle_call/3
handle_cast/2
handle_info/2
info/1
init/1
modify_counter/2
modify_group_rate/2
modify_queue/2
modify_regulator/4
queue_info/1
queue_info/2
run/1
run/2
set_modifiers/1
start_link/0
start_link/1
terminate/2
timestamp/0
timestamp_to_datetime/1

Function Details

add_counter/2

add_counter(Name, Options) -> any()

add_group_rate/2

add_group_rate(Name, Options) -> any()

add_queue/2

add_queue(Name::queue_name(), Options::q_opts()) -> ok

ask/0

ask() -> {ok, any()} | {error, rejected | timeout}

ask/1

ask(Type::job_class()) -> {ok, reg_obj()} | {error, rejected | timeout}

ask_queue/2

ask_queue(QName::queue_name(), Request::any()) -> any()

Invoke the Q:handle_call/3 function (if it exists).

Send a request to a specific queue in the JOBS server. Each queue has its own local state, allowing it to collect special statistics. This function allows a client to send a request that is handled by a specific queue instance, either to pull information from the queue, or to influence its state.

auto_restore/1

auto_restore(Flag) -> any()

code_change/3

code_change(FromVsn, St, Extra) -> any()

delete_counter/1

delete_counter(Name) -> any()

delete_group_rate/1

delete_group_rate(Name) -> any()

delete_queue/1

delete_queue(Name::queue_name()) -> ok

dequeue/2

dequeue(Type::job_class(), N::integer() | infinity) -> [{timestamp(), any()}]

done/1

done(Opaque::reg_obj()) -> ok

enqueue/2

enqueue(Type::job_class(), Item::any()) -> ok

handle_call/3

handle_call(Req, From, S) -> any()

handle_cast/2

handle_cast(Msg, St) -> any()

handle_info/2

handle_info(Msg, St) -> any()

info/1

info(Item::info_category()) -> [any()]

init/1

init(Opts::[option()]) -> {ok, #st{queues = [#queue{name = any(), mod = atom(), type = fifo | lifo | #producer{} | #passive{type = fifo} | #action{a = q_opt_action()} | q_opt_type(), group = atom(), regulators = [regulator() | regulator_ref()], max_time = integer() | undefined, max_size = integer() | undefined, latest_dispatch = integer(), approved = any(), queued = any(), check_interval = q_check_interval() | undefined, oldest_job = integer() | undefined, timer = any(), link_ref = undefined | reference(), check_counter = integer(), empty = boolean(), depleted = boolean(), waiters = [{pid(), reference()}], stateful = any(), st = any()}] | [tuple()], group_rates = [#grp{name = any(), rate = any(), latest_dispatch = integer()}], counters = [#cr{}], monitors = any(), q_select = atom(), q_select_st = any(), default_queue = any(), info_f = any()}}

modify_counter/2

modify_counter(Name, Opts) -> any()

modify_group_rate/2

modify_group_rate(Name, Opts) -> any()

modify_queue/2

modify_queue(Name::queue_name(), Options::q_opts()) -> ok | {error, any()}

modify_regulator/4

modify_regulator(Type, QName, RegName, Opts) -> any()

queue_info/1

queue_info(Name) -> any()

queue_info/2

queue_info(Name, Item) -> any()

run/1

run(Fun::fun(() -> X)) -> X

run/2

run(Type::job_class(), Fun::fun(() -> X)) -> X

set_modifiers/1

set_modifiers(Modifiers) -> any()

start_link/0

start_link() -> {ok, pid()}

start_link/1

start_link(Opts0::ctx_options()) -> {ok, pid()}

terminate/2

terminate(X1, X2) -> any()

timestamp/0

timestamp() -> any()

timestamp_to_datetime/1

timestamp_to_datetime(TS) -> any()


Generated by EDoc