Message Routing Paradigms

Wiger Ulf ulf.wiger@REDACTED
Sat Dec 14 21:36:45 CET 2002


On Dec 14, Eric Newhuis <enewhuis@REDACTED> wrote:

>The subscribable record sets are defined with a simple pattern matching
>language that matches variable-length lists of Erlang values or
>wildcards.  So, for example, a subscriber could choose to subscribe to
>either [a,b,c,d], ['_',b,c,d], [a,b,'_',d], or a multitude of other
>possibilities.
>
>My current thinking leads me to believe that more complex
>pattern-matching based on queries like ['$1', '<', 200] will be too slow
>to handle the expected transaction rate.  But I'd be happy to find out
>that I'm wrong.
[...]
>It would be wonderful to discover that such a thing already exists, such
>a thing as either the simple wildcard match or the more advanced pattern
>matching grammar that Erlang supports (as described in the erts module
>documentation).

Eric,

You may want to check out the ets:select() function.
It allows you to perform quite advanced pattern matching on ets tables,
using basically the same pattern matching language as for trace filters.

In OTP R9B, there is also the possibility to write match filters using more
traditional erlang syntax (it is then transformed into the match syntax
described in the erts manual.)

If ordering is important, ordered_set tables can be used. If your match
pattern avoids wild cards in the first part of the key, when matching on an
ordered_set table, the bound part of the key will be used to narrow the
search.

(I was going to provide a good example from the man page, but can't access
the documentation right now. Look at the man page for ms_transform.)

/Uffe



More information about the erlang-questions mailing list