Module z_pivot_rsc

Pivoting server for the rsc table.

Copyright 2009-2013 Marc Worrell

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

Pivoting server for the rsc table. Takes care of full text indices. Polls the pivot queue for any changed resources.

Function Index

code_change/3Convert process state when code is changed.
define_custom_pivot/3Let a module define a custom pivot columns() -> [column()] column() -> {ColumName::atom(), ColSpec::string()} | {atom(), string(), options::list()}.
delete_task/3
delete_task/4
get_pivot_data/2
get_pivot_title/1
get_pivot_title/2Fetch the first title from the record for sorting.
handle_call/3Trap unknown calls.
handle_cast/2Poll the queue for the default host.
handle_info/2Handling all non call/cast messages.
init/1Initiates the server.
insert_queue/2Insert a rsc_id in the pivot queue.
insert_task/3Insert a slow running pivot task.
insert_task/4Insert a slow running pivot task.
insert_task/5Insert a slow running pivot task with unique key and arguments.
insert_task_after/6Insert a slow running pivot task with unique key and arguments that should start after Seconds seconds.
lookup_custom_pivot/4Lookup a custom pivot; give back the Id based on a column.
pg_lang/1Translate a language to a language string as used by postgresql.
pivot/2An immediate pivot request for a resource.
pivot_resource/2Pivot a resource, collect all texts for indexing and some extra to be indexed fields.
pivot_resource_update/4Return a modified property list with fields that need immediate pivoting on an update.
poll/1Poll the pivot queue for the database in the context.
queue_all/1Rebuild the search index by queueing all resources for pivot.
start_link/1Starts the server.
terminate/2This function is called by a gen_server when it is about to terminate.

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> {ok, NewState}

Convert process state when code is changed

define_custom_pivot/3

define_custom_pivot(Module, Columns::columns(), Context) -> ok

Let a module define a custom pivot columns() -> [column()] column() -> {ColumName::atom(), ColSpec::string()} | {atom(), string(), options::list()}

delete_task/3

delete_task(Module, Function, Context) -> any()

delete_task/4

delete_task(Module, Function, UniqueKey, Context) -> any()

get_pivot_data/2

get_pivot_data(Id, Context) -> any()

get_pivot_title/1

get_pivot_title(Props) -> any()

get_pivot_title/2

get_pivot_title(Id, Context) -> any()

Fetch the first title from the record for sorting.

handle_call/3

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}

Trap unknown calls

handle_cast/2

handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Poll the queue for the default host

handle_info/2

handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Handling all non call/cast messages

init/1

init(SiteProps::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}

Initiates the server.

insert_queue/2

insert_queue(Id, Context) -> any()

Insert a rsc_id in the pivot queue

insert_task/3

insert_task(Module, Function, Context) -> any()

Insert a slow running pivot task. For example syncing category numbers after an category update.

insert_task/4

insert_task(Module, Function, UniqueKey, Context) -> any()

Insert a slow running pivot task. Use the UniqueKey to prevent double queued tasks.

insert_task/5

insert_task(Module, Function, UniqueKey, Args, Context) -> any()

Insert a slow running pivot task with unique key and arguments.

insert_task_after/6

insert_task_after(SecondsOrDate, Module, Function, UniqueKey, Args, Context) -> any()

Insert a slow running pivot task with unique key and arguments that should start after Seconds seconds.

lookup_custom_pivot/4

lookup_custom_pivot(Module, Column, Value, Context) -> Id | undefined

Lookup a custom pivot; give back the Id based on a column. Will always return the first Id found.

pg_lang/1

pg_lang(X1) -> any()

Translate a language to a language string as used by postgresql. This language list is the intersection of the default catalogs of postgres with the languages supported by mod_translation.

pivot/2

pivot(Id, Context) -> void()

An immediate pivot request for a resource

pivot_resource/2

pivot_resource(Id, Context) -> void()

Pivot a resource, collect all texts for indexing and some extra to be indexed fields.

pivot_resource_update/4

pivot_resource_update(Id, UpdateProps, RawProps, Context) -> any()

Return a modified property list with fields that need immediate pivoting on an update.

poll/1

poll(Context) -> void()

Poll the pivot queue for the database in the context

queue_all/1

queue_all(Context) -> any()

Rebuild the search index by queueing all resources for pivot.

start_link/1

start_link(SiteProps) -> {ok, Pid} | ignore | {error, Error}

Starts the server

terminate/2

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.


Generated by EDoc, Sep 20 2014, 15:34:49.