Copyright © (C) 2019, Fred Youhanaie
Authors: Fred Youhanaie (fyrlang@anydata.co.uk).
eval_out/1 | Conditionally evaluate a tuple and out the result to the
unnamed instance. |
eval_out/2 | Conditionally evaluate a tuple and out the result to a named
instance. |
inst_to_name/2 | Convert an instance name to longer prefixed name. |
wait4etsmgr/4 | wait for etsmgr to (re)start, then ask it to manage our table. |
eval_out(Tuple_in::tuple()) -> done
Conditionally evaluate a tuple and out
the result to the
unnamed instance.
eval_out/2
for details.
eval_out(Inst_name::atom(), Tuple_in::tuple()) -> done
Conditionally evaluate a tuple and out
the result to a named
instance.
The elements of the output tuple correspond to those of
Tuple_in
. If any of the elements of Tuple_in
are recognized as
function, then the corresponding output element will be the value
of the function.
Two types of patterns are recognized as functions and are
evaluated. A normal function expression of arity zero, fun () ->
expr end
. And, a tuple with two elements, a function expresion of
arity N
and a list of length N
, N
can be zero.
inst_to_name(Prefix::atom(), Inst_name::atom()) -> atom()
Convert an instance name to longer prefixed name.
This is used for obtaining the instance specific server/table
names. For example inst_to_name(espace_sup, aaa)
will return
espace_sup_aaa
.
espace
, then the prefix is returned
without an instance name suffix. For example
inst_to_name(espace_sup, espace)
will return espace_sup
.
wait4etsmgr(Inst_name::atom(), X2::init | recover, Table_name::atom(), Table_opts::term()) -> {ok, pid(), ets:tab()} | {error, term()}
wait for etsmgr to (re)start, then ask it to manage our table.
There are two occassions where this function is called:
init
- start/restart of our gen_server that owns a table, in
this case we do not have, or know of, the ETS table. So we ask
etsmgr
to create a new table using etsmgr:new_table/4
. If
etsmgr
is already managing such a table that does not already
belong to another process, then that table will be given to
us.recover
- recovery of the etsmgr
server, in this case we
ask etsmgr
to start managing our ETS table.Generated by EDoc