aboutsummaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-06-24 15:48:34 -0500
committerbaude <bbaude@redhat.com>2019-06-25 13:51:24 -0500
commitdd81a44ccfa34585ef62319835c8bb421db9e334 (patch)
tree7bab006a56d5823ccdf7b8cf6e59502ee954a979 /libpod/pod_api.go
parenta1a4a75abee2c381483a218e1660621ee416ef7c (diff)
downloadpodman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.gz
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.bz2
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.zip
remove libpod from main
the compilation demands of having libpod in main is a burden for the remote client compilations. to combat this, we should move the use of libpod structs, vars, constants, and functions into the adapter code where it will only be compiled by the local client. this should result in cleaner code organization and smaller binaries. it should also help if we ever need to compile the remote client on non-Linux operating systems natively (not cross-compiled). Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r--libpod/pod_api.go31
1 files changed, 16 insertions, 15 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index b913857dd..3126ced4c 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -3,6 +3,7 @@ package libpod
import (
"context"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/events"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -27,7 +28,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -47,7 +48,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
// If there are no containers without dependencies, we can't start
// Error out
if len(graph.noDepNodes) == 0 {
- return nil, errors.Wrapf(ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
+ return nil, errors.Wrapf(define.ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
}
// Traverse the graph beginning at nodes with no dependencies
@@ -56,7 +57,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error starting some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error starting some containers")
}
defer p.newPodEvent(events.Start)
return nil, nil
@@ -88,7 +89,7 @@ func (p *Pod) StopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -136,7 +137,7 @@ func (p *Pod) StopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error stopping some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error stopping some containers")
}
defer p.newPodEvent(events.Stop)
return nil, nil
@@ -159,7 +160,7 @@ func (p *Pod) Pause() (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -195,7 +196,7 @@ func (p *Pod) Pause() (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error pausing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error pausing some containers")
}
defer p.newPodEvent(events.Pause)
return nil, nil
@@ -218,7 +219,7 @@ func (p *Pod) Unpause() (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -254,7 +255,7 @@ func (p *Pod) Unpause() (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error unpausing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error unpausing some containers")
}
defer p.newPodEvent(events.Unpause)
@@ -279,7 +280,7 @@ func (p *Pod) Restart(ctx context.Context) (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -299,7 +300,7 @@ func (p *Pod) Restart(ctx context.Context) (map[string]error, error) {
// If there are no containers without dependencies, we can't start
// Error out
if len(graph.noDepNodes) == 0 {
- return nil, errors.Wrapf(ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
+ return nil, errors.Wrapf(define.ErrNoSuchCtr, "no containers in pod %s have no dependencies, cannot start pod", p.ID())
}
// Traverse the graph beginning at nodes with no dependencies
@@ -308,7 +309,7 @@ func (p *Pod) Restart(ctx context.Context) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error stopping some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error stopping some containers")
}
p.newPodEvent(events.Stop)
p.newPodEvent(events.Start)
@@ -331,7 +332,7 @@ func (p *Pod) Kill(signal uint) (map[string]error, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)
@@ -374,7 +375,7 @@ func (p *Pod) Kill(signal uint) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(ErrCtrExists, "error killing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error killing some containers")
}
defer p.newPodEvent(events.Kill)
return nil, nil
@@ -387,7 +388,7 @@ func (p *Pod) Status() (map[string]ContainerStatus, error) {
defer p.lock.Unlock()
if !p.valid {
- return nil, ErrPodRemoved
+ return nil, define.ErrPodRemoved
}
allCtrs, err := p.runtime.state.PodContainers(p)