framework

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultServerCloseSIG = []os.Signal{syscall.SIGINT, syscall.SIGTERM, syscall.SIGSEGV}
	DefaultHotRestartSIG  = []os.Signal{syscall.SIGUSR1}
	DefaultTriggerSIG     = []os.Signal{syscall.SIGUSR2}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ProfileProfiler *struct {
		Address      string `yaml:"address"`
		ReadTimeout  int64  `yaml:"read_timeout"`
		WriteTimeout int64  `yaml:"write_timeout"`
		IdleTimeout  int64  `yaml:"idle_timeout"`
	} `yaml:"pprof"`

	Server *struct {
		UpdateGOMAXPROCSInterval int64 `yaml:"update_gomaxprocs_interval"`
		MaxCloseWaitTime         int64 `yaml:"max_close_wait_time"`

		Services []*struct {
			Name     string `yaml:"name"`
			Address  string `yaml:"address"`
			Network  string `yaml:"network"`
			Protocol string `yaml:"protocol"`
			Timeout  int64  `yaml:"timeout"`
		} `yaml:"services"`
	} `yaml:"server"`

	Plugins plugin.Config `yaml:"plugins"`
}

type Handler

type Handler func(ctx context.Context, request string) (response string, err error)

type Option

type Option func(*Options)

func WithAddress

func WithAddress(address string) Option

func WithNetwork

func WithNetwork(network string) Option

func WithProtocol

func WithProtocol(protocol string) Option

func WithServiceName

func WithServiceName(serviceName string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

type Options

type Options struct {
	ServiceName string
	Network     string
	Address     string
	Protocol    string
	Timeout     time.Duration
}

type Server

type Server struct {
	*pprof.ProfileProfiler
	// contains filtered or unexported fields
}

func New

func New(configPath string) *Server

func (*Server) Register

func (s *Server) Register(serviceName string, rpcName string, handler Handler) error

func (*Server) Serve

func (s *Server) Serve() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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