From 9d30093505dca0d16469c56855bb5606e85db847 Mon Sep 17 00:00:00 2001 From: HuKeping Date: Fri, 22 Apr 2016 15:49:55 -0400 Subject: [PATCH] Interface: introduce status to runtime container Signed-off-by: Hu Keping --- runtime/container.go | 3 +++ runtime/container_linux.go | 5 +++++ runtime/container_windows.go | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/runtime/container.go b/runtime/container.go index 2a96289..6a3db7d 100644 --- a/runtime/container.go +++ b/runtime/container.go @@ -52,6 +52,9 @@ type Container interface { OOM() (OOM, error) // UpdateResource updates the containers resources to new values UpdateResources(*Resource) error + + // Status return the current status of the container. + Status() (State, error) } type OOM interface { diff --git a/runtime/container_linux.go b/runtime/container_linux.go index 5bc5abe..f573473 100644 --- a/runtime/container_linux.go +++ b/runtime/container_linux.go @@ -284,6 +284,11 @@ func (c *container) Stats() (*Stat, error) { }, nil } +// Status implements the runtime Container interface. +func (c *container) Status() (State, error) { + return "running", nil +} + func (c *container) OOM() (OOM, error) { container, err := c.getLibctContainer() if err != nil { diff --git a/runtime/container_windows.go b/runtime/container_windows.go index 47b6b49..6a35400 100644 --- a/runtime/container_windows.go +++ b/runtime/container_windows.go @@ -61,6 +61,11 @@ func (c *container) Stats() (*Stat, error) { return nil, errors.New("Stats not yet implemented on Windows") } +// Status implements the runtime Container interface. +func (c *container) Status() (State, error) { + return "", errors.New("Status not yet implemented on Windows") +} + func (c *container) OOM() (OOM, error) { return nil, errors.New("OOM not yet implemented on Windows") }