Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a way to allow multiple clients to iterate through results of a single query #217

Open
andre-senna opened this issue Jan 28, 2025 · 0 comments
Assignees
Milestone

Comments

@andre-senna
Copy link
Contributor

High level algorithm:

  1. The caller submits a pattern matching query but, instead of receiving an iterator to iterate through the results, the caller receives a UNIQUE KEY for that query.
  2. At this point, the Query Agent begins execution of the query but NO RESULTS are forwarded to the caller yet.
  3. At some point, the same caller that submitted the query or any other caller that happens to know the query UNIQUE KEY, submit a request for answers, thus receiving an iterator which will iterate through results of the query.
  4. After all results have been forwarded to callers (only callers "registered" in step 3, which may or may not include the original caller from step 1.) the query ends and all callers with iterators are notified.

Important notes:

  • Each QueryAnswer must be forwarded to exactly ONE recipient. It means that QueryAnswer recipients receive DIFFERENT QueryAnswers. No overlapping.
  • QueryAnswers have importance values. In regular queries, the caller iterates trough them according to this importance value (most important first). The same criteria need to be followed here. So, for instance, if the query issued a list of QueryAnswers [q1, q2, q3, q4, ..., qn] and there are 3 "registered" callers to iterate (lets call them c1, c2 and c3), QueryAnswer objects must be delivered as follows:
    • c1: q1, q4, q7, ...
    • c2: q2, q5, q8, ...
    • c3: q3, q6, q9, ...
  • Different recipients may receive different number of QueryAnswers
  • The Query Agent may receive a new request for iteration in a query already being processed (as in step 3. above). In this case the new recipient should be accommodated dynamically in the list of recipients for that query and start receiving new QueryAnswers accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants