diff options
author | baude <bbaude@redhat.com> | 2019-06-24 15:48:34 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-06-25 13:51:24 -0500 |
commit | dd81a44ccfa34585ef62319835c8bb421db9e334 (patch) | |
tree | 7bab006a56d5823ccdf7b8cf6e59502ee954a979 /libpod/runtime_pod.go | |
parent | a1a4a75abee2c381483a218e1660621ee416ef7c (diff) | |
download | podman-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/runtime_pod.go')
-rw-r--r-- | libpod/runtime_pod.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libpod/runtime_pod.go b/libpod/runtime_pod.go index b3dd7dabd..66f9b10c9 100644 --- a/libpod/runtime_pod.go +++ b/libpod/runtime_pod.go @@ -4,6 +4,7 @@ import ( "context" "time" + "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" ) @@ -30,7 +31,7 @@ func (r *Runtime) RemovePod(ctx context.Context, p *Pod, removeCtrs, force bool) defer r.lock.Unlock() if !r.valid { - return ErrRuntimeStopped + return define.ErrRuntimeStopped } if !p.valid { @@ -53,7 +54,7 @@ func (r *Runtime) GetPod(id string) (*Pod, error) { defer r.lock.RUnlock() if !r.valid { - return nil, ErrRuntimeStopped + return nil, define.ErrRuntimeStopped } return r.state.Pod(id) @@ -65,7 +66,7 @@ func (r *Runtime) HasPod(id string) (bool, error) { defer r.lock.RUnlock() if !r.valid { - return false, ErrRuntimeStopped + return false, define.ErrRuntimeStopped } return r.state.HasPod(id) @@ -78,7 +79,7 @@ func (r *Runtime) LookupPod(idOrName string) (*Pod, error) { defer r.lock.RUnlock() if !r.valid { - return nil, ErrRuntimeStopped + return nil, define.ErrRuntimeStopped } return r.state.LookupPod(idOrName) @@ -93,7 +94,7 @@ func (r *Runtime) Pods(filters ...PodFilter) ([]*Pod, error) { defer r.lock.RUnlock() if !r.valid { - return nil, ErrRuntimeStopped + return nil, define.ErrRuntimeStopped } pods, err := r.state.AllPods() @@ -122,7 +123,7 @@ func (r *Runtime) GetAllPods() ([]*Pod, error) { defer r.lock.RUnlock() if !r.valid { - return nil, ErrRuntimeStopped + return nil, define.ErrRuntimeStopped } return r.state.AllPods() @@ -137,7 +138,7 @@ func (r *Runtime) GetLatestPod() (*Pod, error) { return nil, errors.Wrapf(err, "unable to get all pods") } if len(pods) == 0 { - return nil, ErrNoSuchPod + return nil, define.ErrNoSuchPod } for podIndex, pod := range pods { createdTime := pod.config.CreatedTime @@ -159,7 +160,7 @@ func (r *Runtime) GetRunningPods() ([]*Pod, error) { defer r.lock.RUnlock() if !r.valid { - return nil, ErrRuntimeStopped + return nil, define.ErrRuntimeStopped } containers, err := r.GetRunningContainers() if err != nil { @@ -171,7 +172,7 @@ func (r *Runtime) GetRunningPods() ([]*Pod, error) { pods = append(pods, c.PodID()) pod, err := r.GetPod(c.PodID()) if err != nil { - if errors.Cause(err) == ErrPodRemoved || errors.Cause(err) == ErrNoSuchPod { + if errors.Cause(err) == define.ErrPodRemoved || errors.Cause(err) == define.ErrNoSuchPod { continue } return nil, err |