| | 2 | |
|---|
| | 3 | ---------------------------------------------------------------------- |
|---|
| | 4 | 24May06: |
|---|
| | 5 | |
|---|
| | 6 | Implementation notes: |
|---|
| | 7 | |
|---|
| | 8 | An EventDispatcher is an event queue plus a manager for a chain |
|---|
| | 9 | of handlers, plus a method for iterating over the queue (which |
|---|
| | 10 | consumes the events by feeding them into the handler chain). |
|---|
| | 11 | |
|---|
| | 12 | How are callbacks defined in such a model? We've been assuming |
|---|
| | 13 | we need them because Twisted has them, but most of their functionality |
|---|
| | 14 | is probably present in the handler mechanism we already have. |
|---|
| | 15 | The exception: sending responses to events, but we still haven't defined |
|---|
| | 16 | any event types that need to be responded to. (That will come soon enough.) |
|---|
| | 17 | Rather than a callback, we may want to send another event that is somehow |
|---|
| | 18 | correlated with the first one. |
|---|
| | 19 | |
|---|
| | 20 | The Timeout class defines a straightforward Dispatcher, but it bothers |
|---|
| | 21 | me that it adds a custom implementation of add_handler. Did you do this |
|---|
| | 22 | only to sugar the :timer_expired event type? Or is there a more fundamental |
|---|
| | 23 | reason? |
|---|
| | 24 | |
|---|
| | 25 | Timeout adds an construct that is orthogonal to EventDispatcher in |
|---|
| | 26 | order to get the timing basis. This is the combination of register_timer, |
|---|
| | 27 | the priority queue, and the fire_timers method which has to be invoked by |
|---|
| | 28 | the reactor. Something analogous has to be defined for I/O Dispatchers. |
|---|
| | 29 | |
|---|
| | 30 | Why do you need the external PQueue implementation? For one thing, it's |
|---|
| | 31 | GPL and we need EventMachine to be either Ruby-licensed or LGPL. |
|---|
| | 32 | But what does PQueue give you that couldn't get simply by adding timers to |
|---|
| | 33 | a Ruby array and then calling sort! {|a,b| a.expiration <=> b.expiration}? |
|---|