suite

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// must be the same with the ALPN nextProto values
	HTTP1 = "http/1.1"
	HTTP2 = "h2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory added in v0.2.0

type ClientFactory interface {
	NewHostClient() (hc client.HostClient, err error)
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

func New

func New() *Config

New return an empty Config suite, use .Add() to add protocol impl

func (*Config) Add

func (c *Config) Add(protocol string, factory ServerFactory)

func (*Config) Delete

func (c *Config) Delete(protocol string)

func (*Config) Get

func (c *Config) Get(name string) ServerFactory

func (*Config) Load

func (c *Config) Load(core Core, protocol string) (server protocol.Server, err error)

func (*Config) LoadAll

func (c *Config) LoadAll(core Core) (serverMap ServerMap, err error)

type Core

type Core interface {
	// IsRunning Check whether engine is running or not
	IsRunning() bool
	// A RequestContext pool ready for protocol server impl
	GetCtxPool() *sync.Pool
	// Business logic entrance
	// After pre-read works, protocol server may call this method
	// to introduce the middlewares and handlers
	ServeHTTP(c context.Context, ctx *app.RequestContext)
	// GetTracer for tracing requirement
	GetTracer() tracer.Controller
}

Core is the core interface that promises to be provided for the protocol layer extensions

type ServerFactory

type ServerFactory interface {
	New(core Core) (server protocol.Server, err error)
}

type ServerMap

type ServerMap map[string]protocol.Server

Jump to

Keyboard shortcuts

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