Copyright © (C) 2017, Fred Youhanaie
Behaviours: gen_server.
Authors: Fred Youhanaie (fyrlang@anydata.co.uk).
This is the server that manages the Tuple Space.
It is a gen_server that sits between the espace clients and
the rest of the espace application.
Upon receiving the worker request, the worker supervisor will be
triggered to start a new child process to run the supplied
function.
Upon receiving the eval request, the worker supervisor will be
triggered to start a new child process to evaluate the supplied
tuple.
For the tuple space data operations, i.e. in, rd, inp, rdp
and out, the request is passed to the espace_tspace_srv
server, which in turn will process the request.
ets:match/2,3 match patterns. When match is
found the return results are in the form of {List, Tuple}, where
List is the, possibaly empty, list of the matched $N pattern
variables, and Tuple is the entire data tuple.
| espace_eval/2 |
perform an eval operation. |
| espace_in/2 |
Perform an in operation. |
| espace_inp/2 |
Perform an inp operation. |
| espace_out/2 |
Perform an out operation. |
| espace_rd/2 |
Perform a rd operation. |
| espace_rdp/2 |
Perform a rdp operation. |
| espace_worker/2 | start a worker process. |
| start_link/1 | Starts the server. |
espace_eval(Inst_name::atom(), Tuple::tuple()) -> pid()
perform an eval operation.
Tuple.
espace_in(Inst_name::atom(), Pattern::tuple()) -> {list(), tuple()}
Perform an in operation.
espace_tspace_srv to search for
Pattern, if found, the data is returned, otherwise we block until
a matching tuple is added to the tuple space via out. The matched
tuple will be removed from the tuple space.
espace_inp(Inst_name::atom(), Pattern::tuple()) -> nomatch | {list(), tuple()}
Perform an inp operation.
in but does not block if no match found. In case of no
match, the nomatch atom is returned.
espace_out(Inst_name::atom(), Tuple::tuple()) -> done
Perform an out operation.
Sends supplied Tuple to espace_tspace_srv to be stored in the
ETS table.
espace_tspace_srv will in turn trigger espace_tspatt_srv to
inform any in/rd clients that may be blocking on such
tuple. The blocking mechanisim is implemented internally in this
module, see espace_op/3.
espace_rd(Inst_name::atom(), Pattern::tuple()) -> {list(), tuple()}
Perform a rd operation.
in, except that the matched tuple remains in the tuple
space.
espace_rdp(Inst_name::atom(), Pattern::tuple()) -> nomatch | {list(), tuple()}
Perform a rdp operation.
inp, but does not remove the matched tuple.
espace_worker(Inst_name::atom(), MFA::tuple()) -> pid()
start a worker process.
A request is sent to the worker supervisor to start a new child process based on theMFA parameter. MFA can be one of {Mod,
Func, Args} triple, or an anonymous function/args pair {Func,
Args}, where Func can be a fun expression or string
represtation of a fun expression. The string version can be used
when reading espace terms from a file.
start_link(Inst_name::atom()) -> ignore | {error, {already_started, pid()} | term()} | {ok, pid()}
Starts the server
Generated by EDoc