containers

package
v0.0.0-...-9febfc8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractContainer

type AbstractContainer struct {
	ContainerInterface

	StartCmd   []string
	Name       string
	TempDirLoc string

	ConcreteContainer  ContainerInterface
	StartContainerResp *api.StartContainerResponse
	GetContainerResp   *api.GetContainerResponse
	// contains filtered or unexported fields
}

AbstractContainer represents abstract container.

func NewAbstractContainer

func NewAbstractContainer(
	namePrefix string,
	containerImage string,
	ctr managers.ContainerManager) AbstractContainer

func (*AbstractContainer) GetContainer

func (cont *AbstractContainer) GetContainer(ctx context.Context) (*api.GetContainerResponse, error)

GetContainer gets the container info.

func (*AbstractContainer) GetContainerType

func (cont *AbstractContainer) GetContainerType() ContainerType

func (*AbstractContainer) GetLogsLocation

func (cont *AbstractContainer) GetLogsLocation() (string, error)

func (*AbstractContainer) InitializeBase

func (cont *AbstractContainer) InitializeBase(ctx context.Context) error

InitializeBase does initial work that is common to all containers.

func (*AbstractContainer) ProcessContainer

func (cont *AbstractContainer) ProcessContainer(
	ctx context.Context,
	template *api.Template) (string, error)

ProcessContainer processes(initialize, start, get, retrieve server address) the container.

func (*AbstractContainer) StopContainer

func (cont *AbstractContainer) StopContainer(ctx context.Context) error

StopContainer stop the container.

type AbstractContainerType

type AbstractContainerType struct {
	ContainerInterface
}

AbstractContainer satisfies the container requirement that is common to all.

type ContainerInterface

type ContainerInterface interface {
	// GetContainerType returns the container type.
	GetContainerType() ContainerType

	// Initialize initializes the container.
	Initialize(context.Context, *api.Template) error

	// StartContainer starts the container.
	StartContainer(context.Context) (*api.StartContainerResponse, error)

	// GetContainer gets the container related info.
	GetContainer(context.Context) (*api.GetContainerResponse, error)

	// ProcessContainer processes the container.
	// Ideally, this aggregates initialize, start and get together.
	ProcessContainer(context.Context, *api.Template) (string, error)

	// StopContainer stops the container.
	StopContainer(context.Context) error

	// GetLogsLocation returns the container activity logs location.
	GetLogsLocation() (string, error)
}

ContainerInterface defines the contract a container will have to satisfy.

func NewContainer

func NewContainer(
	namePrefix string,
	containerImage string,
	ctr managers.ContainerManager) ContainerInterface

type ContainerState

type ContainerState string

Container state types

const (
	ContainerStateNotInitialized ContainerState = "NotInitialized"
	ContainerStateInitialized    ContainerState = "Initialized"
	ContainerStateStarted        ContainerState = "Started"
	ContainerStateStopped        ContainerState = "Stopped"
)

type ContainerType

type ContainerType string

Container type

type TemplatedContainer

type TemplatedContainer struct {
	AbstractContainer

	StartTemplatedContainerReq *api.StartTemplatedContainerRequest
}

func NewGenericContainer

func NewGenericContainer(
	namePrefix string,
	containerImage string,
	ctr managers.ContainerManager) *TemplatedContainer

func (*TemplatedContainer) Initialize

func (cont *TemplatedContainer) Initialize(
	ctx context.Context,
	template *api.Template) error

Initialize initializes the container.

func (*TemplatedContainer) StartContainer

func (cont *TemplatedContainer) StartContainer(ctx context.Context) (*api.StartContainerResponse, error)

StartContainer starts the container.

Jump to

Keyboard shortcuts

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