[erlang-questions] Storing tuples directly in Mnesia without records

Ulf Wiger <>
Sun Sep 30 09:12:39 CEST 2007


Yes, you can use tuples directly. Unlike ets, mnesia requires
the key to be the second element in the tuple, and the first
element needs to be a label (record_name).

Mnesia will check that the inserted data is a tuple of the
right arity, and that the first element of the tuple is equal
to the 'record_name' of the table (this defaults to the table
name, but can be changed with the {record_name, N} option.

Remember, records are only syntactic sugar for tagged tuples.

BR,
Ulf W

2007/9/30, shahzad bhatti <>:
> I am trying to build a Linda like tuple space in Erlang and though my simple
> application is using ets for now, but I would like to use Mnesia to store
> tuples directly to take leverage of its replication and transactions
> capabilities. Since, Mnesia supports multiple tables that map to records, is
> it possible to use tuples directly. Also, if anyone can suggest anything
> that will make it easier to implement tuplespace with blocking get/read
> operations. Thanks in advance.
>
>
>
>  ________________________________
> Pinpoint customers who are looking for what you sell.
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list