notifyproxy

package
v4.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoReadyMessage = errors.New("container stopped running before READY message was received")

ErrNoReadyMessage is returned when we are waiting for the READY message of a container that is not in the running state anymore.

Functions

func SendMessage

func SendMessage(socketPath string, message string) error

SendMessage sends the specified message to the specified socket. No message is sent if no socketPath is provided and the NOTIFY_SOCKET variable is not set either.

Types

type Container

type Container interface {
	State() (define.ContainerStatus, error)
	ID() string
}

Container avoids a circular dependency among this package and libpod.

type NotifyProxy

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

NotifyProxy can be used to proxy notify messages.

func New

func New(tmpDir string) (*NotifyProxy, error)

New creates a NotifyProxy that starts listening immediately. The specified temp directory can be left empty.

func (*NotifyProxy) AddContainer

func (p *NotifyProxy) AddContainer(container Container)

AddContainer associates a container with the proxy.

func (*NotifyProxy) Close added in v4.4.0

func (p *NotifyProxy) Close() error

Close closes the listener and removes the socket.

func (*NotifyProxy) SocketPath

func (p *NotifyProxy) SocketPath() string

SocketPath returns the path of the socket the proxy is listening on.

func (*NotifyProxy) Wait added in v4.4.0

func (p *NotifyProxy) Wait() error

Wait waits until receiving the `READY` notify message. Note that the this function must only be executed inside a systemd service which will kill the process after a given timeout. If the (optional) container stopped running before the `READY` is received, the waiting gets canceled and ErrNoReadyMessage is returned.

Jump to

Keyboard shortcuts

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