summaryrefslogtreecommitdiff
path: root/libpod/pod_easyjson.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-08-22 09:12:40 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-24 19:19:43 +0000
commit714dbbda9e1f3ec98d75a07ed4c5442ea6540680 (patch)
tree286da76261791b375441a6d3999f1348c7d1e66e /libpod/pod_easyjson.go
parentbd080b45305a311542527443e9108c1cfdff3c93 (diff)
downloadpodman-714dbbda9e1f3ec98d75a07ed4c5442ea6540680.tar.gz
podman-714dbbda9e1f3ec98d75a07ed4c5442ea6540680.tar.bz2
podman-714dbbda9e1f3ec98d75a07ed4c5442ea6540680.zip
Swap from FFJSON to easyjson
FFJSON has serialization differences versus stock Go - namely, it does not respect the MarshalText() and UnmarshalText() methods, particularly on []byte, which causes incompatability with pre-FFJSON containers which contained DNS servers. EasyJSON does not have these issues, and might even be slightly faster. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #1322 Approved by: mheon
Diffstat (limited to 'libpod/pod_easyjson.go')
-rw-r--r--libpod/pod_easyjson.go574
1 files changed, 574 insertions, 0 deletions
diff --git a/libpod/pod_easyjson.go b/libpod/pod_easyjson.go
new file mode 100644
index 000000000..1074d4e35
--- /dev/null
+++ b/libpod/pod_easyjson.go
@@ -0,0 +1,574 @@
+// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
+
+package libpod
+
+import (
+ json "encoding/json"
+ 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())
+ 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))
+ }
+ 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())
+ 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))
+ }
+ 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)
+ }
+ (*out.Config).UnmarshalEasyJSON(in)
+ }
+ case "State":
+ if in.IsNull() {
+ in.Skip()
+ out.State = nil
+ } else {
+ if out.State == nil {
+ out.State = new(PodInspectState)
+ }
+ (*out.State).UnmarshalEasyJSON(in)
+ }
+ 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
+ (v1).UnmarshalEasyJSON(in)
+ 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 {
+ (*in.Config).MarshalEasyJSON(out)
+ }
+ }
+ {
+ const prefix string = ",\"State\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ if in.State == nil {
+ out.RawString("null")
+ } else {
+ (*in.State).MarshalEasyJSON(out)
+ }
+ }
+ {
+ 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(',')
+ }
+ (v3).MarshalEasyJSON(out)
+ }
+ 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 "usePodCgroup":
+ out.UsePodCgroup = bool(in.Bool())
+ case "created":
+ if data := in.Raw(); in.Ok() {
+ in.AddError((out.CreatedTime).UnmarshalJSON(data))
+ }
+ 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))
+ }
+ {
+ const prefix string = ",\"usePodCgroup\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.Bool(bool(in.UsePodCgroup))
+ }
+ {
+ const prefix string = ",\"created\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.Raw((in.CreatedTime).MarshalJSON())
+ }
+ 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)
+}