Documentation
¶
Index ¶
- func AvailableImages() []string
- func IsConnectedToDocker() bool
- func New() error
- type Event
- type EventType
- type ImagePullProgressDetails
- type ImagePullStatus
- type LaunchableContainer
- func (c *LaunchableContainer) Attach() error
- func (c *LaunchableContainer) ImageExists() (bool, error)
- func (c *LaunchableContainer) Launch() error
- func (c *LaunchableContainer) OnContainerEvent(callback OnContainerEventFuc)
- func (c *LaunchableContainer) Pull() error
- func (c *LaunchableContainer) Remove() error
- func (c *LaunchableContainer) Start() error
- func (c *LaunchableContainer) StateString() string
- func (c *LaunchableContainer) Stop() error
- func (c *LaunchableContainer) WaitForDockerDaemon() error
- type OnContainerEventFuc
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableImages ¶
func AvailableImages() []string
AvailableImages returns a list of available images
func IsConnectedToDocker ¶
func IsConnectedToDocker() bool
IsConnectedToDocker returns if we are connected to the docker daemon
Types ¶
type Event ¶
type Event struct { Type EventType Self *LaunchableContainer Data interface{} }
Event contains a container event
type EventType ¶
type EventType int
EventType is the type of a container event
const ( // ImagePullStatusChanged means that the pull status or progress changed ImagePullStatusChanged EventType = iota // StateChanged means that the ContainerState changed StateChanged // ConsoleOutput means that there was some console output by the container ConsoleOutput // LogMessage means there was some important log from docker LogMessage // ErrorMessage means there was some error log from docker ErrorMessage )
type ImagePullProgressDetails ¶
ImagePullProgressDetails contains details of an ongoing pull
type ImagePullStatus ¶
type ImagePullStatus struct { ID string `json:"id"` Status string `json:"status"` Progress string `json:"progress"` ProgressDetail *ImagePullProgressDetails `json:"progressDetail"` }
ImagePullStatus contains the status of an ongoing pull
type LaunchableContainer ¶
type LaunchableContainer struct {
// contains filtered or unexported fields
}
LaunchableContainer is a container which can be launched by this launcher
func NewSasmContainer ¶
func NewSasmContainer(image string) (*LaunchableContainer, error)
NewSasmContainer creates a new launchable sasm container image can be of: - sasm-docker-alpine-32 - sasm-docker-alpine-64
func (*LaunchableContainer) Attach ¶
func (c *LaunchableContainer) Attach() error
Attach attaches the log listener to the container
func (*LaunchableContainer) ImageExists ¶
func (c *LaunchableContainer) ImageExists() (bool, error)
ImageExists checks if the image exists
func (*LaunchableContainer) Launch ¶
func (c *LaunchableContainer) Launch() error
Launch launches the container
func (*LaunchableContainer) OnContainerEvent ¶
func (c *LaunchableContainer) OnContainerEvent(callback OnContainerEventFuc)
OnContainerEvent allows to register a callback function
func (*LaunchableContainer) Pull ¶
func (c *LaunchableContainer) Pull() error
Pull pulls the container
func (*LaunchableContainer) Remove ¶
func (c *LaunchableContainer) Remove() error
Remove removes the container
func (*LaunchableContainer) Start ¶
func (c *LaunchableContainer) Start() error
Start starts the container
func (*LaunchableContainer) StateString ¶
func (c *LaunchableContainer) StateString() string
StateString returns the current container state as a string
func (*LaunchableContainer) Stop ¶
func (c *LaunchableContainer) Stop() error
Stop stops the container
func (*LaunchableContainer) WaitForDockerDaemon ¶
func (c *LaunchableContainer) WaitForDockerDaemon() error
WaitForDockerDaemon trys to connect to the docker daemon 12 times in a 5 second interval before giving up.
type OnContainerEventFuc ¶
type OnContainerEventFuc func(event Event)
OnContainerEventFuc is the type of a callback function which gets called on every container event
type State ¶
type State int
State is the state of a container
const ( // OfflineState means the container is offline OfflineState State = iota // LaunchingState is the state in between offline and pulling and pulling an starting state LaunchingState // PullingState means the container image is being pulled PullingState // StartingState means the container is starting StartingState // RunningState means the container is running RunningState // StoppingState means the container is stopping StoppingState )