Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Equality clause on columns, for example: (C1 == “US”)
- Conjunctions of such clauses, example:
- (C1 == “IN”) && (C2 == “home.php”)
- (C1 == “IN”) && (C2 == “search.php”) && (C3 == “nytimes.com”)
- When the system boots, all the subscribers register their predicates to the dispatcher
- After this events start coming to the dispatcher
- For each event, the dispatcher has to emit the id of the matching subscribers.
- Class Dispatcher {
- public Dispatcher(int N /* number of columns in each event – fixed up front */);
- public void registerSubscriber( String subscriberId /* assume no conflicts */,
- String predicate /* predicate for this subscriberid */);
- public List<String> findMatchingIds(String[] event /* assume each event has N Strings */);
- }
- (N, K) -> set of subscribers who specified K in field N
- (N, "") -> set of subscribers who omitted a predicate for field N
- (N, K) -> unique token T (small integer)
- (1, "IN") -> 1
- (2, "home.php") -> 2
- (2, "search.php") -> 3
- (3, "nytimes.com") -> 4
- o --1--> o --2--> o --0--> o --0--> o
- -3--> o --4--> o --0--> o
- a)The logical model here is table with columns of strings (C1..CN), and each new row added is a new event.
- b)We could have A hash-table per column storing a tupple of (timestamp, pointer to event structure). And each event is given a unique id. With different data-structures,we can come up with different schemes.
- c) Events here are considered as infinite stream. If we have a 32-bit eventId, we have chances of integer-overflow.
- d) If we have a timer function on the server, matching and dispatching events,what is the actual resolution of the system timer? Does that have any implication?
- e) Memory allocation is a very expensive operation. If your filter-matching logic is going to do frequent allocations/ freeing, it will adversely affect performance. How can we manage the memory-pool for this particular operation? Would we different size-buckets of page-aligned memory?
Add Comment
Please, Sign In to add comment