Documentation
¶
Index ¶
- Constants
- Variables
- func Sync(state *record.ApplicationRecord)
- func TrySelectOneContainer(application string, labels ...Label) (optional.Optional[Container], error)
- type BasicFileContent
- type CmdResult
- type Container
- func (self *Container) CopyInto(files ...FileContent) error
- func (self *Container) EnsurePathExists(path string) error
- func (self *Container) Equal(other *Container) bool
- func (self *Container) ExitsPath(path string) (bool, error)
- func (self *Container) Image() string
- func (self *Container) Inspect() (container.InspectResponse, error)
- func (self *Container) IsRunning() (bool, error)
- func (self *Container) ReadFile(path string) (string, error)
- func (self *Container) Shutdown() error
- func (self *Container) String() string
- type ContainerConfig
- type ContainerOption
- func WithCmd(cmd ...string) ContainerOption
- func WithConnectedToNetwork(nt *Network) ContainerOption
- func WithCopyIntoBeforeStart(file FileContent) ContainerOption
- func WithExposeTcpPort(hostPort string, containerPort string) ContainerOption
- func WithImage(img string) ContainerOption
- func WithLabels(labels ...Label) ContainerOption
- func WithMount(hostMount string, containerMount string) ContainerOption
- func WithPulling() ContainerOption
- type ContainerOptions
- type FileContent
- type Label
- type Network
- type ObjectLabel
- type SelectedContainer
- type SelectedNetwork
Constants ¶
View Source
const (
ErrTypeFailedInteractionWithDockerDaemon = "FailedInteractionWithDockerDaemon"
)
View Source
const NetworkDaemonName = "network"
Variables ¶
View Source
var ( ErrContainterCannotStart = errors.New("cannot start the container") ErrCommandFailedToExecute = errors.New("command existed with error code") )
Functions ¶
func Sync ¶
func Sync(state *record.ApplicationRecord)
Syncs the network and ensures that all required containers are running to maintain the application state.
Types ¶
type BasicFileContent ¶
func (*BasicFileContent) FileContent ¶
func (self *BasicFileContent) FileContent() []byte
func (*BasicFileContent) FilePath ¶
func (self *BasicFileContent) FilePath() string
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func CreateNewContainer ¶
func CreateNewContainer( application string, options ...ContainerOption, ) (*Container, error)
func (*Container) CopyInto ¶
func (self *Container) CopyInto(files ...FileContent) error
func (*Container) EnsurePathExists ¶
type ContainerConfig ¶
type ContainerConfig struct {
// contains filtered or unexported fields
}
type ContainerOption ¶
type ContainerOption func(cfg *ContainerConfig)
func WithCmd ¶
func WithCmd(cmd ...string) ContainerOption
func WithConnectedToNetwork ¶
func WithConnectedToNetwork(nt *Network) ContainerOption
func WithCopyIntoBeforeStart ¶
func WithCopyIntoBeforeStart(file FileContent) ContainerOption
func WithExposeTcpPort ¶
func WithExposeTcpPort(hostPort string, containerPort string) ContainerOption
func WithImage ¶
func WithImage(img string) ContainerOption
func WithLabels ¶
func WithLabels(labels ...Label) ContainerOption
func WithMount ¶
func WithMount(hostMount string, containerMount string) ContainerOption
func WithPulling ¶
func WithPulling() ContainerOption
type ContainerOptions ¶
type ContainerOptions struct {
// contains filtered or unexported fields
}
func NewContainerOptions ¶
func NewContainerOptions() *ContainerOptions
func (*ContainerOptions) Add ¶
func (self *ContainerOptions) Add(options ...ContainerOption)
type FileContent ¶
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
func ApplicationNameLabel ¶
zeus.application.name={name}
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
func CreateNewNetwork ¶
Interact with the docker daemon and initialises a new network. Additionally start a DNS sever inside the network.
The network gets labeled with:
- zeus.object.type=network
- zeus.application.name={application}
The DNS gets labeled with:
- zeus.object.type=dns
- zeus.application.name={applicaiton}
type ObjectLabel ¶
type ObjectLabel int
const ( IngressObject ObjectLabel = iota + 1 NetworkObject DNSObject )
type SelectedContainer ¶
type SelectedContainer struct {
// contains filtered or unexported fields
}
func SelectContainer ¶
func SelectContainer( labels ...Label, ) ([]SelectedContainer, error)
Selects a container by the labels if it exists. No promise about the container is made, it can be in any state.
func (*SelectedContainer) NewContainer ¶
func (self *SelectedContainer) NewContainer( application string, ) (*Container, error)
type SelectedNetwork ¶
type SelectedNetwork struct {
// contains filtered or unexported fields
}
func SelectNetworks ¶
func SelectNetworks( labels ...Label, ) ([]SelectedNetwork, error)
Selects a container by the labels if it exists. No promise about the container is made, it can be in any state.
If not container exists nil is returned.
func (*SelectedNetwork) NewNetwork ¶
func (self *SelectedNetwork) NewNetwork( application string, ) *Network
Source Files
¶
Click to show internal directories.
Click to hide internal directories.