2017-11-01 15:24:59 +00:00
|
|
|
package libpod
|
|
|
|
|
|
|
|
// State is a storage backend for libpod's current state
|
|
|
|
type State interface {
|
2017-11-07 18:46:30 +00:00
|
|
|
// Close performs any pre-exit cleanup (e.g. closing database
|
|
|
|
// connections) that may be required
|
|
|
|
Close() error
|
|
|
|
|
2017-12-07 18:15:34 +00:00
|
|
|
// Refresh clears container and pod states after a reboot
|
|
|
|
Refresh() error
|
|
|
|
|
2017-11-01 15:24:59 +00:00
|
|
|
// Accepts full ID of container
|
|
|
|
Container(id string) (*Container, error)
|
|
|
|
// Accepts full or partial IDs (as long as they are unique) and names
|
|
|
|
LookupContainer(idOrName string) (*Container, error)
|
|
|
|
// Checks if a container with the given ID is present in the state
|
|
|
|
HasContainer(id string) (bool, error)
|
|
|
|
// Adds container to state
|
2017-12-14 04:12:32 +00:00
|
|
|
// The container cannot be part of a pod
|
2017-11-01 15:24:59 +00:00
|
|
|
AddContainer(ctr *Container) error
|
|
|
|
// Removes container from state
|
|
|
|
// The container will only be removed from the state, not from the pod
|
|
|
|
// which the container belongs to
|
|
|
|
RemoveContainer(ctr *Container) error
|
2017-11-09 18:51:20 +00:00
|
|
|
// UpdateContainer updates a container's state from the backing store
|
|
|
|
UpdateContainer(ctr *Container) error
|
|
|
|
// SaveContainer saves a container's current state to the backing store
|
|
|
|
SaveContainer(ctr *Container) error
|
2018-01-12 17:41:10 +00:00
|
|
|
// 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)
|
2017-11-01 15:24:59 +00:00
|
|
|
// Retrieves all containers presently in state
|
|
|
|
AllContainers() ([]*Container, error)
|
|
|
|
|
|
|
|
// Accepts full ID of pod
|
|
|
|
Pod(id string) (*Pod, error)
|
|
|
|
// Accepts full or partial IDs (as long as they are unique) and names
|
|
|
|
LookupPod(idOrName string) (*Pod, error)
|
|
|
|
// Checks if a pod with the given ID is present in the state
|
|
|
|
HasPod(id string) (bool, error)
|
2018-01-18 15:49:01 +00:00
|
|
|
// Check if a pod has a container with the given ID
|
|
|
|
PodHasContainer(pod *Pod, ctrID string) (bool, error)
|
|
|
|
// Get the IDs of all containers in a pod
|
|
|
|
PodContainersByID(pod *Pod) ([]string, error)
|
|
|
|
// Get all the containers in a pod
|
|
|
|
PodContainers(pod *Pod) ([]*Container, error)
|
2017-11-01 15:24:59 +00:00
|
|
|
// Adds pod to state
|
|
|
|
AddPod(pod *Pod) error
|
|
|
|
// Removes pod from state
|
2018-01-18 15:49:01 +00:00
|
|
|
// Only empty pods can be removed from the state
|
2017-11-01 15:24:59 +00:00
|
|
|
RemovePod(pod *Pod) error
|
2017-12-14 04:12:32 +00:00
|
|
|
// AddContainerToPod adds a container to an existing pod
|
|
|
|
// The container given will be added to the state and the pod
|
|
|
|
AddContainerToPod(pod *Pod, ctr *Container) error
|
|
|
|
// RemoveContainerFromPod removes a container from an existing pod
|
|
|
|
// The container will also be removed from the state
|
|
|
|
RemoveContainerFromPod(pod *Pod, ctr *Container) error
|
2017-11-01 15:24:59 +00:00
|
|
|
// Retrieves all pods presently in state
|
|
|
|
AllPods() ([]*Pod, error)
|
|
|
|
}
|