gen_server for the tuple space ETS table.
Copyright © (C) 2018, Fred Youhanaie
Behaviours: gen_server.
Authors: Fred Youhanaie (fyrlang@anydata.co.uk).
This is the custodian gen_server for the tuple space ETS table.
The table is created as a set and in protected mode. All
access to the table is expected to come through this server,
although other proceses can inspect the contents for debugging
purposes.
Each record has the form {Ref, {Tuple}}, where Ref is a unique
key we generate before inserting the record, and Tuple is the
user supplied payload. For example if the tuple {hello, 123} is
added, then the inserted record will be
{#Ref<0.3836483324.3974365186.86196>, {hello, 123}}.
The ETS table name used will reflect the espace instance
name. This will be espace_tspace for the default/unnamed
instance, and espace_tspace_abc for an instance named abc.
etsmgr application is used to add resiliency to the server
data, should the server restart while it is holding tuple space
data.
| add_tuple/2 | Add a new tuple to the tuple space ETS table. |
| del_tuple/2 | Remove the tuple referenced by the supplied unique key. |
| get_tuple/2 | Lookup a tuple pattern in the tuple space ETS table. |
| start_link/1 | Starts the server. |
add_tuple(Inst_name::atom(), Tuple::tuple()) -> done
Add a new tuple to the tuple space ETS table.
The tuple is inserted with a unique reference() as the key.
espace_tspatt_srv
server to check for any waiting (blocking) clients whose in/rd
pattern matches the newly inserted tuple. We do not wait for any
replies from espace_tspatt_srv.
del_tuple(Inst_name::atom(), TabKey::reference()) -> done
Remove the tuple referenced by the supplied unique key.
If the record does not exist, it will be ignored.get_tuple(Inst_name::atom(), Pattern::tuple()) -> {nomatch} | {match, {reference(), list(), tuple()}}
Lookup a tuple pattern in the tuple space ETS table.
If no match is found, {nomatch} is returned.
{match, Key, List, Tuple} is returned, where
Key uniquely identifies the ETS record, List is the list of the
$N elements referenced in the pattern, if any, and Tuple is the
second part of the ETS record.
start_link(Inst_name::atom()) -> {ok, pid()} | ignore | {error, {already_started, pid()} | term()}
Starts the server.
We expect an instance name to be supplied, which will be used to uniquely identify the ETS table for the instance.Generated by EDoc