server: store creation in containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
1f4a4742cb
commit
790c6d891a
6 changed files with 28 additions and 15 deletions
|
@ -42,7 +42,9 @@ type ContainerState struct {
|
|||
}
|
||||
|
||||
// NewContainer creates a container object.
|
||||
func NewContainer(id string, name string, bundlePath string, logPath string, netns ns.NetNS, labels map[string]string, annotations map[string]string, image *pb.ImageSpec, metadata *pb.ContainerMetadata, sandbox string, terminal bool, privileged bool, dir string) (*Container, error) {
|
||||
func NewContainer(id string, name string, bundlePath string, logPath string, netns ns.NetNS, labels map[string]string, annotations map[string]string, image *pb.ImageSpec, metadata *pb.ContainerMetadata, sandbox string, terminal bool, privileged bool, dir string, created time.Time) (*Container, error) {
|
||||
state := &ContainerState{}
|
||||
state.Created = created
|
||||
c := &Container{
|
||||
id: id,
|
||||
name: name,
|
||||
|
@ -57,10 +59,16 @@ func NewContainer(id string, name string, bundlePath string, logPath string, net
|
|||
annotations: annotations,
|
||||
image: image,
|
||||
dir: dir,
|
||||
state: state,
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// CreatedAt returns the container creation time
|
||||
func (c *Container) CreatedAt() time.Time {
|
||||
return c.state.Created
|
||||
}
|
||||
|
||||
// Name returns the name of the container.
|
||||
func (c *Container) Name() string {
|
||||
return c.name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue