Timestamp added to container object.

Fix for #912

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
This commit is contained in:
Kunal Kushwaha 2017-05-29 10:10:12 +09:00
parent 4ae34cccc5
commit 0008ac7f3d
5 changed files with 186 additions and 60 deletions

View File

@ -29,13 +29,18 @@ import _ "github.com/gogo/protobuf/gogoproto"
import google_protobuf1 "github.com/gogo/protobuf/types"
import google_protobuf2 "github.com/golang/protobuf/ptypes/empty"
import google_protobuf3 "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/types"
import _ "github.com/containerd/containerd/api/types/descriptor"
import time "time"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
import strings "strings"
import reflect "reflect"
import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
@ -46,6 +51,7 @@ import io "io"
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@ -80,7 +86,9 @@ type Container struct {
// Snapshots referenced in this field will not be garbage collected.
//
// This field may be updated.
RootFS string `protobuf:"bytes,7,opt,name=rootfs,proto3" json:"rootfs,omitempty"`
RootFS string `protobuf:"bytes,7,opt,name=rootfs,proto3" json:"rootfs,omitempty"`
CreatedAt time.Time `protobuf:"bytes,8,opt,name=created_at,json=createdAt,stdtime" json:"created_at"`
UpdatedAt time.Time `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,stdtime" json:"updated_at"`
}
func (m *Container) Reset() { *m = Container{} }
@ -457,6 +465,22 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintContainers(dAtA, i, uint64(len(m.RootFS)))
i += copy(dAtA[i:], m.RootFS)
}
dAtA[i] = 0x42
i++
i = encodeVarintContainers(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt)))
n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:])
if err != nil {
return 0, err
}
i += n2
dAtA[i] = 0x4a
i++
i = encodeVarintContainers(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt)))
n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i:])
if err != nil {
return 0, err
}
i += n3
return i, nil
}
@ -502,11 +526,11 @@ func (m *GetContainerResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size()))
n2, err := m.Container.MarshalTo(dAtA[i:])
n4, err := m.Container.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
i += n4
return i, nil
}
@ -582,11 +606,11 @@ func (m *CreateContainerRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size()))
n3, err := m.Container.MarshalTo(dAtA[i:])
n5, err := m.Container.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
i += n5
return i, nil
}
@ -608,11 +632,11 @@ func (m *CreateContainerResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size()))
n4, err := m.Container.MarshalTo(dAtA[i:])
n6, err := m.Container.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
i += n6
return i, nil
}
@ -634,20 +658,20 @@ func (m *UpdateContainerRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size()))
n5, err := m.Container.MarshalTo(dAtA[i:])
n7, err := m.Container.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n5
i += n7
if m.UpdateMask != nil {
dAtA[i] = 0x12
i++
i = encodeVarintContainers(dAtA, i, uint64(m.UpdateMask.Size()))
n6, err := m.UpdateMask.MarshalTo(dAtA[i:])
n8, err := m.UpdateMask.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
i += n8
}
return i, nil
}
@ -670,11 +694,11 @@ func (m *UpdateContainerResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size()))
n7, err := m.Container.MarshalTo(dAtA[i:])
n9, err := m.Container.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n7
i += n9
return i, nil
}
@ -760,6 +784,10 @@ func (m *Container) Size() (n int) {
if l > 0 {
n += 1 + l + sovContainers(uint64(l))
}
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt)
n += 1 + l + sovContainers(uint64(l))
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt)
n += 1 + l + sovContainers(uint64(l))
return n
}
@ -883,6 +911,8 @@ func (this *Container) String() string {
`Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`,
`Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`,
`RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`,
`CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`,
`UpdatedAt:` + strings.Replace(strings.Replace(this.UpdatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
@ -1280,6 +1310,66 @@ func (m *Container) Unmarshal(dAtA []byte) error {
}
m.RootFS = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainers
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthContainers
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainers
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthContainers
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UpdatedAt, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipContainers(dAtA[iNdEx:])
@ -2162,45 +2252,48 @@ func init() {
}
var fileDescriptorContainers = []byte{
// 625 bytes of a gzipped FileDescriptorProto
// 680 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0xae, 0x9d, 0xe0, 0x2a, 0x13, 0x21, 0xa1, 0x25, 0x18, 0x63, 0x24, 0x37, 0x32, 0x3f, 0xca,
0x05, 0x1b, 0xc2, 0x85, 0x9f, 0x0a, 0x89, 0xfe, 0xaa, 0x52, 0xe1, 0xe0, 0x02, 0xe5, 0x86, 0x9c,
0x78, 0x63, 0x56, 0x75, 0xbc, 0xc6, 0xbb, 0xae, 0x94, 0x1b, 0xef, 0xc0, 0x8d, 0x67, 0xe0, 0x41,
0x7a, 0xe4, 0xc8, 0xa9, 0xa2, 0x7e, 0x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x7e, 0xb2, 0xe0, 0x25, 0xd0, 0xef,
0xfd, 0x11, 0x23, 0xd7, 0xd9, 0x83, 0x0a, 0xb7, 0x22, 0xca, 0x7e, 0xb9, 0x0a, 0x0d, 0xad, 0x3f,
0xb8, 0x04, 0x25, 0x49, 0x0f, 0x40, 0x8d, 0xdd, 0x82, 0xb2, 0x0d, 0xc5, 0xe6, 0xd4, 0x1f, 0x5e,
0x06, 0x4b, 0x89, 0xe3, 0xbb, 0xe4, 0x88, 0x8b, 0x3d, 0x94, 0x23, 0x5e, 0x74, 0xd5, 0x6d, 0x50,
0xe3, 0xbb, 0xe4, 0x88, 0x8b, 0xcf, 0xa5, 0x37, 0x72, 0x4e, 0xda, 0xe4, 0x7f, 0x64, 0x3d, 0xed,
0xe4, 0xac, 0xb9, 0xf4, 0xe3, 0xac, 0xb9, 0xf4, 0x69, 0xd6, 0x54, 0x4e, 0x66, 0x4d, 0xe5, 0xfb,
0xac, 0xa9, 0xfc, 0x9a, 0x35, 0x95, 0xbe, 0x2a, 0x90, 0x4f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff,
0xc1, 0x18, 0xeb, 0x02, 0x8d, 0x07, 0x00, 0x00,
}

View File

@ -6,6 +6,7 @@ import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto";
// Containers provides metadata storage for containers used in the execution
@ -65,6 +66,9 @@ message Container {
//
// This field may be updated.
string rootfs = 7 [(gogoproto.customname) = "RootFS"];
google.protobuf.Timestamp created_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp updated_at = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
}
message GetContainerRequest {

View File

@ -1,18 +1,23 @@
package containers
import "context"
import (
"context"
"time"
)
// Container represents the set of data pinned by a container. Unless otherwise
// noted, the resources here are considered in use by the container.
//
// The resources specified in this object are used to create tasks from the container.
type Container struct {
ID string
Labels map[string]string
Image string
Runtime string
Spec []byte
RootFS string
ID string
Labels map[string]string
Image string
Runtime string
Spec []byte
RootFS string
CreatedAt time.Time
UpdatedAt time.Time
}
type Store interface {

View File

@ -18,6 +18,8 @@ var (
bucketKeyRuntime = []byte("runtime")
bucketKeySpec = []byte("spec")
bucketKeyRootFS = []byte("rootfs")
bucketKeyCreatedAt = []byte("createdat")
bucketKeyUpdatedAt = []byte("updatedat")
)
// InitDB will initialize the database for use. The database must be opened for

View File

@ -2,6 +2,7 @@ package metadata
import (
"context"
"time"
"github.com/boltdb/bolt"
"github.com/containerd/containerd/containers"
@ -74,6 +75,8 @@ func (s *containerStore) Create(ctx context.Context, container containers.Contai
return containers.Container{}, err
}
container.CreatedAt = time.Now()
container.UpdatedAt = container.CreatedAt
if err := writeContainer(&container, cbkt); err != nil {
return containers.Container{}, errors.Wrap(err, "failed to write container")
}
@ -92,6 +95,7 @@ func (s *containerStore) Update(ctx context.Context, container containers.Contai
return containers.Container{}, errors.Wrap(ErrNotFound, "no content for id")
}
container.UpdatedAt = time.Now()
if err := writeContainer(&container, cbkt); err != nil {
return containers.Container{}, errors.Wrap(err, "failed to write container")
}
@ -123,6 +127,14 @@ func readContainer(container *containers.Container, bkt *bolt.Bucket) error {
container.Spec = v
case string(bucketKeyRootFS):
container.RootFS = string(v)
case string(bucketKeyCreatedAt):
if err := container.CreatedAt.UnmarshalBinary(v); err != nil {
return err
}
case string(bucketKeyUpdatedAt):
if err := container.UpdatedAt.UnmarshalBinary(v); err != nil {
return err
}
case string(bucketKeyLabels):
lbkt := bkt.Bucket(bucketKeyLabels)
if lbkt == nil {
@ -142,11 +154,21 @@ func readContainer(container *containers.Container, bkt *bolt.Bucket) error {
}
func writeContainer(container *containers.Container, bkt *bolt.Bucket) error {
createdAt, err := container.CreatedAt.MarshalBinary()
if err != nil {
return err
}
updatedAt, err := container.UpdatedAt.MarshalBinary()
if err != nil {
return err
}
for _, v := range [][2][]byte{
{bucketKeyImage, []byte(container.Image)},
{bucketKeyRuntime, []byte(container.Runtime)},
{bucketKeySpec, container.Spec},
{bucketKeyRootFS, []byte(container.RootFS)},
{bucketKeyCreatedAt, createdAt},
{bucketKeyUpdatedAt, updatedAt},
} {
if err := bkt.Put(v[0], v[1]); err != nil {
return err