Created
May 24, 2012 23:00
-
-
Save arobson/2784769 to your computer and use it in GitHub Desktop.
Fun with applied FP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Subscribers subscribe to topics. | |
A topic is expressed as a period delimited namespace: "a.b.c.d" | |
A topic subscription may be an exact match or use wild card characters: | |
* - match 1 namespace segment at a specific location | |
# - match any number of namespace segments | |
When a message comes in, it will always have a fully specified topic. | |
The list of subscriptions with topics that would match the message's topic is the desired outcome. | |
Assume that given the entire set of all possible topics that would match the message's topic, | |
there exists an engine that can very quickly assess which subscription topics exist in the set. | |
Can you provide an efficient solution to find the entire set of possible topic matches given | |
a message topic? | |
Examples: | |
Message topic: 'a.b' | |
Full set: | |
'a.b' | |
'a.*' | |
'a.#' | |
'*.b' | |
'#.b' | |
'*.*' | |
'#' | |
Message topic: 'a.b.c' | |
Full set: | |
'a.b.c' | |
'a.b.*' | |
'a.b.#' | |
'a.*.*' | |
'a.*.#' | |
'a.#.*' | |
'a.#' | |
'*.b.c' | |
'#.b.c' | |
'*.b.*' | |
'*.b.#' | |
'#.b.*' | |
'#.b.#' | |
'*.*.c' | |
'#.c' | |
'#' | |
'*.*.*' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment