What would be an optimal way to organize arbitrary data types into a structure that allows for complex (non-index based) lookups into the data without performing full loop-through's?
For a little background, I am not looking for an answer on how to architect an Event engine, rather I am looking for methods to improve a current implementation.
With the 5 second tour, I have a architecture in place with the following components,
- Signals - Signals what handles to execute
- Handles - Executes when a signal is received
- Queue - Manages handles
- Engine - Manages the queues and processes signals, new handles etc..
My current implementation has a few pitfalls,
- Signals are currently coupled into a Queue, this is done so the engine can identify Queues in storage and the signals they represent.
- There are two separate Queue storages, indexed and non-indexed, index exists for lookups on strings/int's, non-index exists for complex signals such as regex, array comparisons etc..
I think that I may have a solution but would like the thoughts of others that have developed similar systems.
With the new architecture I have thought of, it would consist of the following,
- Queues would store only a "data" property rather than a signal which, would be would passed to the engine for signal comparisons.
- The engine would no longer have non-index and index storage, rather a single storage would be used that would require loop through lookups.
The library is written in PHP (if that matters), if you want to see the source it's at http://www.github.com/nwhitingx/prggmr.