server

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 31 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GracefulTimeout = time.Second * 30 //default 30s

)

Functions

func EnableInheritOldMosnconfig added in v0.20.0

func EnableInheritOldMosnconfig(enable bool)

func GetInheritConfig added in v0.20.0

func GetInheritConfig() ([]byte, error)

func GetInheritListeners

func GetInheritListeners() ([]net.Listener, []net.PacketConn, net.Conn, error)

func InitDefaultLogger

func InitDefaultLogger(config *Config)

InitDefaultLogger init default logger

func IsReconfigure added in v0.27.0

func IsReconfigure() bool

will notice the old mosn when the reconfigure.sock exists

func ListListenersFile

func ListListenersFile() []*os.File

ListListenersFile returns all server listener's fds

func Milliseconds added in v0.14.0

func Milliseconds(d time.Duration) int64

compatible with go 1.12.x

func NewHandler

func NewHandler(clusterManagerFilter types.ClusterManagerFilter, clMng types.ClusterManager) types.ConnectionHandler

NewHandler create types.ConnectionHandler's implement connHandler with cluster manager and logger

func ReconfigureHandler

func ReconfigureHandler() error

stage manager will resume the current old mosn when return error

func ReconfigureListener added in v0.27.0

func ReconfigureListener()

func ResetAdapter

func ResetAdapter()

ResetAdapter only used in test/debug mode

func SendInheritConfig added in v0.20.0

func SendInheritConfig() error

SendInheritConfig send to new mosn using uinx dowmain socket

func SetDrainTime added in v0.27.0

func SetDrainTime(time time.Duration)

func Stop

func Stop()

Stop the server

func StopConnection

func StopConnection()

StopConnection stops all connections in servers

func StopReconfigureHandler

func StopReconfigureHandler()

func WaitConnectionsDone

func WaitConnectionsDone(duration time.Duration)

WaitConnectionsDone Wait for all connections to be finished

Types

type Config

type Config struct {
	ServerName      string
	LogPath         string
	LogLevel        log.Level
	LogRoller       string
	GracefulTimeout time.Duration
	UseNetpollMode  bool
}

func NewConfig

func NewConfig(c *v2.ServerConfig) *Config

NewConfig get Config by ServerConfig

type ListenerAdapter

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

func GetListenerAdapterInstance

func GetListenerAdapterInstance() *ListenerAdapter

func (*ListenerAdapter) AddOrUpdateListener

func (adapter *ListenerAdapter) AddOrUpdateListener(serverName string, lc *v2.Listener) error

AddOrUpdateListener used to: Add and start listener when listener doesn't exist Update listener when listener already exist

func (*ListenerAdapter) DeleteListener

func (adapter *ListenerAdapter) DeleteListener(serverName string, listenerName string) error

func (*ListenerAdapter) FindListenerByName

func (adapter *ListenerAdapter) FindListenerByName(serverName string, listenerName string) types.Listener

FindListenerByName

type Server

type Server interface {
	AddListener(lc *v2.Listener) (types.ListenerEventListener, error)

	Start()

	Restart()

	// Shutdown means graceful stop
	Shutdown() error

	Close()

	Handler() types.ConnectionHandler
}

func GetServer

func GetServer() Server

GetServer currently, only one server supported

func NewServer

func NewServer(config *Config, cmFilter types.ClusterManagerFilter, clMng types.ClusterManager) Server

NewServer get a new server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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