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

Streaming Interceptors #3641

Merged
merged 28 commits into from
Feb 9, 2025
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9f853b8
Add read/write streaming payload/result methods to interceptor DSL
douglaswth Jan 24, 2025
e547e64
Weave streaming interceptor stuff through codegen
douglaswth Jan 24, 2025
d6d779d
Do not try to use a field from an interface for the raw payload when …
douglaswth Jan 25, 2025
fa0bdde
Fix golden files
douglaswth Jan 25, 2025
946b677
Collect attributes from a method that actually has the interceptor ap…
douglaswth Jan 28, 2025
28789b0
Fix StreamingResult accessor signature and return
douglaswth Jan 28, 2025
905c5d8
Add SendWithContext and RecvWithContext methods to the stream interfa…
douglaswth Jan 29, 2025
5905958
Progress on wrapping streams with interceptors
douglaswth Jan 30, 2025
6e8e746
Finish generating the stream wrapping for interceptors; remove the En…
douglaswth Jan 31, 2025
3826f70
Progress on adding comments and fixing tests; fix a bug where refs we…
douglaswth Jan 31, 2025
0261a0c
Finish fixing tests
douglaswth Feb 1, 2025
9c35929
Add more tests for streaming interceptor service codegen
douglaswth Feb 1, 2025
cc0e16a
Fix bug where the CLI ParseEndpoint method would try to wrap every me…
douglaswth Feb 1, 2025
79eafc5
Merge branch 'v3' into streaming-interceptors
douglaswth Feb 3, 2025
81835c3
Update InterceptorInfo comment and replace Send and Recv boolean fiel…
douglaswth Feb 3, 2025
ebd3114
Merge branch 'v3' into streaming-interceptors
douglaswth Feb 3, 2025
1e1c7ab
Update Golden files to make the Interceptor tests happy
douglaswth Feb 3, 2025
712ab19
Add a ReturnContext field to goa.InterceptorInfo to allow interceptor…
douglaswth Feb 4, 2025
3161e0b
Scrap ReturnContext field in favor of changing the interceptor interf…
douglaswth Feb 4, 2025
c236fce
Merge branch 'v3' into streaming-interceptors
douglaswth Feb 4, 2025
6a734fe
Update Golden files to make the Interceptor tests happy again
douglaswth Feb 4, 2025
c36dfb6
Change goa.InterceptorInfo to an interface that generated interceptor…
douglaswth Feb 5, 2025
8035d69
Separate StreamingPayload and StreamingResult methods to Client and S…
douglaswth Feb 5, 2025
2ba73ae
Use goa.Endpoint for next again and do not return contexts from SendW…
douglaswth Feb 6, 2025
a1f2a91
Merge branch 'v3' into streaming-interceptors
douglaswth Feb 6, 2025
edbbca8
Address lint issues
raphael Feb 8, 2025
e4eb8a1
Merge branch 'v3' into streaming-interceptors
raphael Feb 8, 2025
77667dc
Fix lint issue
raphael Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix StreamingResult accessor signature and return
douglaswth committed Jan 30, 2025
commit 28789b082b5252bb639db36ba53d0f5c8e638f2b
6 changes: 3 additions & 3 deletions codegen/service/templates/interceptors.go.tpl
Original file line number Diff line number Diff line change
@@ -58,18 +58,18 @@ func (info *{{ .Name }}Info) StreamingPayload() {{ .Name }}StreamingPayload {

{{- if .HasStreamingResultAccess }}
// StreamingResult returns a type-safe accessor for the method streaming result.
func (info *{{ .Name }}Info) StreamingResult() {{ .Name }}StreamingResult {
func (info *{{ .Name }}Info) StreamingResult(res any) {{ .Name }}StreamingResult {
{{- if gt (len .Methods) 1 }}
switch info.Method {
{{- range .Methods }}
case "{{ .MethodName }}":
return &{{ .StreamingResultAccess }}{result: info.RawResult.({{ .StreamingResultRef }})}
return &{{ .StreamingResultAccess }}{result: res.({{ .StreamingResultRef }})}
{{- end }}
default:
return nil
}
{{- else }}
return &{{ (index .Methods 0).StreamingResultAccess }}{result: info.RawResult.({{ (index .Methods 0).StreamingResultRef }})}
return &{{ (index .Methods 0).StreamingResultAccess }}{result: res.({{ (index .Methods 0).StreamingResultRef }})}
{{- end }}
}
{{- end }}
Original file line number Diff line number Diff line change
@@ -57,8 +57,8 @@ func (info *LoggingInfo) StreamingPayload() LoggingStreamingPayload {
}

// StreamingResult returns a type-safe accessor for the method streaming result.
func (info *LoggingInfo) StreamingResult() LoggingStreamingResult {
return &loggingMethodStreamingResult{result: info.RawResult.(*MethodResult)}
func (info *LoggingInfo) StreamingResult(res any) LoggingStreamingResult {
return &loggingMethodStreamingResult{result: res.(*MethodResult)}
}

// Private implementation methods