aboutsummaryrefslogtreecommitdiff
path: root/libpod/in_memory_state.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/in_memory_state.go')
-rw-r--r--libpod/in_memory_state.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go
index b4e224d77..93c61537f 100644
--- a/libpod/in_memory_state.go
+++ b/libpod/in_memory_state.go
@@ -284,6 +284,20 @@ func (s *InMemoryState) HasPod(id string) (bool, error) {
return ok, nil
}
+// PodContainers retrieves the containers from a pod given the pod's full ID
+func (s *InMemoryState) PodContainers(id string) ([]*Container, error) {
+ if id == "" {
+ return nil, ErrEmptyID
+ }
+
+ pod, ok := s.pods[id]
+ if !ok {
+ return nil, errors.Wrapf(ErrNoSuchPod, "no pod with ID %s found", id)
+ }
+
+ return pod.GetContainers()
+}
+
// AddPod adds a given pod to the state
// Only empty pods can be added to the state
func (s *InMemoryState) AddPod(pod *Pod) error {