mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
libpod/runtime_pod: Make removePod per-platform
b96be3af (changes to allow for darwin compilation, 2018-06-20, #1015) made RemovePod per-platform, but left out docs for the unsupported version [1]: libpod/runtime_pod_unsupported.go:14:1⚠️ exported method Runtime.RemovePod should have comment or be unexported (golint) To keep the docs DRY, I've restored RemovePod and its docs to their previous location, and named a new, internal removePod for the per-platform implementations. [1]: https://travis-ci.org/projectatomic/libpod/jobs/400555937#L159 Signed-off-by: W. Trevor King <wking@tremily.us> Closes: #1034 Approved by: baude
This commit is contained in:

committed by
Atomic Bot

parent
cad28cc2d3
commit
537f021733
@ -1,5 +1,9 @@
|
|||||||
package libpod
|
package libpod
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
// Contains the public Runtime API for pods
|
// Contains the public Runtime API for pods
|
||||||
|
|
||||||
// A PodCreateOption is a functional option which alters the Pod created by
|
// A PodCreateOption is a functional option which alters the Pod created by
|
||||||
@ -11,6 +15,16 @@ type PodCreateOption func(*Pod) error
|
|||||||
// will include the pod, a false return will exclude it.
|
// will include the pod, a false return will exclude it.
|
||||||
type PodFilter func(*Pod) bool
|
type PodFilter func(*Pod) bool
|
||||||
|
|
||||||
|
// RemovePod removes a pod
|
||||||
|
// If removeCtrs is specified, containers will be removed
|
||||||
|
// Otherwise, a pod that is not empty will return an error and not be removed
|
||||||
|
// If force is specified with removeCtrs, all containers will be stopped before
|
||||||
|
// being removed
|
||||||
|
// Otherwise, the pod will not be removed if any containers are running
|
||||||
|
func (r *Runtime) RemovePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
|
||||||
|
return r.removePod(ctx, p, removeCtrs, force)
|
||||||
|
}
|
||||||
|
|
||||||
// GetPod retrieves a pod by its ID
|
// GetPod retrieves a pod by its ID
|
||||||
func (r *Runtime) GetPod(id string) (*Pod, error) {
|
func (r *Runtime) GetPod(id string) (*Pod, error) {
|
||||||
r.lock.RLock()
|
r.lock.RLock()
|
||||||
|
@ -77,13 +77,7 @@ func (r *Runtime) NewPod(options ...PodCreateOption) (*Pod, error) {
|
|||||||
return nil, ErrNotImplemented
|
return nil, ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemovePod removes a pod
|
func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
|
||||||
// If removeCtrs is specified, containers will be removed
|
|
||||||
// Otherwise, a pod that is not empty will return an error and not be removed
|
|
||||||
// If force is specified with removeCtrs, all containers will be stopped before
|
|
||||||
// being removed
|
|
||||||
// Otherwise, the pod will not be removed if any containers are running
|
|
||||||
func (r *Runtime) RemovePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
|
|
||||||
r.lock.Lock()
|
r.lock.Lock()
|
||||||
defer r.lock.Unlock()
|
defer r.lock.Unlock()
|
||||||
|
|
||||||
|
@ -11,6 +11,6 @@ func (r *Runtime) NewPod(options ...PodCreateOption) (*Pod, error) {
|
|||||||
return nil, ErrOSNotSupported
|
return nil, ErrOSNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Runtime) RemovePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
|
func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
|
||||||
return ErrOSNotSupported
|
return ErrOSNotSupported
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user