Copyright © 2009-2010 Marc Worrell Date: 2009-06-03
Behaviours: gen_server.
Authors: Marc Worrell (marc@worrell.nl).
activate/2 | Activate a module. |
active/1 | Return the list of active modules. |
active/2 | Return whether a specific module is active. |
active_dir/1 | Return the list of all active modules and their directories. |
all/1 | Return the list of all modules in the database. |
code_change/3 | Convert process state when code is changed. |
deactivate/2 | Deactivate a module. |
get_modules/1 | Return the list of all modules running. |
get_modules_status/1 | Return the status of all running modules. |
handle_call/3 | Return a list of all enabled modules managed by the z_supervisor. |
handle_cast/2 | Sync enabled modules with loaded modules. |
handle_info/2 | Handling all non call/cast messages. |
init/1 | Initiates the server. |
module_exists/1 | Check if the code of a module exists. |
prio/1 | Return the priority of a module. |
prio_sort/1 | Sort the results of a scan on module priority first, module name next. |
scan/1 | Scan for a list of modules present in the site's module directories. |
start_link/1 | Starts the module manager. |
terminate/2 | This function is called by a gen_server when it is about to terminate. |
title/1 | Get the title of a module. |
upgrade/1 | Reload the list of all modules, add processes if necessary. |
activate(Module, Context::#context{}) -> void()
Activate a module. The module is marked as active and started as a child of the module z_supervisor. The module manager can be checked later to see if the module started or not.
active(Context::#context{}) -> [atom()]
Return the list of active modules.
active(Module::atom(), Context::#context{}) -> [atom()]
Return whether a specific module is active.
active_dir(Context::#context{}) -> [{atom, Dir}]
Return the list of all active modules and their directories
all(Context::#context{}) -> [atom()]
Return the list of all modules in the database.
code_change(OldVsn, State, Extra) -> {ok, NewState}
Convert process state when code is changed
deactivate(Module, Context::#context{}) -> ok
Deactivate a module. The module is marked as deactivated and stopped when it was running.
get_modules(Context) -> any()
Return the list of all modules running.
get_modules_status(Context) -> any()
Return the status of all running modules.
handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}
Return a list of all enabled modules managed by the z_supervisor
handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}
Sync enabled modules with loaded modules
handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}
Handling all non call/cast messages
init(Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}
Initiates the server.
module_exists(M) -> any()
Check if the code of a module exists. The database can hold module references to non-existing modules.
prio(Module) -> integer()
Return the priority of a module. Default priority is 500, lower is higher priority. Never crash on a missing module.
prio_sort(ModuleProps::proplist()) -> proplist()
Sort the results of a scan on module priority first, module name next. The list is made up of {module, Values} tuples
scan(Context::#context{}) -> [{atom(), dirname()}]
Scan for a list of modules present in the site's module directories. A module is always a directory, the name of the directory is the same as the name of the module.
start_link(SiteProps::proplist()) -> {ok, Pid} | ignore | {error, Error}
Starts the module manager
terminate(Reason, State) -> void()
This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.
title(M) -> any()
Get the title of a module.
upgrade(Context::#context{}) -> ok
Reload the list of all modules, add processes if necessary.
Generated by EDoc, Feb 25 2011, 21:14:41.