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

Add support for secondary dispatching on LR2 #2069

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

josephschorr
Copy link
Member

No description provided.

@josephschorr josephschorr requested a review from a team as a code owner September 18, 2024 19:01
@github-actions github-actions bot added area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) area/dispatch Affects dispatching of requests labels Sep 18, 2024
@josephschorr josephschorr force-pushed the lr-secondary-dispatch branch 3 times, most recently from 564b30d to 27a1453 Compare September 18, 2024 19:23

const secondaryCursorPrefix = "$$secondary:"

func publishClient[Q requestMessageWithCursor, R responseMessageWithCursor](ctx context.Context, client receiver[R], stream dispatch.Stream[R], secondaryDispatchName string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is Q used anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its used for the type of the incoming message, off of which I grab the cursor. I could have the req just be that interface directly, but I always prefer well-typed wherever possible


// If no secondary dispatches are defined, just invoke directly.
if len(cr.secondaryDispatchExprs) == 0 || len(cr.secondaryDispatch) == 0 {
return publishClient[Q](withTimeout, client, stream, "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define a constant for the primary dispatcher name?

Relation: "...",
},
OptionalCursor: &v1.Cursor{
Sections: []string{secondaryCursorPrefix + "tertiary"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add one extra test case where the expression is "['secondary']" and the cursor is also for secondary?

@josephschorr josephschorr added this pull request to the merge queue Sep 18, 2024
Merged via the queue into authzed:main with commit 26a2a2d Sep 18, 2024
22 checks passed
@josephschorr josephschorr deleted the lr-secondary-dispatch branch September 18, 2024 21:31
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/dispatch Affects dispatching of requests area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants