zero

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKillTimeout = errors.New("process did not terminate within the timeout period")
)

Functions

This section is empty.

Types

type CommandRunner added in v0.3.0

type CommandRunner interface {
	Command(name string, arg ...string) *exec.Cmd
}

type EnvGetter added in v0.3.0

type EnvGetter func(string) string

type FileOpener added in v0.3.0

type FileOpener func(name string) (*os.File, error)

type ListenerOptions added in v0.5.0

type ListenerOptions struct {
	Config        *net.ListenConfig
	Network       string
	Address       string
	ProxyProtocol bool
}

type Options

type Options struct {
	UpgradeSock string
	PIDFile     string
	QuitTimout  time.Duration
}

func (Options) GetPIDFile

func (opts Options) GetPIDFile() string

func (Options) GetUpgradeSock

func (opts Options) GetUpgradeSock() string

type ProcessFinder added in v0.3.0

type ProcessFinder interface {
	FindProcess(pid int) (process, error)
}

type State

type State int8

type ZeroDownTime

type ZeroDownTime struct {
	QuitTimeout time.Duration
	// contains filtered or unexported fields
}

func New

func New(opts Options) *ZeroDownTime

func (*ZeroDownTime) Close

func (z *ZeroDownTime) Close(ctx context.Context) error

func (*ZeroDownTime) GetPID added in v0.2.0

func (z *ZeroDownTime) GetPID() (int, error)

func (*ZeroDownTime) IsUpgraded

func (z *ZeroDownTime) IsUpgraded() bool

func (*ZeroDownTime) Listener

func (z *ZeroDownTime) Listener(ctx context.Context, options *ListenerOptions) (net.Listener, error)

func (*ZeroDownTime) Quit added in v0.4.0

func (z *ZeroDownTime) Quit(ctx context.Context, pid int, removePIDFile bool) error

Quit sends a signal to the process and waits for it to exit. If the process does not exit within the timeout period, it will be sent a SIGKILL signal. If removePIDFile is true, the PID file will be removed if it exists.

The signal sent is SIGHUP, which is usually used to restart a process. If the process has already exited, this method will return nil immediately.

If the process does not exit within the timeout period, ErrKillTimeout will be returned.

func (*ZeroDownTime) RemoveUpgradeSock added in v0.2.0

func (z *ZeroDownTime) RemoveUpgradeSock() error

func (*ZeroDownTime) Upgrade

func (z *ZeroDownTime) Upgrade() error

func (*ZeroDownTime) WaitForUpgrade

func (z *ZeroDownTime) WaitForUpgrade(ctx context.Context) error

func (*ZeroDownTime) WritePID added in v0.2.0

func (z *ZeroDownTime) WritePID() error

Jump to

Keyboard shortcuts

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