diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-01-12 12:41:10 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-01-16 14:58:06 +0000 |
commit | 20df2196f2158d8656d1b38580d816567843a5e0 (patch) | |
tree | deaf0b58a6e8753893ed99029a71b21433b0fa25 /libpod/state.go | |
parent | d2ec1f76287a55d05ef1378fa31d5474c2bcc0bf (diff) | |
download | podman-20df2196f2158d8656d1b38580d816567843a5e0.tar.gz podman-20df2196f2158d8656d1b38580d816567843a5e0.tar.bz2 podman-20df2196f2158d8656d1b38580d816567843a5e0.zip |
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 <matthew.heon@gmail.com>
Closes: #220
Approved by: rhatdan
Diffstat (limited to 'libpod/state.go')
-rw-r--r-- | libpod/state.go | 7 |
1 files changed, 7 insertions, 0 deletions
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) |