Documentation ¶
Index ¶
- Constants
- Variables
- type Defer
- type ErrorHandler
- type FasthttpHost
- type FasthttpHostModule
- type FasthttpHostRegistrar
- func (r *FasthttpHostRegistrar) AddRoute(method string, path string, handler RequestHandler, handlerComponentID string)
- func (r *FasthttpHostRegistrar) EnableTracer(enabled bool)
- func (r *FasthttpHostRegistrar) RegisterRequestHandleModule(module RequestHandleModule)
- func (r *FasthttpHostRegistrar) RegisterRouteResolveModule(module RouteResolveModule)
- func (r *FasthttpHostRegistrar) SetErrorHandler(handler ErrorHandler)
- func (r *FasthttpHostRegistrar) SetRequestManager(requestManager interface{})
- func (r *FasthttpHostRegistrar) SetRewriteHandler(handler RewriteHandler)
- func (r *FasthttpHostRegistrar) SetUnhandledRequestHandler(handler RequestHandler)
- type Finalizer
- type OnHostErrorHandler
- type Recover
- type RequestCtx
- type RequestHandleModule
- type RequestHandleService
- type RequestHandler
- type RequestState
- type RequestTracerService
- type RequestWorker
- type RewriteHandler
- type RouteComponent
- type RoutePath
- type RouteResolveModule
- type RouteResolveService
- type RouteResolver
- type Router
- func (r Router) Add(method string, path string, handler RequestHandler, handlerComponentID string)
- func (r Router) FindHandlerComponentID(method string, path string) string
- func (r Router) Get(method string, path string) RequestHandler
- func (r Router) Has(path RoutePath) bool
- func (r Router) Remove(method string, path string)
- type Server
- type StdRequestHandleModule
- func (*StdRequestHandleModule) CanSetSuccessor() bool
- func (*StdRequestHandleModule) OnInitComplete()
- func (*StdRequestHandleModule) OnStart(ctx context.Context) error
- func (*StdRequestHandleModule) OnStop(ctx context.Context) error
- func (m *StdRequestHandleModule) ProcessRequest(ctx *RequestCtx, state RequestState, recover *Recover)
- func (*StdRequestHandleModule) SetSuccessor(successor RequestHandleModule)
- type StdRouteResolveModule
- type StopError
- type TracerManager
Constants ¶
View Source
const ( DEFAULT_HTTP_PORT = "80" HEADER_XHTTP_METHOD = "X-Http-Method" StatusNotFound = 404 LOGGER_PREFIX = "[host-fasthttp] " )
Variables ¶
View Source
var ( GlobalTracerManager *TracerManager = NewTraceManager() // be register from FasthttpHost FasthttpHostModuleInstance = FasthttpHostModule{} FasthttpHostLogger *log.Logger = log.New(os.Stdout, LOGGER_PREFIX, log.LstdFlags|log.Lmsgprefix) )
View Source
var (
RouteResolveModuleInstance = new(StdRouteResolveModule)
)
Functions ¶
This section is empty.
Types ¶
type FasthttpHost ¶
type FasthttpHost struct { Server *Server Listener net.Listener ListenAddress string EnableCompress bool Version string // contains filtered or unexported fields }
func (*FasthttpHost) Logger ¶
func (h *FasthttpHost) Logger() *log.Logger
func (*FasthttpHost) Start ¶
func (h *FasthttpHost) Start(ctx context.Context)
type FasthttpHostModule ¶
type FasthttpHostModule struct{}
func (FasthttpHostModule) ConfigureLogger ¶
func (FasthttpHostModule) ConfigureLogger(logflags int, w io.Writer)
ConfigureLogger implements host.HostService
func (FasthttpHostModule) DescribeHostType ¶
func (FasthttpHostModule) DescribeHostType() reflect.Type
DescribeHostType implements host.HostService
func (FasthttpHostModule) Init ¶
func (FasthttpHostModule) Init(h host.Host, app *host.AppModule)
Init implements host.HostService
func (FasthttpHostModule) InitComplete ¶
func (FasthttpHostModule) InitComplete(h host.Host, app *host.AppModule)
InitComplete implements host.HostService
type FasthttpHostRegistrar ¶
type FasthttpHostRegistrar struct {
// contains filtered or unexported fields
}
func NewFasthttpHostRegistrar ¶
func NewFasthttpHostRegistrar(host *FasthttpHost) *FasthttpHostRegistrar
func (*FasthttpHostRegistrar) AddRoute ¶
func (r *FasthttpHostRegistrar) AddRoute(method string, path string, handler RequestHandler, handlerComponentID string)
func (*FasthttpHostRegistrar) EnableTracer ¶
func (r *FasthttpHostRegistrar) EnableTracer(enabled bool)
func (*FasthttpHostRegistrar) RegisterRequestHandleModule ¶
func (r *FasthttpHostRegistrar) RegisterRequestHandleModule(module RequestHandleModule)
func (*FasthttpHostRegistrar) RegisterRouteResolveModule ¶
func (r *FasthttpHostRegistrar) RegisterRouteResolveModule(module RouteResolveModule)
func (*FasthttpHostRegistrar) SetErrorHandler ¶
func (r *FasthttpHostRegistrar) SetErrorHandler(handler ErrorHandler)
func (*FasthttpHostRegistrar) SetRequestManager ¶
func (r *FasthttpHostRegistrar) SetRequestManager(requestManager interface{})
func (*FasthttpHostRegistrar) SetRewriteHandler ¶
func (r *FasthttpHostRegistrar) SetRewriteHandler(handler RewriteHandler)
func (*FasthttpHostRegistrar) SetUnhandledRequestHandler ¶
func (r *FasthttpHostRegistrar) SetUnhandledRequestHandler(handler RequestHandler)
type RequestHandleModule ¶
type RequestHandleModule interface { CanSetSuccessor() bool SetSuccessor(successor RequestHandleModule) ProcessRequest(ctx *RequestCtx, state RequestState, recover *Recover) OnInitComplete() OnStart(ctx context.Context) error OnStop(ctx context.Context) error }
interface
type RequestHandleService ¶
type RequestHandleService struct {
// contains filtered or unexported fields
}
func NewRequestHandleService ¶
func NewRequestHandleService() *RequestHandleService
func (*RequestHandleService) ProcessRequest ¶
func (s *RequestHandleService) ProcessRequest(ctx *RequestCtx, state RequestState, recover *Recover)
func (*RequestHandleService) Register ¶
func (s *RequestHandleService) Register(module RequestHandleModule)
type RequestState ¶
type RequestState struct { Tracer *trace.SeverityTracer Span *trace.SeveritySpan RoutePath *RoutePath }
type RequestTracerService ¶
type RequestTracerService struct { TracerManager *TracerManager Enabled bool // contains filtered or unexported fields }
func (*RequestTracerService) TextMapPropagator ¶
func (s *RequestTracerService) TextMapPropagator() propagation.TextMapPropagator
func (*RequestTracerService) Tracer ¶
func (s *RequestTracerService) Tracer(id string) *trace.SeverityTracer
type RequestWorker ¶
type RequestWorker struct { RequestHandleService *RequestHandleService RequestTracerService *RequestTracerService RouteResolveService *RouteResolveService Router Router OnHostErrorProc OnHostErrorHandler ErrorHandler ErrorHandler UnhandledRequestHandler RequestHandler RewriteHandler RewriteHandler }
func (*RequestWorker) ProcessRequest ¶
func (w *RequestWorker) ProcessRequest(ctx *RequestCtx)
type RewriteHandler ¶
type RewriteHandler func(ctx *RequestCtx, path *RoutePath) *RoutePath
function
type RouteComponent ¶
type RouteComponent struct { RequestHandler RequestHandler HandlerComponentID string }
type RouteResolveModule ¶
type RouteResolveModule interface { RouteResolver CanSetSuccessor() bool SetSuccessor(successor RouteResolver) }
interface
type RouteResolveService ¶
type RouteResolveService struct {
// contains filtered or unexported fields
}
func NewRouteResolveService ¶
func NewRouteResolveService() *RouteResolveService
func (*RouteResolveService) Register ¶
func (s *RouteResolveService) Register(successor RouteResolveModule)
func (*RouteResolveService) ResolveHttpMethod ¶
func (s *RouteResolveService) ResolveHttpMethod(ctx *RequestCtx) string
func (*RouteResolveService) ResolveHttpPath ¶
func (s *RouteResolveService) ResolveHttpPath(ctx *RequestCtx) string
type RouteResolver ¶
type RouteResolver interface { ResolveHttpMethod(ctx *RequestCtx) string ResolveHttpPath(ctx *RequestCtx) string }
interface
type Router ¶
type Router map[RoutePath]RouteComponent
func (Router) Add ¶
func (r Router) Add(method string, path string, handler RequestHandler, handlerComponentID string)
func (Router) FindHandlerComponentID ¶
type StdRequestHandleModule ¶
type StdRequestHandleModule struct {
// contains filtered or unexported fields
}
func NewStdRequestHandleModule ¶
func NewStdRequestHandleModule(worker *RequestWorker) *StdRequestHandleModule
func (*StdRequestHandleModule) CanSetSuccessor ¶
func (*StdRequestHandleModule) CanSetSuccessor() bool
CanSetSuccessor implements RequestHandleModule
func (*StdRequestHandleModule) OnInitComplete ¶
func (*StdRequestHandleModule) OnInitComplete()
OnInitComplete implements RequestHandleModule
func (*StdRequestHandleModule) OnStart ¶
func (*StdRequestHandleModule) OnStart(ctx context.Context) error
OnStart implements RequestHandleModule
func (*StdRequestHandleModule) OnStop ¶
func (*StdRequestHandleModule) OnStop(ctx context.Context) error
OnStop implements RequestHandleModule
func (*StdRequestHandleModule) ProcessRequest ¶
func (m *StdRequestHandleModule) ProcessRequest(ctx *RequestCtx, state RequestState, recover *Recover)
ProcessRequest implements RequestHandleModule
func (*StdRequestHandleModule) SetSuccessor ¶
func (*StdRequestHandleModule) SetSuccessor(successor RequestHandleModule)
SetSuccessor implements RequestHandleModule
type StdRouteResolveModule ¶
type StdRouteResolveModule struct{}
func (*StdRouteResolveModule) CanSetSuccessor ¶
func (r *StdRouteResolveModule) CanSetSuccessor() bool
func (*StdRouteResolveModule) ResolveHttpMethod ¶
func (r *StdRouteResolveModule) ResolveHttpMethod(ctx *RequestCtx) string
func (*StdRouteResolveModule) ResolveHttpPath ¶
func (r *StdRouteResolveModule) ResolveHttpPath(ctx *RequestCtx) string
func (*StdRouteResolveModule) SetSuccessor ¶
func (r *StdRouteResolveModule) SetSuccessor(successor RouteResolver)
type TracerManager ¶
type TracerManager struct { TracerProvider *trace.SeverityTracerProvider TextMapPropagator propagation.TextMapPropagator // contains filtered or unexported fields }
func NewTraceManager ¶
func NewTraceManager() *TracerManager
func (*TracerManager) GenerateManagedTracer ¶
func (m *TracerManager) GenerateManagedTracer(v interface{}) *trace.SeverityTracer
Source Files ¶
- def.go
- defer.go
- errors.go
- fasthttpHost.go
- fasthttpHostModule.go
- fasthttpHostRegistrar.go
- requestHandleService.go
- requestState.go
- requestTracerService.go
- requestWorker.go
- routeComponent.go
- routePath.go
- routeResolveService.go
- router.go
- stdRequestHandleModule.go
- stdRouteResolveModule.go
- tracerManager.go
- util.go
Click to show internal directories.
Click to hide internal directories.