z_module_indexer (zotonic_core v1.0.0-rc.17)
Implements the module extension mechanisms for scomps, templates, actions etc. Scans all active modules for scomps (etc) and maintains lookup lists for when the system tries to find a scomp (etc).
Summary
Functions
Return a list of all templates, scomps etc per module
Return all indexed files in a module (erlang app). The module does not have to be enabled but must be compiled.
Convert process state when code is changed
Find all dispatch files in all modules and the active site.
Find a scomp, validator etc.
Find a scomp, validator etc.
Scan for all scomps etc. for the context given.
Handling all non call/cast messages
Initiates the server.
Reindex all sites
Reindex the list of all scomps, etc for the site in the context.
Starts the server
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.
Find all .po files in all modules and the active site. This is an active scan, not designed to be fast.
Types
Functions
-spec all(Type, Context) -> ModuleIndexList when Type :: key_type(), Context :: z:context(), ModuleIndexList :: [#module_index{key :: #module_index_key{site :: atom(), type :: z_module_indexer:key_type() | undefined, name :: atom() | binary() | {binary(), binary()}}, filepath :: file:filename_all() | undefined, module :: atom() | undefined, erlang_module :: atom() | undefined, tag :: integer() | undefined}].
Return a list of all templates, scomps etc per module
-spec all_files(Type, Module) -> ModuleIndexList when Type :: key_type(), Module :: module(), ModuleIndexList :: [#module_index{key :: #module_index_key{site :: atom(), type :: z_module_indexer:key_type() | undefined, name :: atom() | binary() | {binary(), binary()}}, filepath :: file:filename_all() | undefined, module :: atom() | undefined, erlang_module :: atom() | undefined, tag :: integer() | undefined}].
Return all indexed files in a module (erlang app). The module does not have to be enabled but must be compiled.
Convert process state when code is changed
-spec dispatch(z:context()) -> [{module(), [file:filename_all()]}].
Find all dispatch files in all modules and the active site.
-spec find(key_type(), binary() | atom(), z:context()) -> {ok, #module_index{key :: #module_index_key{site :: atom(), type :: z_module_indexer:key_type() | undefined, name :: atom() | binary() | {binary(), binary()}}, filepath :: file:filename_all() | undefined, module :: atom() | undefined, erlang_module :: atom() | undefined, tag :: integer() | undefined}} | {error, term()}.
Find a scomp, validator etc.
-spec find_all(key_type(), string() | binary() | atom(), z:context()) -> [#module_index{key :: #module_index_key{site :: atom(), type :: z_module_indexer:key_type() | undefined, name :: atom() | binary() | {binary(), binary()}}, filepath :: file:filename_all() | undefined, module :: atom() | undefined, erlang_module :: atom() | undefined, tag :: integer() | undefined}].
Find a scomp, validator etc.
Scan for all scomps etc. for the context given.
Handling all non call/cast messages
Initiates the server.
-spec reindex() -> ok.
Reindex all sites
-spec reindex(z:context()) -> ok.
Reindex the list of all scomps, etc for the site in the context.
Starts the server
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.
-spec translations(z:context()) -> [{Module :: atom(), [{Language :: atom(), file:filename_all()}]}].
Find all .po files in all modules and the active site. This is an active scan, not designed to be fast.