I'm almost sure that the question is not new and there might be an existing solution which solves it. Unfortunately, was unable to google it. Checking if someone here can reference it :)

Suppose we have a number of callbacks where each of them defines a match criteria (e.g. one criteria would be key1=1, another key2=2, the third one key2 in (1..3) etc).

Given an event with a set of characteristics (e.g. {key1=2, key2=2}) I want to route it to all matched callbacks. The task is to efficiently find them.

The simplest solution would be to perform linear search and check every condition but events might arrive frequently and many callbacks might be registered. So, it would be convenient to build a DFA at the beginning of work and after that use it for finding matched callbacks quickly.

So, any suggestion for a library which facilitates that?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.