Documentation
¶
Index ¶
- Variables
- func DefaultClosingAckStats() map[string]ClosingAckStats
- func Done() <-chan struct{}
- func Init(opts ...Option)
- func IsDone() bool
- func RegisterProtocol(name string)
- func Shutdown(ctx context.Context) error
- type ClosingAckStats
- type ClosingDirectoryRegistry
- type ClosingEvent
- type ClosingEventHandler
- type Option
- func SetShutdownConfig(cfg *global.ShutdownConfig) Option
- func WithConsumerUpdateWaitTime(duration time.Duration) Option
- func WithNotifyTimeout(timeout time.Duration) Option
- func WithOfflineRequestWindowTimeout(timeout time.Duration) Option
- func WithRejectRequest() Option
- func WithStepTimeout(timeout time.Duration) Option
- func WithTimeout(timeout time.Duration) Option
- func WithoutInternalSignal() Option
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( // ShutdownSignals receives shutdown signals to process ShutdownSignals = []os.Signal{ os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGSTOP, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS, syscall.SIGTERM, } // DumpHeapShutdownSignals receives shutdown signals to process DumpHeapShutdownSignals = []os.Signal{ syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS, } )
Functions ¶
func DefaultClosingAckStats ¶ added in v3.3.2
func DefaultClosingAckStats() map[string]ClosingAckStats
DefaultClosingAckStats returns the process-wide active-notice ack statistics.
func RegisterProtocol ¶
func RegisterProtocol(name string)
RegisterProtocol registers protocol which would be destroyed before shutdown. Please make sure that the Init function has been invoked before, otherwise this function would not make any sense.
Types ¶
type ClosingAckStats ¶ added in v3.3.2
ClosingAckStats is a lightweight, consumer-side statistic for active closing notices. Received means the consumer observed an active notice; Removed means directory removal succeeded; Missed means the notice was observed but did not match a local directory entry.
type ClosingDirectoryRegistry ¶ added in v3.3.2
type ClosingDirectoryRegistry interface {
Register(serviceKey string, remover clusterdirectory.ClosingInstanceRemover)
Unregister(serviceKey string, remover clusterdirectory.ClosingInstanceRemover)
Find(serviceKey string) []clusterdirectory.ClosingInstanceRemover
}
ClosingDirectoryRegistry resolves directory-level removers by service key.
func DefaultClosingDirectoryRegistry ¶ added in v3.3.2
func DefaultClosingDirectoryRegistry() ClosingDirectoryRegistry
DefaultClosingDirectoryRegistry returns the process-wide closing directory registry.
type ClosingEvent ¶ added in v3.3.2
ClosingEvent represents a single closing signal on the consumer side.
type ClosingEventHandler ¶ added in v3.3.2
type ClosingEventHandler interface {
HandleClosingEvent(event ClosingEvent) bool
}
ClosingEventHandler handles closing signals from active and passive notification paths.
func DefaultClosingEventHandler ¶ added in v3.3.2
func DefaultClosingEventHandler() ClosingEventHandler
DefaultClosingEventHandler returns the default closing event handler.
type Option ¶
type Option func(*Options)
func SetShutdownConfig ¶ added in v3.3.1
func SetShutdownConfig(cfg *global.ShutdownConfig) Option
func WithNotifyTimeout ¶ added in v3.3.2
func WithRejectRequest ¶
func WithRejectRequest() Option
func WithStepTimeout ¶
func WithTimeout ¶
func WithoutInternalSignal ¶
func WithoutInternalSignal() Option