Use new container update function
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package container
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
)
|
||||
|
||||
// Client holds the containerd container client.
|
||||
// containerd.Container is a pointer underlying. New assignment won't affect
|
||||
// the previous pointer, so simply lock around is enough.
|
||||
type Client struct {
|
||||
lock sync.RWMutex
|
||||
container containerd.Container
|
||||
}
|
||||
|
||||
// Get containerd container client.
|
||||
func (c *Client) Get() containerd.Container {
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
return c.container
|
||||
}
|
||||
|
||||
// Set containerd container client.
|
||||
func (c *Client) Set(container containerd.Container) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
c.container = container
|
||||
}
|
||||
@@ -33,7 +33,7 @@ type Container struct {
|
||||
// Status stores the status of the container.
|
||||
Status StatusStorage
|
||||
// Container is the containerd container client.
|
||||
Container *Client
|
||||
Container containerd.Container
|
||||
// Container IO
|
||||
IO *cio.ContainerIO
|
||||
// TODO(random-liu): Add stop channel to get rid of stop poll waiting.
|
||||
@@ -45,7 +45,7 @@ type Opts func(*Container) error
|
||||
// WithContainer adds the containerd Container to the internal data store.
|
||||
func WithContainer(cntr containerd.Container) Opts {
|
||||
return func(c *Container) error {
|
||||
c.Container = &Client{container: cntr}
|
||||
c.Container = cntr
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -95,10 +95,6 @@ type Store struct {
|
||||
// TODO(random-liu): Add trunc index.
|
||||
}
|
||||
|
||||
// LoadStore loads containers from runtime.
|
||||
// TODO(random-liu): Implement LoadStore.
|
||||
func LoadStore() *Store { return nil }
|
||||
|
||||
// NewStore creates a container store.
|
||||
func NewStore() *Store {
|
||||
return &Store{containers: make(map[string]Container)}
|
||||
|
||||
@@ -51,10 +51,6 @@ type Store struct {
|
||||
// TODO(random-liu): Add trunc index.
|
||||
}
|
||||
|
||||
// LoadStore loads images from runtime.
|
||||
// TODO(random-liu): Implement LoadStore.
|
||||
func LoadStore() *Store { return nil }
|
||||
|
||||
// NewStore creates an image store.
|
||||
func NewStore() *Store {
|
||||
return &Store{images: make(map[string]Image)}
|
||||
|
||||
@@ -42,10 +42,6 @@ type Store struct {
|
||||
// TODO(random-liu): Add trunc index.
|
||||
}
|
||||
|
||||
// LoadStore loads sandboxes from runtime.
|
||||
// TODO(random-liu): Implement LoadStore.
|
||||
func LoadStore() *Store { return nil }
|
||||
|
||||
// NewStore creates a sandbox store.
|
||||
func NewStore() *Store {
|
||||
return &Store{sandboxes: make(map[string]Sandbox)}
|
||||
|
||||
Reference in New Issue
Block a user