Module riak_core_table_owner

ETS tables, when created with the ets:new/2 function, have a single owning process.

Behaviours: gen_server.

Description

ETS tables, when created with the ets:new/2 function, have a single owning process. If the owning process exits, then any ETS tables associated with that process are deleted. The purpose of the riak_core_table_owner module (which is a gen_server process) is to serve as the owning process for ETS tables that do not otherwise have an obvious owning process. For example, the riak_core_throttle module uses an ETS table for maintaining its state, but it is not itself a process and therefore the owning process for it ETS table is not clear. In this case, riak_core_table_owner can be used to create and own the ETS table on its behalf.

It is important that this process never crashes, as that would lead to loss of data. Therefore, a defensive approach is taken and any calls to external modules are protected with the try/catch mechanism.

Note that this first iteration does not provide any API functions for reading or writing data in ETS tables and therefore is appropriate only for named public ETS tables. In order to be more broadly useful, future enhancements to this module should include API functions for efficiently reading and writing ETS data, preferably without going through a gen_server call.

Data Types

create_table_result()

create_table_result() = {ok, ets_table()} | {error, Reason::term()}

ets_options()

ets_options() = list()

ets_table()

ets_table() = ets:tab()

Function Index

code_change/3
create_table/2
handle_call/3
handle_cast/2
handle_info/2
init/1
maybe_create_table/2
start_link/0
terminate/2

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> any()

create_table/2

create_table(Name::atom(), Options::ets_options()) -> create_table_result()

handle_call/3

handle_call(X1, From, State) -> any()

handle_cast/2

handle_cast(Msg, State) -> any()

handle_info/2

handle_info(Info, State) -> any()

init/1

init(State) -> any()

maybe_create_table/2

maybe_create_table(Name::atom(), Options::ets_options()) -> create_table_result()

start_link/0

start_link() -> {ok, pid()} | ignore | {error, Reason::term()}

terminate/2

terminate(Reason, State) -> any()


Generated by EDoc