httpjson

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2019 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaulPostResponseFn

func DefaulPostResponseFn(ctx context.Context, method string, response apachethrift.TStruct)

DefaulPostResponseFn will close M3DB contexts per request

func RegisterHandlers

func RegisterHandlers(mux *http.ServeMux, service interface{}, opts ServerOptions) error

RegisterHandlers will register handlers on the HTTP serve mux for a given service and options

Types

type ContextFn

type ContextFn func(ctx context.Context, method string, headers map[string]string) thrift.Context

ContextFn is a function that sets the context for all service methods derived from the incoming request context

func NewDefaultContextFn

func NewDefaultContextFn(contextPool m3dbcontext.Pool) ContextFn

NewDefaultContextFn returns a function that will create M3DB contexts per request

type PostResponseFn

type PostResponseFn func(ctx context.Context, method string, response apachethrift.TStruct)

PostResponseFn is a function that is called at the end of a request

type ServerOptions

type ServerOptions interface {
	// SetReadTimeout sets the read timeout and returns a new ServerOptions
	SetReadTimeout(value time.Duration) ServerOptions

	// ReadTimeout returns the read timeout
	ReadTimeout() time.Duration

	// SetWriteTimeout sets the write timeout and returns a new ServerOptions
	SetWriteTimeout(value time.Duration) ServerOptions

	// WriteTimeout returns the write timeout
	WriteTimeout() time.Duration

	// SetRequestTimeout sets the request timeout and returns a new ServerOptions
	SetRequestTimeout(value time.Duration) ServerOptions

	// RequestTimeout returns the request timeout
	RequestTimeout() time.Duration

	// SetContextFn sets the context fn and returns a new ServerOptions
	SetContextFn(value ContextFn) ServerOptions

	// ContextFn returns the context fn
	ContextFn() ContextFn

	// SetPostResponseFn sets the post response fn and returns a new ServerOptions
	SetPostResponseFn(value PostResponseFn) ServerOptions

	// PostResponseFn returns the post response fn
	PostResponseFn() PostResponseFn
}

ServerOptions is a set of server options

func NewServerOptions

func NewServerOptions() ServerOptions

NewServerOptions creates a new set of server options with defaults

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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