Documentation ¶
Index ¶
- Constants
- type Container
- func (c *Container) Annotations() map[string]string
- func (c *Container) BundlePath() string
- func (c *Container) ID() string
- func (c *Container) Image() *pb.ImageSpec
- func (c *Container) Labels() map[string]string
- func (c *Container) LogPath() string
- func (c *Container) Metadata() *pb.ContainerMetadata
- func (c *Container) Name() string
- func (c *Container) NetNsPath() (string, error)
- func (c *Container) Sandbox() string
- type ContainerState
- type ExecSyncError
- type ExecSyncResponse
- type History
- type Runtime
- func (r *Runtime) ContainerDir() string
- func (r *Runtime) ContainerStatus(c *Container) *ContainerState
- func (r *Runtime) CreateContainer(c *Container) error
- func (r *Runtime) DeleteContainer(c *Container) error
- func (r *Runtime) ExecSync(c *Container, command []string, timeout int64) (resp *ExecSyncResponse, err error)
- func (r *Runtime) Name() string
- func (r *Runtime) NetworkReady() (bool, error)
- func (r *Runtime) Path() string
- func (r *Runtime) RuntimeReady() (bool, error)
- func (r *Runtime) StartContainer(c *Container) error
- func (r *Runtime) StopContainer(c *Container) error
- func (r *Runtime) UpdateStatus(c *Container) error
- func (r *Runtime) Version() (string, error)
- type Store
- type StoreFilter
- type StoreReducer
Constants ¶
const ( // ContainerStateCreated represents the created state of a container ContainerStateCreated = "created" // ContainerStateRunning represents the running state of a container ContainerStateRunning = "running" // ContainerStateStopped represents the stopped state of a container ContainerStateStopped = "stopped" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container respresents a runtime container.
func NewContainer ¶
func NewContainer(id string, name string, bundlePath string, logPath string, netns ns.NetNS, labels map[string]string, annotations map[string]string, image *pb.ImageSpec, metadata *pb.ContainerMetadata, sandbox string, terminal bool) (*Container, error)
NewContainer creates a container object.
func (*Container) Annotations ¶
Annotations returns the annotations of the container.
func (*Container) BundlePath ¶
BundlePath returns the bundlePath of the container.
func (*Container) Metadata ¶
func (c *Container) Metadata() *pb.ContainerMetadata
Metadata returns the metadata of the container.
type ContainerState ¶
type ContainerState struct { specs.State Created time.Time `json:"created"` Started time.Time `json:"started"` Finished time.Time `json:"finished"` ExitCode int32 `json:"exitCode"` }
ContainerState represents the status of a container.
type ExecSyncError ¶
ExecSyncError wraps command's streams, exit code and error on ExecSync error.
func (ExecSyncError) Error ¶
func (e ExecSyncError) Error() string
type ExecSyncResponse ¶
ExecSyncResponse is returned from ExecSync.
type History ¶
type History []*Container
History is a convenience type for storing a list of containers, sorted by creation date in descendant order.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime stores the information about a oci runtime
func New ¶
func New(runtimePath string, containerDir string, conmonPath string, conmonEnv []string, cgroupManager string) (*Runtime, error)
New creates a new Runtime with options provided
func (*Runtime) ContainerDir ¶
ContainerDir returns the path to the base directory for storing container configurations
func (*Runtime) ContainerStatus ¶
func (r *Runtime) ContainerStatus(c *Container) *ContainerState
ContainerStatus returns the state of a container.
func (*Runtime) CreateContainer ¶
CreateContainer creates a container.
func (*Runtime) DeleteContainer ¶
DeleteContainer deletes a container.
func (*Runtime) ExecSync ¶
func (r *Runtime) ExecSync(c *Container, command []string, timeout int64) (resp *ExecSyncResponse, err error)
ExecSync execs a command in a container and returns it's stdout, stderr and return code.
func (*Runtime) NetworkReady ¶
NetworkReady checks if the runtime network is up and ready to accept containers which require container network.
func (*Runtime) RuntimeReady ¶
RuntimeReady checks if the runtime is up and ready to accept basic containers e.g. container only needs host network.
func (*Runtime) StartContainer ¶
StartContainer starts a container.
func (*Runtime) StopContainer ¶
StopContainer stops a container.
func (*Runtime) UpdateStatus ¶
UpdateStatus refreshes the status of the container.
type Store ¶
type Store interface { // Add appends a new container to the store. Add(string, *Container) // Get returns a container from the store by the identifier it was stored with. Get(string) *Container // Delete removes a container from the store by the identifier it was stored with. Delete(string) // List returns a list of containers from the store. List() []*Container // Size returns the number of containers in the store. Size() int // First returns the first container found in the store by a given filter. First(StoreFilter) *Container // ApplyAll calls the reducer function with every container in the store. ApplyAll(StoreReducer) }
Store defines an interface that any container store must implement.
type StoreFilter ¶
StoreFilter defines a function to filter container in the store.
type StoreReducer ¶
type StoreReducer func(*Container)
StoreReducer defines a function to manipulate containers in the store