Module espace_tspool_srv

This is the server that manages the Tuple Space.

Copyright © (C) 2017, Fred Youhanaie

Behaviours: gen_server.

Authors: Fred Youhanaie (fyrlang@anydata.co.uk).

Description

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.

The patterns supplied with the input operators should be compatible with 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.

Function Index

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.

Function Details

espace_eval/2

espace_eval(Inst_name::atom(), Tuple::tuple()) -> pid()

perform an eval operation.

A request is sent to the worker supervisor to start a new child process, which will evaluate the elements of the supplied Tuple.

espace_in/2

espace_in(Inst_name::atom(), Pattern::tuple()) -> {list(), tuple()}

Perform an in operation.

The request is passed to 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/2

espace_inp(Inst_name::atom(), Pattern::tuple()) -> nomatch | {list(), tuple()}

Perform an inp operation.

Similar to in but does not block if no match found. In case of no match, the nomatch atom is returned.

espace_out/2

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/2

espace_rd(Inst_name::atom(), Pattern::tuple()) -> {list(), tuple()}

Perform a rd operation.

Similar to in, except that the matched tuple remains in the tuple space.

espace_rdp/2

espace_rdp(Inst_name::atom(), Pattern::tuple()) -> nomatch | {list(), tuple()}

Perform a rdp operation.

Similar to inp, but does not remove the matched tuple.

espace_worker/2

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 the MFA 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/1

start_link(Inst_name::atom()) -> ignore | {error, {already_started, pid()} | term()} | {ok, pid()}

Starts the server


Generated by EDoc