Skip to content

Improve documentation for srv parameter in stream interceptor #8798

@casnerano

Description

@casnerano

The parameter name srv in StreamServerInterceptor is confusing because:

  • In unary interceptors, the service implementation is clearly named Server (UnaryServerInfo.Server).
  • In stream interceptors, it’s passed as srv any with no comment.
  • Because the type is any and there’s no documentation, it’s unclear whether srv is the same thing as UnaryServerInfo.Server or something different.

Is srv just a shorthand for "server", or is there a semantic difference?

To improve clarity, I suggest adding a short comment that explicitly states what srv is.

// srv is the service implementation the user provides.
type StreamServerInterceptor func(srv any, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error

Metadata

Metadata

Labels

Type: FeatureNew features or improvements in behavior

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions