aboutsummaryrefslogtreecommitdiff
path: root/libpod/define
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/define
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/define')
-rw-r--r--libpod/define/config.go10
-rw-r--r--libpod/define/errors.go102
2 files changed, 112 insertions, 0 deletions
diff --git a/libpod/define/config.go b/libpod/define/config.go
new file mode 100644
index 000000000..256a4b21f
--- /dev/null
+++ b/libpod/define/config.go
@@ -0,0 +1,10 @@
+package define
+
+var (
+ // DefaultInitPath is the default path to the container-init binary
+ DefaultInitPath = "/usr/libexec/podman/catatonit"
+)
+
+// CtrRemoveTimeout is the default number of seconds to wait after stopping a container
+// before sending the kill signal
+const CtrRemoveTimeout = 10
diff --git a/libpod/define/errors.go b/libpod/define/errors.go
new file mode 100644
index 000000000..14643ced1
--- /dev/null
+++ b/libpod/define/errors.go
@@ -0,0 +1,102 @@
+package define
+
+import (
+ "errors"
+
+ "github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/utils"
+)
+
+var (
+ // ErrNoSuchCtr indicates the requested container does not exist
+ ErrNoSuchCtr = image.ErrNoSuchCtr
+
+ // ErrNoSuchPod indicates the requested pod does not exist
+ ErrNoSuchPod = image.ErrNoSuchPod
+
+ // ErrNoSuchImage indicates the requested image does not exist
+ ErrNoSuchImage = image.ErrNoSuchImage
+
+ // ErrNoSuchVolume indicates the requested volume does not exist
+ ErrNoSuchVolume = errors.New("no such volume")
+
+ // ErrCtrExists indicates a container with the same name or ID already
+ // exists
+ ErrCtrExists = errors.New("container already exists")
+ // ErrPodExists indicates a pod with the same name or ID already exists
+ ErrPodExists = errors.New("pod already exists")
+ // ErrImageExists indicates an image with the same ID already exists
+ ErrImageExists = errors.New("image already exists")
+ // ErrVolumeExists indicates a volume with the same name already exists
+ ErrVolumeExists = errors.New("volume already exists")
+
+ // ErrCtrStateInvalid indicates a container is in an improper state for
+ // the requested operation
+ ErrCtrStateInvalid = errors.New("container state improper")
+ // ErrVolumeBeingUsed indicates that a volume is being used by at least one container
+ ErrVolumeBeingUsed = errors.New("volume is being used")
+
+ // ErrRuntimeFinalized indicates that the runtime has already been
+ // created and cannot be modified
+ ErrRuntimeFinalized = errors.New("runtime has been finalized")
+ // ErrCtrFinalized indicates that the container has already been created
+ // and cannot be modified
+ ErrCtrFinalized = errors.New("container has been finalized")
+ // ErrPodFinalized indicates that the pod has already been created and
+ // cannot be modified
+ ErrPodFinalized = errors.New("pod has been finalized")
+ // ErrVolumeFinalized indicates that the volume has already been created and
+ // cannot be modified
+ ErrVolumeFinalized = errors.New("volume has been finalized")
+
+ // ErrInvalidArg indicates that an invalid argument was passed
+ ErrInvalidArg = errors.New("invalid argument")
+ // ErrEmptyID indicates that an empty ID was passed
+ ErrEmptyID = errors.New("name or ID cannot be empty")
+
+ // ErrInternal indicates an internal library error
+ ErrInternal = errors.New("internal libpod error")
+
+ // ErrDetach indicates that an attach session was manually detached by
+ // the user.
+ ErrDetach = utils.ErrDetach
+
+ // ErrRuntimeStopped indicates that the runtime has already been shut
+ // down and no further operations can be performed on it
+ ErrRuntimeStopped = errors.New("runtime has already been stopped")
+ // ErrCtrStopped indicates that the requested container is not running
+ // and the requested operation cannot be performed until it is started
+ ErrCtrStopped = errors.New("container is stopped")
+
+ // ErrCtrRemoved indicates that the container has already been removed
+ // and no further operations can be performed on it
+ ErrCtrRemoved = errors.New("container has already been removed")
+ // ErrPodRemoved indicates that the pod has already been removed and no
+ // further operations can be performed on it
+ ErrPodRemoved = errors.New("pod has already been removed")
+ // ErrVolumeRemoved indicates that the volume has already been removed and
+ // no further operations can be performed on it
+ ErrVolumeRemoved = errors.New("volume has already been removed")
+
+ // ErrDBClosed indicates that the connection to the state database has
+ // already been closed
+ ErrDBClosed = errors.New("database connection already closed")
+ // ErrDBBadConfig indicates that the database has a different schema or
+ // was created by a libpod with a different config
+ ErrDBBadConfig = errors.New("database configuration mismatch")
+
+ // ErrNSMismatch indicates that the requested pod or container is in a
+ // different namespace and cannot be accessed or modified.
+ ErrNSMismatch = errors.New("target is in a different namespace")
+
+ // ErrNotImplemented indicates that the requested functionality is not
+ // yet present
+ ErrNotImplemented = errors.New("not yet implemented")
+
+ // ErrOSNotSupported indicates the function is not available on the particular
+ // OS.
+ ErrOSNotSupported = errors.New("No support for this OS yet")
+
+ // ErrOCIRuntime indicates an error from the OCI runtime
+ ErrOCIRuntime = errors.New("OCI runtime error")
+)