From 20df2196f2158d8656d1b38580d816567843a5e0 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 12 Jan 2018 12:41:10 -0500 Subject: Add ability for states to track container dependencies Also prevent containers with dependencies from being removed from in memory states. SQLite already enforced this via FOREIGN KEY constraints. Signed-off-by: Matthew Heon Closes: #220 Approved by: rhatdan --- libpod/state.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libpod/state.go') diff --git a/libpod/state.go b/libpod/state.go index 4a79b8d2d..63865a541 100644 --- a/libpod/state.go +++ b/libpod/state.go @@ -28,6 +28,13 @@ type State interface { UpdateContainer(ctr *Container) error // SaveContainer saves a container's current state to the backing store SaveContainer(ctr *Container) error + // ContainerInUse checks if other containers depend upon a given + // container + // It returns a slice of the IDs of containers which depend on the given + // container. If the slice is empty, no container depend on the given + // container. + // A container cannot be removed if other containers depend on it + ContainerInUse(ctr *Container) ([]string, error) // Retrieves all containers presently in state AllContainers() ([]*Container, error) -- cgit v1.2.3-54-g00ecf