O(1) handler signal dispatch on filtered handlers
As a pktvisor user with many concurrent policies with filters which attach to the same input source, I want each event to dispatch as efficiently as possible to the correct handlers. Currently all handlers are run sequentially for each event. But for events where we may have a large number of handlers and we know only one will be run per event (based on a filter using data parsed from the event, e.g. org_id) we want to be able to dispatch to the single handler that will successfully match (O(1)), rather than run all of the attached handler filter code (in the worst case) to find the correct one (O(N)).
Notes on a possible implementation:
In this case, we should ensure that "all policy" is called first so we can cache the full data to be reused by other handlers. I think a way to achieve that is to use this https://github.com/palacaze/sigslot#enforcing-slot-invocation-order-with-slot-groups we should think in a way to user set the priority, we could do that at policy level or handler level.