request

package
v1.0.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(ctx context.Context, req *transport.Request) (*transport.Request, error)

Validate is a shortcut for the case where a request needs to be validated without changing the TTL. This should be used to validate all request types

func ValidateOneway added in v0.4.0

func ValidateOneway(ctx context.Context, req *transport.Request) (*transport.Request, error)

ValidateOneway validates a oneway request. This should be used after a successful Validate()

func ValidateUnary added in v0.4.0

func ValidateUnary(ctx context.Context, req *transport.Request) (*transport.Request, error)

ValidateUnary validates a unary request. This should be used after a successful Validate()

Types

type OnewayValidatorOutbound added in v0.4.0

type OnewayValidatorOutbound struct{ transport.OnewayOutbound }

OnewayValidatorOutbound wraps an Outbound to validate all outgoing oneway requests.

func (OnewayValidatorOutbound) CallOneway added in v0.4.0

func (o OnewayValidatorOutbound) CallOneway(ctx context.Context, request *transport.Request) (transport.Ack, error)

CallOneway performs the given request, failing early if the request is invalid.

type UnaryValidatorOutbound added in v0.4.0

type UnaryValidatorOutbound struct{ transport.UnaryOutbound }

UnaryValidatorOutbound wraps an Outbound to validate all outgoing unary requests.

func (UnaryValidatorOutbound) Call added in v0.4.0

Call performs the given request, failing early if the request is invalid.

type Validator

type Validator struct {
	Request *transport.Request
	// contains filtered or unexported fields
}

Validator helps validate requests.

v := Validator{Request: request}
v.Validate()
...
v.ParseTTL(ttlstring)
request, err := v.ValidateUnary()

func (*Validator) ParseTTL

func (v *Validator) ParseTTL(ctx context.Context, ttl string) (context.Context, func())

ParseTTL takes a context parses the given TTL, clamping the context to that TTL and as a side-effect, tracking any errors encountered while attempting to parse and validate that TTL. Should only be used for unary requests

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context) (*transport.Request, error)

Validate checks that the request inside this validator is valid and returns either the validated request or an error. This should be used to check all requests, prior to the RPC type specifc validation.

func (*Validator) ValidateOneway added in v0.4.0

func (v *Validator) ValidateOneway(ctx context.Context) (*transport.Request, error)

ValidateOneway validates a oneway request. This should be used after a successful Validate()

func (*Validator) ValidateUnary added in v0.4.0

func (v *Validator) ValidateUnary(ctx context.Context) (*transport.Request, error)

ValidateUnary validates a unary request. This should be used after a successful v.Validate()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL