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

grpc: Add StaticMethod CallOption #6926

Merged
merged 5 commits into from Feb 15, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions rpc_util.go
Expand Up @@ -189,6 +189,20 @@
func (EmptyCallOption) before(*callInfo) error { return nil }
func (EmptyCallOption) after(*callInfo, *csAttempt) {}

// RegisteredMethod returns a CallOption which specifies that a call comes from
// a registered method. This does nothing functionally, but serves as a signal
// to other code.
func RegisteredMethod() CallOption {
Copy link
Member

Choose a reason for hiding this comment

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

StaticMethod, as discussed offline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

return RegisteredMethodCallOption{}

Check warning on line 196 in rpc_util.go

View check run for this annotation

Codecov / codecov/patch

rpc_util.go#L195-L196

Added lines #L195 - L196 were not covered by tests
}

// RegisteredMethodCallOption is a CallOption that specifies that a call comes
// from a registered method.
type RegisteredMethodCallOption struct{}
dfawley marked this conversation as resolved.
Show resolved Hide resolved

func (RegisteredMethodCallOption) before(*callInfo) error { return nil }
func (RegisteredMethodCallOption) after(*callInfo, *csAttempt) {}

Check warning on line 204 in rpc_util.go

View check run for this annotation

Codecov / codecov/patch

rpc_util.go#L203-L204

Added lines #L203 - L204 were not covered by tests

// Header returns a CallOptions that retrieves the header metadata
// for a unary RPC.
func Header(md *metadata.MD) CallOption {
Expand Down Expand Up @@ -958,6 +972,7 @@
SupportPackageIsVersion5 = true
SupportPackageIsVersion6 = true
SupportPackageIsVersion7 = true
SupportPackageIsVersion8 = true
)

const grpcUA = "grpc-go/" + Version