container

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPostgresImage = "postgres:14"
View Source
var ErrContainerNotFound = errors.New("container not found")
View Source
var ErrPortNotFound = errors.New("port not found")
View Source
var ErrStartTimeout = errors.New("timeout waiting for container to start")
View Source
var ManagerContextStore = ctxutil.NewStore[*Manager, containerManagerCtxKey]()

Functions

This section is empty.

Types

type Address

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

func (Address) Host

func (a Address) Host() string

func (Address) HostPort

func (a Address) HostPort() string

func (Address) Network

func (a Address) Network() string

func (Address) Port

func (a Address) Port() string

func (Address) String

func (a Address) String() string

type Container

type Container struct {
	ID     string
	Name   string
	Config CreateParams
	Info   types.ContainerJSON
}

func (*Container) Address

func (c *Container) Address(port string) (address netx.Address, err error)

type Contract

type Contract interface {
	Start() error
	Stop() error
	Restart() error
	Reset() error
}

type CreateParams

type CreateParams struct {
	Name      string
	Platform  *imagev1.Platform
	Container *containerapi.Config
	Host      *containerapi.HostConfig
	Network   *networkapi.NetworkingConfig
}

type Environment

type Environment map[string]string

func (Environment) ToSlice

func (e Environment) ToSlice() (result []string)

type ImagePullParams

type ImagePullParams struct {
	Image string
	Out   io.Writer
}

type Manager

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

func NewManager

func NewManager() (p *Manager, err error)

func (*Manager) Cleanup

func (p *Manager) Cleanup(ctx context.Context) (err error)

func (*Manager) Create

func (p *Manager) Create(ctx context.Context, params CreateParams) (container *Container, err error)

func (*Manager) CreateAndStart

func (p *Manager) CreateAndStart(ctx context.Context, params CreateParams, opts ...StartOption) (container *Container, err error)

func (*Manager) PullImage

func (p *Manager) PullImage(ctx context.Context, params ImagePullParams) (err error)

func (*Manager) RefreshState

func (p *Manager) RefreshState(ctx context.Context, params RefreshParams) (container *Container, err error)

func (*Manager) Start

func (p *Manager) Start(ctx context.Context, params StartParams, opts ...StartOption) (container *Container, err error)

func (*Manager) Stop

func (p *Manager) Stop(ctx context.Context, params StopParams) (err error)

type Migrations

type Migrations interface {
	Up() error
	Down() error
	Reset() error
	UpTo(version int) error
	DownTo(version int) error
}

type RefreshParams

type RefreshParams struct {
	Name string
}

type StartOption

type StartOption func(container *Container) error

func WaitForPort

func WaitForPort(port string) StartOption

type StartParams

type StartParams struct {
	Name    string
	Timeout *time.Duration
}

type StopParams

type StopParams struct {
	ID      string
	Timeout *int
}

func NewDefaultStopParams

func NewDefaultStopParams(id string) *StopParams

Jump to

Keyboard shortcuts

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