From 07f3b147f1619b234cad0fda3d7556c1f05e7f11 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 8 Jan 2019 13:47:51 -0500 Subject: Remove easyjson in preparation for switch to jsoniter The jsoniter library does not require code generation, which is a massive advantage over easyjson (it's also about the same in performance). Begin moving over to it by removing the existing easyjson code. Signed-off-by: Matthew Heon --- libpod/pod_easyjson.go | 889 ------------------------------------------------- 1 file changed, 889 deletions(-) delete mode 100644 libpod/pod_easyjson.go (limited to 'libpod/pod_easyjson.go') diff --git a/libpod/pod_easyjson.go b/libpod/pod_easyjson.go deleted file mode 100644 index 71862dad0..000000000 --- a/libpod/pod_easyjson.go +++ /dev/null @@ -1,889 +0,0 @@ -// +build seccomp ostree selinux varlink exclude_graphdriver_devicemapper - -// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. - -package libpod - -import ( - json "encoding/json" - ocicni "github.com/cri-o/ocicni/pkg/ocicni" - easyjson "github.com/mailru/easyjson" - jlexer "github.com/mailru/easyjson/jlexer" - jwriter "github.com/mailru/easyjson/jwriter" -) - -// suppress unused package warning -var ( - _ *json.RawMessage - _ *jlexer.Lexer - _ *jwriter.Writer - _ easyjson.Marshaler -) - -func easyjsonBe091417DecodeGithubComContainersLibpodLibpod(in *jlexer.Lexer, out *podState) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "cgroupPath": - out.CgroupPath = string(in.String()) - case "InfraContainerID": - out.InfraContainerID = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonBe091417EncodeGithubComContainersLibpodLibpod(out *jwriter.Writer, in podState) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"cgroupPath\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.CgroupPath)) - } - { - const prefix string = ",\"InfraContainerID\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.InfraContainerID)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v podState) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonBe091417EncodeGithubComContainersLibpodLibpod(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v podState) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonBe091417EncodeGithubComContainersLibpodLibpod(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *podState) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonBe091417DecodeGithubComContainersLibpodLibpod(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *podState) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonBe091417DecodeGithubComContainersLibpodLibpod(l, v) -} -func easyjsonBe091417DecodeGithubComContainersLibpodLibpod1(in *jlexer.Lexer, out *PodInspectState) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "cgroupPath": - out.CgroupPath = string(in.String()) - case "infraContainerID": - out.InfraContainerID = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonBe091417EncodeGithubComContainersLibpodLibpod1(out *jwriter.Writer, in PodInspectState) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"cgroupPath\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.CgroupPath)) - } - { - const prefix string = ",\"infraContainerID\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.InfraContainerID)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v PodInspectState) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonBe091417EncodeGithubComContainersLibpodLibpod1(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v PodInspectState) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonBe091417EncodeGithubComContainersLibpodLibpod1(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *PodInspectState) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonBe091417DecodeGithubComContainersLibpodLibpod1(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *PodInspectState) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonBe091417DecodeGithubComContainersLibpodLibpod1(l, v) -} -func easyjsonBe091417DecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *PodInspect) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "Config": - if in.IsNull() { - in.Skip() - out.Config = nil - } else { - if out.Config == nil { - out.Config = new(PodConfig) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.Config).UnmarshalJSON(data)) - } - } - case "State": - if in.IsNull() { - in.Skip() - out.State = nil - } else { - if out.State == nil { - out.State = new(PodInspectState) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.State).UnmarshalJSON(data)) - } - } - case "Containers": - if in.IsNull() { - in.Skip() - out.Containers = nil - } else { - in.Delim('[') - if out.Containers == nil { - if !in.IsDelim(']') { - out.Containers = make([]PodContainerInfo, 0, 2) - } else { - out.Containers = []PodContainerInfo{} - } - } else { - out.Containers = (out.Containers)[:0] - } - for !in.IsDelim(']') { - var v1 PodContainerInfo - if data := in.Raw(); in.Ok() { - in.AddError((v1).UnmarshalJSON(data)) - } - out.Containers = append(out.Containers, v1) - in.WantComma() - } - in.Delim(']') - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonBe091417EncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in PodInspect) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"Config\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.Config == nil { - out.RawString("null") - } else { - out.Raw((*in.Config).MarshalJSON()) - } - } - { - const prefix string = ",\"State\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.State == nil { - out.RawString("null") - } else { - out.Raw((*in.State).MarshalJSON()) - } - } - { - const prefix string = ",\"Containers\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.Containers == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v2, v3 := range in.Containers { - if v2 > 0 { - out.RawByte(',') - } - out.Raw((v3).MarshalJSON()) - } - out.RawByte(']') - } - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v PodInspect) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonBe091417EncodeGithubComContainersLibpodLibpod2(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v PodInspect) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonBe091417EncodeGithubComContainersLibpodLibpod2(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *PodInspect) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonBe091417DecodeGithubComContainersLibpodLibpod2(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *PodInspect) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonBe091417DecodeGithubComContainersLibpodLibpod2(l, v) -} -func easyjsonBe091417DecodeGithubComContainersLibpodLibpod3(in *jlexer.Lexer, out *PodContainerInfo) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "state": - out.State = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonBe091417EncodeGithubComContainersLibpodLibpod3(out *jwriter.Writer, in PodContainerInfo) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ID)) - } - { - const prefix string = ",\"state\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.State)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v PodContainerInfo) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonBe091417EncodeGithubComContainersLibpodLibpod3(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v PodContainerInfo) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonBe091417EncodeGithubComContainersLibpodLibpod3(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *PodContainerInfo) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonBe091417DecodeGithubComContainersLibpodLibpod3(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *PodContainerInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonBe091417DecodeGithubComContainersLibpodLibpod3(l, v) -} -func easyjsonBe091417DecodeGithubComContainersLibpodLibpod4(in *jlexer.Lexer, out *PodConfig) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "namespace": - out.Namespace = string(in.String()) - case "labels": - if in.IsNull() { - in.Skip() - } else { - in.Delim('{') - if !in.IsDelim('}') { - out.Labels = make(map[string]string) - } else { - out.Labels = nil - } - for !in.IsDelim('}') { - key := string(in.String()) - in.WantColon() - var v4 string - v4 = string(in.String()) - (out.Labels)[key] = v4 - in.WantComma() - } - in.Delim('}') - } - case "cgroupParent": - out.CgroupParent = string(in.String()) - case "sharesCgroup": - out.UsePodCgroup = bool(in.Bool()) - case "sharesPid": - out.UsePodPID = bool(in.Bool()) - case "sharesIpc": - out.UsePodIPC = bool(in.Bool()) - case "sharesNet": - out.UsePodNet = bool(in.Bool()) - case "sharesMnt": - out.UsePodMount = bool(in.Bool()) - case "sharesUser": - out.UsePodUser = bool(in.Bool()) - case "sharesUts": - out.UsePodUTS = bool(in.Bool()) - case "infraConfig": - if in.IsNull() { - in.Skip() - out.InfraContainer = nil - } else { - if out.InfraContainer == nil { - out.InfraContainer = new(InfraContainerConfig) - } - easyjsonBe091417DecodeGithubComContainersLibpodLibpod5(in, &*out.InfraContainer) - } - case "created": - if data := in.Raw(); in.Ok() { - in.AddError((out.CreatedTime).UnmarshalJSON(data)) - } - case "lockID": - out.LockID = uint32(in.Uint32()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonBe091417EncodeGithubComContainersLibpodLibpod4(out *jwriter.Writer, in PodConfig) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ID)) - } - { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Namespace != "" { - const prefix string = ",\"namespace\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Namespace)) - } - { - const prefix string = ",\"labels\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.Labels == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { - out.RawString(`null`) - } else { - out.RawByte('{') - v5First := true - for v5Name, v5Value := range in.Labels { - if v5First { - v5First = false - } else { - out.RawByte(',') - } - out.String(string(v5Name)) - out.RawByte(':') - out.String(string(v5Value)) - } - out.RawByte('}') - } - } - { - const prefix string = ",\"cgroupParent\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.CgroupParent)) - } - if in.UsePodCgroup { - const prefix string = ",\"sharesCgroup\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.UsePodCgroup)) - } - if in.UsePodPID { - const prefix string = ",\"sharesPid\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.UsePodPID)) - } - if in.UsePodIPC { - const prefix string = ",\"sharesIpc\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.UsePodIPC)) - } - if in.UsePodNet { - const prefix string = ",\"sharesNet\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.UsePodNet)) - } - if in.UsePodMount { - const prefix string = ",\"sharesMnt\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.UsePodMount)) - } - if in.UsePodUser { - const prefix string = ",\"sharesUser\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.UsePodUser)) - } - if in.UsePodUTS { - const prefix string = ",\"sharesUts\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.UsePodUTS)) - } - { - const prefix string = ",\"infraConfig\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.InfraContainer == nil { - out.RawString("null") - } else { - easyjsonBe091417EncodeGithubComContainersLibpodLibpod5(out, *in.InfraContainer) - } - } - { - const prefix string = ",\"created\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.CreatedTime).MarshalJSON()) - } - { - const prefix string = ",\"lockID\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint32(uint32(in.LockID)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v PodConfig) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonBe091417EncodeGithubComContainersLibpodLibpod4(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v PodConfig) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonBe091417EncodeGithubComContainersLibpodLibpod4(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *PodConfig) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonBe091417DecodeGithubComContainersLibpodLibpod4(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *PodConfig) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonBe091417DecodeGithubComContainersLibpodLibpod4(l, v) -} -func easyjsonBe091417DecodeGithubComContainersLibpodLibpod5(in *jlexer.Lexer, out *InfraContainerConfig) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "makeInfraContainer": - out.HasInfraContainer = bool(in.Bool()) - case "infraPortBindings": - if in.IsNull() { - in.Skip() - out.PortBindings = nil - } else { - in.Delim('[') - if out.PortBindings == nil { - if !in.IsDelim(']') { - out.PortBindings = make([]ocicni.PortMapping, 0, 1) - } else { - out.PortBindings = []ocicni.PortMapping{} - } - } else { - out.PortBindings = (out.PortBindings)[:0] - } - for !in.IsDelim(']') { - var v6 ocicni.PortMapping - easyjsonBe091417DecodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(in, &v6) - out.PortBindings = append(out.PortBindings, v6) - in.WantComma() - } - in.Delim(']') - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonBe091417EncodeGithubComContainersLibpodLibpod5(out *jwriter.Writer, in InfraContainerConfig) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"makeInfraContainer\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Bool(bool(in.HasInfraContainer)) - } - { - const prefix string = ",\"infraPortBindings\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.PortBindings == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v7, v8 := range in.PortBindings { - if v7 > 0 { - out.RawByte(',') - } - easyjsonBe091417EncodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(out, v8) - } - out.RawByte(']') - } - } - out.RawByte('}') -} -func easyjsonBe091417DecodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(in *jlexer.Lexer, out *ocicni.PortMapping) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "hostPort": - out.HostPort = int32(in.Int32()) - case "containerPort": - out.ContainerPort = int32(in.Int32()) - case "protocol": - out.Protocol = string(in.String()) - case "hostIP": - out.HostIP = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonBe091417EncodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(out *jwriter.Writer, in ocicni.PortMapping) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"hostPort\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int32(int32(in.HostPort)) - } - { - const prefix string = ",\"containerPort\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int32(int32(in.ContainerPort)) - } - { - const prefix string = ",\"protocol\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Protocol)) - } - { - const prefix string = ",\"hostIP\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.HostIP)) - } - out.RawByte('}') -} -- cgit v1.2.3-54-g00ecf