Mnesia has event notifications. It is possible to have a process (gen_server) that subscribes to mnesia events. These events are classified: events in the table, system events, and others. Read the mnesia documentation for events. In fact, this is possible for the event reporting process using the mnesia event handler by calling: mnesia:report_event(Event) . The entire process subscribed to mnesia events will receive this message. Mnesia will report in real time information about all transactions in the table for signed processes. Transactions can be read, written, or deleted, and the process in its cycle may coincide with the type of event of interest. There are detailed and simple table events. I personally found the events very helpful. You should be able to get information from the documentation.
About the events. Mnesia tables now store records of the same type. You can access this information by calling mnesia:table_info(Table_name::atom(),attributes) . When applying indexes to the mnesia table, it will accept any field from these attributes if it is not the first field in the record (usually called the "primary key"). These indexes are better used when creating a table than at runtime due to a number of reasons. Consider the code snippet below
-record (employee, {id, first_name, other_name, sex, age, job}).
install (Nodes) ->
mnesia: create_schema (Nodes),
mnesia: start (),
mnesia: create_table (employee, [{index, [age, sex, first_name, job]},
{attributes, record_info (fields, employee)}]),
mnesia: stop (),
ok
if I understand your question well, now I can say that the table employee has columns: age, gender, username, other name and indexed job and all mnesia APIs to search for records based on indexed wiil work attributes, for example. mnesia:index_read/3 or mnesia:index_match_object/2 or mnesia:index_match_object/4 . good luck
/ joshmuza@gmail.com