From 999f1b99b295a69d3c505b601f14554acf4522d3 Mon Sep 17 00:00:00 2001 From: Bernard Duggan Date: Fri, 12 Feb 2010 11:07:37 +1100 Subject: Add mnesia activity subscription message A process that calls mnesia:subscribe(activity) will receive the message: {mnesia_activity_event, ActivityID, complete} when any activity that caused a change to a database has finished committing its changes. This allows a subscriber to collect messages already available through the mnesia:subscribe({table, ...}) system to group them as completed transactions. --- lib/mnesia/doc/src/Mnesia_chap5.xmlsrc | 36 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'lib/mnesia/doc/src/Mnesia_chap5.xmlsrc') diff --git a/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc b/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc index 3ec0aa37f5..1c7e3662e1 100644 --- a/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc +++ b/lib/mnesia/doc/src/Mnesia_chap5.xmlsrc @@ -4,7 +4,7 @@
- 19972009 + 19972010 Ericsson AB. All Rights Reserved. @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + Miscellaneous Mnesia Features @@ -885,16 +885,16 @@ ok Removes the subscription on events of type Event-Category -

Event-Category may either be the atom system, or +

Event-Category may either be the atom system, the atom activity, or one of the tuples {table, Tab, simple}, {table, Tab, detailed}. The old event-category {table, Tab} is the same event-category as {table, Tab, simple}. The subscribe functions activate a subscription of events. The events are delivered as messages to the process evaluating the mnesia:subscribe/1 function. The syntax of - system events is {mnesia_system_event, Event} and - {mnesia_table_event, Event} for table events. What system - events and table events means is described below. -

+ system events is {mnesia_system_event, Event}, + {mnesia_activity_event, Event} for activity events, and + {mnesia_table_event, Event} for table events. What the various + event types mean is described below.

All system events are subscribed by Mnesia's gen_event handler. The default gen_event handler is mnesia_event. But it may be changed by using the application @@ -1038,9 +1038,27 @@ ok +

+ Activity Events +

Currently, there is only one type of activity event:

+ + {complete, ActivityID} + +

This event occurs when a transaction that caused a modification to the database + has completed. It is useful for determining when a set of table events + (see below) caused by a given activity have all been sent. Once the this event + has been received, it is guaranteed that no further table events with the same + ActivityID will be received. Note that this event may still be received even + if no table events with a corresponding ActivityID were received, depending on + the tables to which the receiving process is subscribed.

+

Dirty operations always only contain one update and thus no activity event is sent.

+
+
+
+
Table Events -

Another category of events are table events, which are +

The final category of events are table events, which are events related to table updates. There are two types of table events simple and detailed.

-- cgit v1.2.3