Add basic state interface for libpod
Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
parent
ee24340f0c
commit
2850fb60a5
1 changed files with 37 additions and 0 deletions
37
libpod/state.go
Normal file
37
libpod/state.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package libpod
|
||||
|
||||
// State is a storage backend for libpod's current state
|
||||
type State interface {
|
||||
// Accepts full ID of container
|
||||
GetContainer(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
|
||||
// If the container belongs to a pod, that pod must already be present
|
||||
// in the state when the container is added
|
||||
AddContainer(ctr *Container) error
|
||||
// Removes container from state
|
||||
// If the container belongs to a pod, it will be removed from the pod
|
||||
// as well
|
||||
RemoveContainer(ctr *Container) error
|
||||
// Retrieves all containers presently in state
|
||||
GetAllContainers() ([]*Container, error)
|
||||
|
||||
// Accepts full ID of pod
|
||||
GetPod(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)
|
||||
// Adds pod to state
|
||||
// Any containers within the pod not already in the state will be added
|
||||
// with it
|
||||
AddPod(pod *Pod) error
|
||||
// Removes pod from state
|
||||
// All containers within the pod will also be removed
|
||||
RemovePod(pod *Pod) error
|
||||
// Retrieves all pods presently in state
|
||||
GetAllPods() ([]*Pod, error)
|
||||
}
|
Loading…
Reference in a new issue