On 6/11/2014 1:23 PM, Jiri Cincura wrote: > Hi *, > > is there some description how events work? From protocol POV. I'm > hunting some race condition in .NET driver and cannot understand > what's happening there. Sadly the code I'm looking at is like 7 years > old and nobody touched it since. > The basic mechanism is this: Events have names and an associated event count. When an event is posted, it is staged as part of the transaction object. If and when the transaction commits, the associated event count is bumped (this makes events transactional). Event notification is asynchronous: An application provides the address and length of an event buffer containing the event names, event threshold count for the events for which it wants notification as well as a second buffer for receive updated counts, the address of a notification function, and an argument to pass to that function. When any named event reaches the given threshold, the event manager calls the designated function after setting the second buffer to reflect the event names from the original event buffer and the current event counts plus one. This allows the notification function to both determine which events were fired and to use the updated buffer for the next notification request.
If one or more of the event counts are zero, the call returns immediately, which is useful for initialization. As an optimization, the event manager tracks the event names for which somebody has requested notification. An event post with no listeners is dropped on the floor. There is also a synchronous version of the notification request, thinly layered on the asynchronous version. The event count mechanism makes the system reliable -- if an event is posted between the time notification is delivered and a subsequent registration call, the subsequent call will return immediately with an updated buffer. No data other than updates event counts are passed with notification. It is expected that the application will query the database to see what actually happened. The system is intended to support both fine, coarse, and mixed event granularity. I used a completely different event mechanism in NuoDB in which event classes are declared via DDL command identifying event names and the names of fields whose contents are to be delivered as part of event notification. It's a different use case, of course, but works quite nicely. The event mechanism was patented, but, happily, the patent as expired. ------------------------------------------------------------------------------ HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing & Easy Data Exploration http://p.sf.net/sfu/hpccsystems Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel