Skip to content

Commit

Permalink
validator: Remove ValidateOnewayContext
Browse files Browse the repository at this point in the history
This is a no-op and it's an internal API. We can add it back if necessary.
  • Loading branch information
abhinav committed Dec 16, 2016
1 parent d099a0a commit d52358e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 22 deletions.
4 changes: 1 addition & 3 deletions api/transport/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ func TestValidator(t *testing.T) {
ctx := context.Background()
err := transport.ValidateRequest(tt.req)

if err == nil && tt.transportType == transport.Oneway {
err = request.ValidateOnewayContext(ctx)
} else if err == nil { // default to unary
if err == nil && tt.transportType == transport.Unary {
var cancel func()

if tt.ttl != 0 {
Expand Down
7 changes: 0 additions & 7 deletions internal/request/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@ func ValidateUnaryContext(ctx context.Context) error {

return nil
}

// ValidateOnewayContext validates that a context for a oneway request is
// valid.
func ValidateOnewayContext(ctx context.Context) error {
// Currently, no extra checks for oneway requests are required
return nil
}
4 changes: 0 additions & 4 deletions internal/request/validator_outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,5 @@ func (o OnewayValidatorOutbound) CallOneway(ctx context.Context, request *transp
return nil, err
}

if err := ValidateOnewayContext(ctx); err != nil {
return nil, err
}

return o.OnewayOutbound.CallOneway(ctx, request)
}
3 changes: 0 additions & 3 deletions transport/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ func (h handler) callHandler(w http.ResponseWriter, req *http.Request, start tim
err = transport.DispatchUnaryHandler(ctx, spec.Unary(), start, treq, newResponseWriter(w))

case transport.Oneway:
if err := request.ValidateOnewayContext(ctx); err != nil {
return err
}
err = handleOnewayRequest(span, treq, spec.Oneway())

default:
Expand Down
5 changes: 0 additions & 5 deletions transport/x/redis/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

"go.uber.org/yarpc/api/transport"
"go.uber.org/yarpc/internal/errors"
"go.uber.org/yarpc/internal/request"
"go.uber.org/yarpc/serialize"

"github.com/opentracing/opentracing-go"
Expand Down Expand Up @@ -164,9 +163,5 @@ func (i *Inbound) handle() error {
return transport.UpdateSpanWithErr(span, err)
}

if err := request.ValidateOnewayContext(ctx); err != nil {
return transport.UpdateSpanWithErr(span, err)
}

return transport.DispatchOnewayHandler(ctx, spec.Oneway(), req)
}

0 comments on commit d52358e

Please sign in to comment.