xhttp

package
v1.0.1-0...-e52dcc8 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	//服务名称
	Name          string `properties:"brian.http.server.name"`
	Host          string `properties:"brian.http.server.host"`
	Port          int    `properties:"brian.http.server.port"`
	Debug         bool   `properties:"brian.http.server.debug"`
	DisableMetric bool   `properties:"brian.http.server.DisableMetric"`
	DisableTrace  bool   `properties:"brian.http.server.DisableTrace"`

	Weight                    float64 `properties:"brian.http.server.registry.weight"`
	SlowQueryThresholdInMilli int64   `properties:"brian.http.server.timeout"`
	// contains filtered or unexported fields
}

HTTP config

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

func RawConfig

func RawConfig(key string) *Config

RawConfig ...

func StdConfig

func StdConfig(name string) *Config

hugo Standard HTTP Server config

func (*Config) Address

func (config *Config) Address() string

Address ...

func (*Config) Build

func (config *Config) Build() *Server

Build create server instance, then initialize it with necessary interceptor

func (*Config) WithHost

func (config *Config) WithHost(host string) *Config

WithHost ...

func (*Config) WithLogger

func (config *Config) WithLogger(logger *logrus.Logger) *Config

修改日志配置 ...

func (*Config) WithPort

func (config *Config) WithPort(port int) *Config

WithPort ...

type Controller

type Controller interface {
	//controller的注册方法实现往服务中注册函数
	Register(server *Server)
}

服务处理的controller接口

type Server

type Server struct {
	*echo.Echo
	Config *Config
	// contains filtered or unexported fields
}

http Server struct

func (*Server) GracefulStop

func (s *Server) GracefulStop(ctx context.Context) error

GracefulStop implements server.Server interface it will stop echo server gracefully 优雅的停止服务,服务接口 将优雅的停止echo服务

func (*Server) Info

func (s *Server) Info(group, cluster string) *server.ServiceInfo

Info returns server info, used by governor and consumer balancer 初始化服务信息

func (*Server) Serve

func (s *Server) Serve() error

Server implements server.Server interface.

func (*Server) Stop

func (s *Server) Stop() error

Stop implements server.Server interface it will terminate echo server immediately 停止具体服务。服务接口 将立即停止echo服务

func (*Server) UseController

func (s *Server) UseController(con Controller)

向服务中注册控制器

Jump to

Keyboard shortcuts

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