Merge pull request #1626 from jessvalarezo/windows-changes

Change hcsshimopts to hcsshimtypes package
This commit is contained in:
Phil Estes 2017-10-11 15:00:52 -04:00 committed by GitHub
commit b5152f2746
10 changed files with 56 additions and 56 deletions

View File

@ -49,8 +49,8 @@ ignore_files = [
] ]
[[descriptors]] [[descriptors]]
prefix = "github.com/containerd/containerd/windows/hcsshimopts" prefix = "github.com/containerd/containerd/windows/hcsshimtypes"
target = "windows/hcsshimopts/next.pb.txt" target = "windows/hcsshimtypes/next.pb.txt"
ignore_files = [ ignore_files = [
"google/protobuf/descriptor.proto", "google/protobuf/descriptor.proto",
"gogoproto/gogo.proto" "gogoproto/gogo.proto"

View File

@ -5,7 +5,7 @@ import (
"os" "os"
"text/tabwriter" "text/tabwriter"
"github.com/containerd/containerd/windows/hcsshimopts" "github.com/containerd/containerd/windows/hcsshimtypes"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -45,7 +45,7 @@ var taskPsCommand = cli.Command{
fmt.Fprintln(w, "PID\tINFO") fmt.Fprintln(w, "PID\tINFO")
for _, ps := range processes { for _, ps := range processes {
if ps.Info != nil { if ps.Info != nil {
var details hcsshimopts.ProcessDetails var details hcsshimtypes.ProcessDetails
if err := details.Unmarshal(ps.Info.Value); err == nil { if err := details.Unmarshal(ps.Info.Value); err == nil {
if _, err := fmt.Fprintf(w, "%d\t%+v\n", ps.Pid, details); err != nil { if _, err := fmt.Fprintf(w, "%d\t%+v\n", ps.Pid, details); err != nil {
return err return err

View File

@ -17,7 +17,7 @@ import (
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/windows/hcsshimopts" "github.com/containerd/containerd/windows/hcsshimtypes"
gogotypes "github.com/gogo/protobuf/types" gogotypes "github.com/gogo/protobuf/types"
) )
@ -383,9 +383,9 @@ func TestContainerPids(t *testing.T) {
if processes[0].Info == nil { if processes[0].Info == nil {
t.Error("expected additional process information but received nil") t.Error("expected additional process information but received nil")
} else { } else {
var details hcsshimopts.ProcessDetails var details hcsshimtypes.ProcessDetails
if err := details.Unmarshal(processes[0].Info.Value); err != nil { if err := details.Unmarshal(processes[0].Info.Value); err != nil {
t.Errorf("expected Windows info type hcsshimopts.ProcessDetails %v", err) t.Errorf("expected Windows info type hcsshimtypes.ProcessDetails %v", err)
} }
} }
default: default:

View File

@ -1,2 +0,0 @@
// hcsshimopts holds the windows runtime specific options
package hcsshimopts

View File

@ -0,0 +1,2 @@
// hcsshimtypes holds the windows runtime specific types
package hcsshimtypes

View File

@ -1,18 +1,18 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/windows/hcsshimopts/hcsshim.proto // source: github.com/containerd/containerd/windows/hcsshimtypes/hcsshim.proto
// DO NOT EDIT! // DO NOT EDIT!
/* /*
Package hcsshimopts is a generated protocol buffer package. Package hcsshimtypes is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
github.com/containerd/containerd/windows/hcsshimopts/hcsshim.proto github.com/containerd/containerd/windows/hcsshimtypes/hcsshim.proto
It has these top-level messages: It has these top-level messages:
CreateOptions CreateOptions
ProcessDetails ProcessDetails
*/ */
package hcsshimopts package hcsshimtypes
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -688,39 +688,39 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/windows/hcsshimopts/hcsshim.proto", fileDescriptorHcsshim) proto.RegisterFile("github.com/containerd/containerd/windows/hcsshimtypes/hcsshim.proto", fileDescriptorHcsshim)
} }
var fileDescriptorHcsshim = []byte{ var fileDescriptorHcsshim = []byte{
// 473 bytes of a gzipped FileDescriptorProto // 474 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x6e,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0xff, 0xff, 0x55, 0x4d, 0x8c, 0x0a, 0x32, 0x03, 0x00, 0x00,
} }

View File

@ -6,7 +6,7 @@ import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto"; import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
option go_package = "github.com/containerd/containerd/windows/hcsshimopts;hcsshimopts"; option go_package = "github.com/containerd/containerd/windows/hcsshimtypes;hcsshimtypes";
message CreateOptions { message CreateOptions {
google.protobuf.Duration terminate_duration = 1 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; google.protobuf.Duration terminate_duration = 1 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];

View File

@ -61,7 +61,7 @@ file {
syntax: "proto3" syntax: "proto3"
} }
file { file {
name: "github.com/containerd/containerd/windows/hcsshimopts/hcsshim.proto" name: "github.com/containerd/containerd/windows/hcsshimtypes/hcsshim.proto"
package: "containerd.windows.hcsshim" package: "containerd.windows.hcsshim"
dependency: "gogoproto/gogo.proto" dependency: "gogoproto/gogo.proto"
dependency: "google/protobuf/duration.proto" dependency: "google/protobuf/duration.proto"
@ -142,7 +142,7 @@ file {
} }
} }
options { options {
go_package: "github.com/containerd/containerd/windows/hcsshimopts;hcsshimopts" go_package: "github.com/containerd/containerd/windows/hcsshimtypes;hcsshimtypes"
} }
syntax: "proto3" syntax: "proto3"
} }

View File

@ -20,7 +20,7 @@ import (
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/runtime" "github.com/containerd/containerd/runtime"
"github.com/containerd/containerd/windows/hcsshimopts" "github.com/containerd/containerd/windows/hcsshimtypes"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -109,15 +109,15 @@ func (r *windowsRuntime) Create(ctx context.Context, id string, opts runtime.Cre
} }
spec := s.(*specs.Spec) spec := s.(*specs.Spec)
var createOpts *hcsshimopts.CreateOptions var createOpts *hcsshimtypes.CreateOptions
if opts.Options != nil { if opts.Options != nil {
o, err := typeurl.UnmarshalAny(opts.Options) o, err := typeurl.UnmarshalAny(opts.Options)
if err != nil { if err != nil {
return nil, err return nil, err
} }
createOpts = o.(*hcsshimopts.CreateOptions) createOpts = o.(*hcsshimtypes.CreateOptions)
} else { } else {
createOpts = &hcsshimopts.CreateOptions{} createOpts = &hcsshimtypes.CreateOptions{}
} }
if createOpts.TerminateDuration == 0 { if createOpts.TerminateDuration == 0 {
@ -215,7 +215,7 @@ func (r *windowsRuntime) Delete(ctx context.Context, t runtime.Task) (*runtime.E
return rtExit, nil return rtExit, nil
} }
func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, spec *specs.Spec, io runtime.IO, createOpts *hcsshimopts.CreateOptions) (*task, error) { func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, spec *specs.Spec, io runtime.IO, createOpts *hcsshimtypes.CreateOptions) (*task, error) {
var ( var (
err error err error
pset *pipeSet pset *pipeSet
@ -391,7 +391,7 @@ func (r *windowsRuntime) serviceTask(ctx context.Context, namespace, id string,
err error err error
t *task t *task
io runtime.IO io runtime.IO
createOpts = &hcsshimopts.CreateOptions{ createOpts = &hcsshimtypes.CreateOptions{
TerminateDuration: defaultTerminateDuration, TerminateDuration: defaultTerminateDuration,
} }
) )

View File

@ -12,7 +12,7 @@ import (
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/runtime" "github.com/containerd/containerd/runtime"
"github.com/containerd/containerd/windows/hcsshimopts" "github.com/containerd/containerd/windows/hcsshimtypes"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
"github.com/gogo/protobuf/types" "github.com/gogo/protobuf/types"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
@ -399,12 +399,12 @@ func (t *task) cleanup() {
} }
// convertToProcessDetails converts a given hcsshim ProcessListItem to proto ProcessDetails // convertToProcessDetails converts a given hcsshim ProcessListItem to proto ProcessDetails
func (t *task) convertToProcessDetails(p hcsshim.ProcessListItem) (*hcsshimopts.ProcessDetails, error) { func (t *task) convertToProcessDetails(p hcsshim.ProcessListItem) (*hcsshimtypes.ProcessDetails, error) {
protobufTime, err := types.TimestampProto(p.CreateTimestamp) protobufTime, err := types.TimestampProto(p.CreateTimestamp)
if err != nil { if err != nil {
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "failed to convert timestamp for process pid: %d\n", p.ProcessId) return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "failed to convert timestamp for process pid: %d\n", p.ProcessId)
} }
return &hcsshimopts.ProcessDetails{ return &hcsshimtypes.ProcessDetails{
ImageName: p.ImageName, ImageName: p.ImageName,
CreatedAt: protobufTime, CreatedAt: protobufTime,
KernelTime_100Ns: p.KernelTime100ns, KernelTime_100Ns: p.KernelTime100ns,