|
@@ -163,14 +163,14 @@ type Daemon struct {
|
|
imageStore image.Store
|
|
imageStore image.Store
|
|
}
|
|
}
|
|
|
|
|
|
-// Get looks for a container using the provided information, which could be
|
|
|
|
|
|
+// GetContainer looks for a container using the provided information, which could be
|
|
// one of the following inputs from the caller:
|
|
// one of the following inputs from the caller:
|
|
// - A full container ID, which will exact match a container in daemon's list
|
|
// - A full container ID, which will exact match a container in daemon's list
|
|
// - A container name, which will only exact match via the GetByName() function
|
|
// - A container name, which will only exact match via the GetByName() function
|
|
// - A partial container ID prefix (e.g. short ID) of any length that is
|
|
// - A partial container ID prefix (e.g. short ID) of any length that is
|
|
// unique enough to only return a single container object
|
|
// unique enough to only return a single container object
|
|
// If none of these searches succeed, an error is returned
|
|
// If none of these searches succeed, an error is returned
|
|
-func (daemon *Daemon) Get(prefixOrName string) (*container.Container, error) {
|
|
|
|
|
|
+func (daemon *Daemon) GetContainer(prefixOrName string) (*container.Container, error) {
|
|
if containerByID := daemon.containers.Get(prefixOrName); containerByID != nil {
|
|
if containerByID := daemon.containers.Get(prefixOrName); containerByID != nil {
|
|
// prefix is an exact match to a full container ID
|
|
// prefix is an exact match to a full container ID
|
|
return containerByID, nil
|
|
return containerByID, nil
|
|
@@ -196,13 +196,13 @@ func (daemon *Daemon) Get(prefixOrName string) (*container.Container, error) {
|
|
// Exists returns a true if a container of the specified ID or name exists,
|
|
// Exists returns a true if a container of the specified ID or name exists,
|
|
// false otherwise.
|
|
// false otherwise.
|
|
func (daemon *Daemon) Exists(id string) bool {
|
|
func (daemon *Daemon) Exists(id string) bool {
|
|
- c, _ := daemon.Get(id)
|
|
|
|
|
|
+ c, _ := daemon.GetContainer(id)
|
|
return c != nil
|
|
return c != nil
|
|
}
|
|
}
|
|
|
|
|
|
// IsPaused returns a bool indicating if the specified container is paused.
|
|
// IsPaused returns a bool indicating if the specified container is paused.
|
|
func (daemon *Daemon) IsPaused(id string) bool {
|
|
func (daemon *Daemon) IsPaused(id string) bool {
|
|
- c, _ := daemon.Get(id)
|
|
|
|
|
|
+ c, _ := daemon.GetContainer(id)
|
|
return c.State.IsPaused()
|
|
return c.State.IsPaused()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -552,7 +552,7 @@ func (daemon *Daemon) getEventFilter(filter filters.Args) *events.Filter {
|
|
// incoming container filter can be name, id or partial id, convert to
|
|
// incoming container filter can be name, id or partial id, convert to
|
|
// a full container id
|
|
// a full container id
|
|
for _, cn := range filter.Get("container") {
|
|
for _, cn := range filter.Get("container") {
|
|
- c, err := daemon.Get(cn)
|
|
|
|
|
|
+ c, err := daemon.GetContainer(cn)
|
|
filter.Del("container", cn)
|
|
filter.Del("container", cn)
|
|
if err == nil {
|
|
if err == nil {
|
|
filter.Add("container", c.ID)
|
|
filter.Add("container", c.ID)
|
|
@@ -599,7 +599,7 @@ func (daemon *Daemon) children(name string) (map[string]*container.Container, er
|
|
children := make(map[string]*container.Container)
|
|
children := make(map[string]*container.Container)
|
|
|
|
|
|
err = daemon.containerGraphDB.Walk(name, func(p string, e *graphdb.Entity) error {
|
|
err = daemon.containerGraphDB.Walk(name, func(p string, e *graphdb.Entity) error {
|
|
- c, err := daemon.Get(e.ID())
|
|
|
|
|
|
+ c, err := daemon.GetContainer(e.ID())
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|