Ejemplo n.º 1
0
// DecodeMsg implements msgp.Decodable
func (z *KVs) DecodeMsg(dc *msgp.Reader) (err error) {
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(KVs, xsz)
	}
	for cmr := range *z {
		var asz uint32
		asz, err = dc.ReadArrayHeader()
		if err != nil {
			return
		}
		if asz != 2 {
			err = msgp.ArrayError{Wanted: 2, Got: asz}
			return
		}
		for ajw := range (*z)[cmr] {
			{
				var tmp []byte
				tmp, err = dc.ReadBytes([]byte((*z)[cmr][ajw]))
				(*z)[cmr][ajw] = Binary(tmp)
			}
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 2
0
// DecodeMsg implements msgp.Decodable
func (z *MetricDataArray) DecodeMsg(dc *msgp.Reader) (err error) {
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(MetricDataArray, xsz)
	}
	for bai := range *z {
		if dc.IsNil() {
			err = dc.ReadNil()
			if err != nil {
				return
			}
			(*z)[bai] = nil
		} else {
			if (*z)[bai] == nil {
				(*z)[bai] = new(MetricData)
			}
			err = (*z)[bai].DecodeMsg(dc)
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 3
0
// DecodeMsg implements msgp.Decodable
func (z *Message) DecodeMsg(dc *msgp.Reader) (err error) {
	var ssz uint32
	ssz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if ssz != 4 {
		err = msgp.ArrayError{Wanted: 4, Got: ssz}
		return
	}
	z.Tag, err = dc.ReadString()
	if err != nil {
		return
	}
	z.Time, err = dc.ReadInt64()
	if err != nil {
		return
	}
	z.Record, err = dc.ReadIntf()
	if err != nil {
		return
	}
	z.Option, err = dc.ReadIntf()
	if err != nil {
		return
	}
	return
}
Ejemplo n.º 4
0
func (r *Request) DecodeMsg(mr *msgp.Reader) error {
	var bm msgp.Decodable

	if r.Body != nil {
		var ok bool
		bm, ok = r.Body.(msgp.Decodable)
		if !ok {
			return ErrNotDecodable
		}
	}

	if size, err := mr.ReadArrayHeader(); err != nil {
		return err
	} else if size != RequestPackSize {
		return ErrBadPackSize
	}

	if typ, err := mr.ReadInt(); err != nil {
		return err
	} else if typ != RequestType {
		return ErrBadMessageType
	}

	id, err := mr.ReadUint32()
	if err != nil {
		return err
	}

	r.ID = id

	method, err := mr.ReadString()
	if err != nil {
		return err
	}

	r.Method = method

	// The request body is packed in an array.
	l, err := mr.ReadArrayHeader()
	if err != nil {
		return err
	}

	if l > 1 {
		return ErrUnexpectedParams
	} else if l == 0 {
		return nil
	}

	r.hasBody = true

	// Skip decoding the body if no value is present to decode into.
	// The caller is expected to decode the body or skip it.
	if bm != nil {
		return decodeBody(mr, bm)
	}

	return nil
}
Ejemplo n.º 5
0
// DecodeMsg implements msgp.Decodable
func (z *Snap) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "LowestTrackableValue":
			z.LowestTrackableValue, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "HighestTrackableValue":
			z.HighestTrackableValue, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "SignificantFigures":
			z.SignificantFigures, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "Counts":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Counts) >= int(xsz) {
				z.Counts = z.Counts[:xsz]
			} else {
				z.Counts = make([]int64, xsz)
			}
			for xvk := range z.Counts {
				z.Counts[xvk], err = dc.ReadInt64()
				if err != nil {
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 6
0
func checkSize(num uint32, r *msgp.Reader) error {
	size, err := r.ReadArrayHeader()
	if err != nil {
		return err
	}

	if size != num {
		return ErrInvalidArgsNum
	}

	return nil
}
Ejemplo n.º 7
0
// DecodeMsg implements msgp.Decodable
func (z *InterfaceT) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zlqf uint32
	zlqf, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zlqf > 0 {
		zlqf--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "Methods":
			var zdaf uint32
			zdaf, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Methods) >= int(zdaf) {
				z.Methods = (z.Methods)[:zdaf]
			} else {
				z.Methods = make([]MethodT, zdaf)
			}
			for zxhx := range z.Methods {
				err = z.Methods[zxhx].DecodeMsg(dc)
				if err != nil {
					return
				}
			}
		case "Deprecated":
			z.Deprecated, err = dc.ReadBool()
			if err != nil {
				return
			}
		case "Comment":
			z.Comment, err = dc.ReadString()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 8
0
// DecodeMsg implements msgp.Decodable
func (z *bitmapContainer) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zbzg uint32
	zbzg, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zbzg > 0 {
		zbzg--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "cardinality":
			z.cardinality, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "bitmap":
			var zbai uint32
			zbai, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.bitmap) >= int(zbai) {
				z.bitmap = (z.bitmap)[:zbai]
			} else {
				z.bitmap = make([]uint64, zbai)
			}
			for zxvk := range z.bitmap {
				z.bitmap[zxvk], err = dc.ReadUint64()
				if err != nil {
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 9
0
// DecodeMsg implements msgp.Decodable
func (z *uint32Slice) DecodeMsg(dc *msgp.Reader) (err error) {
	var zjpj uint32
	zjpj, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap((*z)) >= int(zjpj) {
		(*z) = (*z)[:zjpj]
	} else {
		(*z) = make(uint32Slice, zjpj)
	}
	for zywj := range *z {
		(*z)[zywj], err = dc.ReadUint32()
		if err != nil {
			return
		}
	}
	return
}
Ejemplo n.º 10
0
// DecodeMsg implements msgp.Decodable
func (z *Entry) DecodeMsg(dc *msgp.Reader) (err error) {
	var ssz uint32
	ssz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if ssz != 2 {
		err = msgp.ArrayError{Wanted: 2, Got: ssz}
		return
	}
	z.Time, err = dc.ReadInt64()
	if err != nil {
		return
	}
	z.Record, err = dc.ReadIntf()
	if err != nil {
		return
	}
	return
}
Ejemplo n.º 11
0
func (h *ConnectionHandler) next(r *msgp.Reader) (hasHeaders bool, channel uint64, c uint64, err error) {
	var sz uint32
	sz, err = r.ReadArrayHeader()
	if err != nil {
		return
	}
	hasHeaders = sz == 4

	channel, err = r.ReadUint64()
	if err != nil {
		return
	}

	c, err = r.ReadUint64()
	if err != nil {
		return
	}

	return
}
Ejemplo n.º 12
0
// DecodeMsg implements msgp.Decodable
func (z *arrayContainer) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zbzg uint32
	zbzg, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zbzg > 0 {
		zbzg--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "content":
			var zbai uint32
			zbai, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.content) >= int(zbai) {
				z.content = (z.content)[:zbai]
			} else {
				z.content = make([]uint16, zbai)
			}
			for zxvk := range z.content {
				z.content[zxvk], err = dc.ReadUint16()
				if err != nil {
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 13
0
// DecodeMsg implements msgp.Decodable
func (z *KV) DecodeMsg(dc *msgp.Reader) (err error) {
	var asz uint32
	asz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if asz != 2 {
		err = msgp.ArrayError{Wanted: 2, Got: asz}
		return
	}
	for xvk := range z {
		{
			var tmp []byte
			tmp, err = dc.ReadBytes([]byte(z[xvk]))
			z[xvk] = Binary(tmp)
		}
		if err != nil {
			return
		}
	}
	return
}
Ejemplo n.º 14
0
// DecodeMsg implements msgp.Decodable
func (z *Ks) DecodeMsg(dc *msgp.Reader) (err error) {
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(Ks, xsz)
	}
	for jfb := range *z {
		{
			var tmp []byte
			tmp, err = dc.ReadBytes([]byte((*z)[jfb]))
			(*z)[jfb] = Binary(tmp)
		}
		if err != nil {
			return
		}
	}
	return
}
// DecodeMsg implements msgp.Decodable
func (z *DocumentList) DecodeMsg(dc *msgp.Reader) (err error) {
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(DocumentList, xsz)
	}
	for bzg := range *z {
		{
			var tmp uint
			tmp, err = dc.ReadUint()
			(*z)[bzg] = DocumentID(tmp)
		}
		if err != nil {
			return
		}
	}
	return
}
Ejemplo n.º 16
0
// DecodeMsg implements msgp.Decodable
func (z *Forward) DecodeMsg(dc *msgp.Reader) (err error) {
	var ssz uint32
	ssz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if ssz != 3 {
		err = msgp.ArrayError{Wanted: 3, Got: ssz}
		return
	}
	z.Tag, err = dc.ReadString()
	if err != nil {
		return
	}
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap(z.Entries) >= int(xsz) {
		z.Entries = z.Entries[:xsz]
	} else {
		z.Entries = make([]Entry, xsz)
	}
	for xvk := range z.Entries {
		var ssz uint32
		ssz, err = dc.ReadArrayHeader()
		if err != nil {
			return
		}
		if ssz != 2 {
			err = msgp.ArrayError{Wanted: 2, Got: ssz}
			return
		}
		z.Entries[xvk].Time, err = dc.ReadInt64()
		if err != nil {
			return
		}
		z.Entries[xvk].Record, err = dc.ReadIntf()
		if err != nil {
			return
		}
	}
	z.Option, err = dc.ReadIntf()
	if err != nil {
		return
	}
	return
}
Ejemplo n.º 17
0
// DecodeMsg implements msgp.Decodable
func (z *Group) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "Name":
			z.Name, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Members":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Members) >= int(xsz) {
				z.Members = z.Members[:xsz]
			} else {
				z.Members = make([]Person, xsz)
			}
			for xvk := range z.Members {
				var isz uint32
				isz, err = dc.ReadMapHeader()
				if err != nil {
					return
				}
				for isz > 0 {
					isz--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						return
					}
					switch msgp.UnsafeString(field) {
					case "Name":
						z.Members[xvk].Name, err = dc.ReadString()
						if err != nil {
							return
						}
					case "Age":
						z.Members[xvk].Age, err = dc.ReadUint8()
						if err != nil {
							return
						}
					case "Height":
						z.Members[xvk].Height, err = dc.ReadFloat64()
						if err != nil {
							return
						}
					default:
						err = dc.Skip()
						if err != nil {
							return
						}
					}
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 18
0
// DecodeMsg implements msgp.Decodable
func (z *ServerResponse) DecodeMsg(dc *msgp.Reader) (err error) {
	{
		var ssz uint32
		ssz, err = dc.ReadArrayHeader()
		if err != nil {
			return
		}
		if ssz != 3 {
			err = msgp.ArrayError{Wanted: 3, Got: ssz}
			return
		}
	}
	if dc.IsNil() {
		err = dc.ReadNil()
		if err != nil {
			return
		}
		z.Header = nil
	} else {
		if z.Header == nil {
			z.Header = new(EventHeader)
		}
		var field []byte
		_ = field
		var isz uint32
		isz, err = dc.ReadMapHeader()
		if err != nil {
			return
		}
		for isz > 0 {
			isz--
			field, err = dc.ReadMapKeyPtr()
			if err != nil {
				return
			}
			switch msgp.UnsafeString(field) {
			case "message_id":
				z.Header.Id, err = dc.ReadString()
				if err != nil {
					return
				}
			case "v":
				z.Header.Version, err = dc.ReadInt()
				if err != nil {
					return
				}
			case "response_to":
				z.Header.ResponseTo, err = dc.ReadString()
				if err != nil {
					return
				}
			default:
				err = dc.Skip()
				if err != nil {
					return
				}
			}
		}
	}
	z.Name, err = dc.ReadString()
	if err != nil {
		return
	}
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap(z.Params) >= int(xsz) {
		z.Params = z.Params[:xsz]
	} else {
		z.Params = make([]interface{}, xsz)
	}
	for bzg := range z.Params {
		z.Params[bzg], err = dc.ReadIntf()
		if err != nil {
			return
		}
	}
	return
}
Ejemplo n.º 19
0
// DecodeMsg implements msgp.Decodable
func (z *Event) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "id":
			z.Id, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "user":
			var isz uint32
			isz, err = dc.ReadMapHeader()
			if err != nil {
				return
			}
			for isz > 0 {
				isz--
				field, err = dc.ReadMapKeyPtr()
				if err != nil {
					return
				}
				switch msgp.UnsafeString(field) {
				case "first":
					z.User.First, err = dc.ReadString()
					if err != nil {
						return
					}
				case "last":
					z.User.Last, err = dc.ReadString()
					if err != nil {
						return
					}
				default:
					err = dc.Skip()
					if err != nil {
						return
					}
				}
			}
		case "flight":
			z.Flight, err = dc.ReadString()
			if err != nil {
				return
			}
		case "pilot":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Pilot) >= int(xsz) {
				z.Pilot = z.Pilot[:xsz]
			} else {
				z.Pilot = make([]string, xsz)
			}
			for xvk := range z.Pilot {
				z.Pilot[xvk], err = dc.ReadString()
				if err != nil {
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 20
0
// DecodeMsg implements msgp.Decodable
func (z *MetricDefinition) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "Id":
			z.Id, err = dc.ReadString()
			if err != nil {
				return
			}
		case "OrgId":
			z.OrgId, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "Name":
			z.Name, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Metric":
			z.Metric, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Interval":
			z.Interval, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "Unit":
			z.Unit, err = dc.ReadString()
			if err != nil {
				return
			}
		case "TargetType":
			z.TargetType, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Tags":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Tags) >= int(xsz) {
				z.Tags = z.Tags[:xsz]
			} else {
				z.Tags = make([]string, xsz)
			}
			for hct := range z.Tags {
				z.Tags[hct], err = dc.ReadString()
				if err != nil {
					return
				}
			}
		case "LastUpdate":
			z.LastUpdate, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "Nodes":
			var msz uint32
			msz, err = dc.ReadMapHeader()
			if err != nil {
				return
			}
			if z.Nodes == nil && msz > 0 {
				z.Nodes = make(map[string]string, msz)
			} else if len(z.Nodes) > 0 {
				for key, _ := range z.Nodes {
					delete(z.Nodes, key)
				}
			}
			for msz > 0 {
				msz--
				var cua string
				var xhx string
				cua, err = dc.ReadString()
				if err != nil {
					return
				}
				xhx, err = dc.ReadString()
				if err != nil {
					return
				}
				z.Nodes[cua] = xhx
			}
		case "NodeCount":
			z.NodeCount, err = dc.ReadInt()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 21
0
// DecodeMsg implements msgp.Decodable
func (z *roaringArray) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zlqf uint32
	zlqf, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zlqf > 0 {
		zlqf--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "keys":
			var zdaf uint32
			zdaf, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.keys) >= int(zdaf) {
				z.keys = (z.keys)[:zdaf]
			} else {
				z.keys = make([]uint16, zdaf)
			}
			for zhct := range z.keys {
				z.keys[zhct], err = dc.ReadUint16()
				if err != nil {
					return
				}
			}
		case "needCopyOnWrite":
			var zpks uint32
			zpks, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.needCopyOnWrite) >= int(zpks) {
				z.needCopyOnWrite = (z.needCopyOnWrite)[:zpks]
			} else {
				z.needCopyOnWrite = make([]bool, zpks)
			}
			for zcua := range z.needCopyOnWrite {
				z.needCopyOnWrite[zcua], err = dc.ReadBool()
				if err != nil {
					return
				}
			}
		case "copyOnWrite":
			z.copyOnWrite, err = dc.ReadBool()
			if err != nil {
				return
			}
		case "conserz":
			var zjfb uint32
			zjfb, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.conserz) >= int(zjfb) {
				z.conserz = (z.conserz)[:zjfb]
			} else {
				z.conserz = make([]containerSerz, zjfb)
			}
			for zxhx := range z.conserz {
				var zcxo uint32
				zcxo, err = dc.ReadMapHeader()
				if err != nil {
					return
				}
				for zcxo > 0 {
					zcxo--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						return
					}
					switch msgp.UnsafeString(field) {
					case "t":
						{
							var zeff uint8
							zeff, err = dc.ReadUint8()
							z.conserz[zxhx].t = contype(zeff)
						}
						if err != nil {
							return
						}
					case "r":
						err = z.conserz[zxhx].r.DecodeMsg(dc)
						if err != nil {
							return
						}
					default:
						err = dc.Skip()
						if err != nil {
							return
						}
					}
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 22
0
// DecodeMsg implements msgp.Decodable
func (z *MetricData) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "OrgId":
			z.OrgId, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "Name":
			z.Name, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Metric":
			z.Metric, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Interval":
			z.Interval, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "Value":
			z.Value, err = dc.ReadFloat64()
			if err != nil {
				return
			}
		case "Unit":
			z.Unit, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Time":
			z.Time, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "TargetType":
			z.TargetType, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Tags":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Tags) >= int(xsz) {
				z.Tags = z.Tags[:xsz]
			} else {
				z.Tags = make([]string, xsz)
			}
			for xvk := range z.Tags {
				z.Tags[xvk], err = dc.ReadString()
				if err != nil {
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 23
0
// DecodeMsg implements msgp.Decodable
func (z *Car) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var wht uint32
	wht, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for wht > 0 {
		wht--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "CarId":
			z.CarId, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "CarName":
			z.CarName, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Attributes":
			var hct uint32
			hct, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Attributes) >= int(hct) {
				z.Attributes = z.Attributes[:hct]
			} else {
				z.Attributes = make([]Attribute, hct)
			}
			for bai := range z.Attributes {
				var cua uint32
				cua, err = dc.ReadMapHeader()
				if err != nil {
					return
				}
				for cua > 0 {
					cua--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						return
					}
					switch msgp.UnsafeString(field) {
					case "Id":
						z.Attributes[bai].Id, err = dc.ReadInt()
						if err != nil {
							return
						}
					case "Name":
						z.Attributes[bai].Name, err = dc.ReadString()
						if err != nil {
							return
						}
					case "Value":
						z.Attributes[bai].Value, err = dc.ReadString()
						if err != nil {
							return
						}
					default:
						err = dc.Skip()
						if err != nil {
							return
						}
					}
				}
			}
		case "FlagMap":
			var xhx uint32
			xhx, err = dc.ReadMapHeader()
			if err != nil {
				return
			}
			if z.FlagMap == nil && xhx > 0 {
				z.FlagMap = make(map[string]string, xhx)
			} else if len(z.FlagMap) > 0 {
				for key, _ := range z.FlagMap {
					delete(z.FlagMap, key)
				}
			}
			for xhx > 0 {
				xhx--
				var cmr string
				var ajw string
				cmr, err = dc.ReadString()
				if err != nil {
					return
				}
				ajw, err = dc.ReadString()
				if err != nil {
					return
				}
				z.FlagMap[cmr] = ajw
			}
		case "Ttl":
			z.Ttl, err = dc.ReadInt()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 24
0
// DecodeMsg implements msgp.Decodable
func (z *SchemaT) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zdnj uint32
	zdnj, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zdnj > 0 {
		zdnj--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "PkgPath":
			z.PkgPath, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Structs":
			var zobc uint32
			zobc, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Structs) >= int(zobc) {
				z.Structs = (z.Structs)[:zobc]
			} else {
				z.Structs = make([]StructT, zobc)
			}
			for zrsw := range z.Structs {
				err = z.Structs[zrsw].DecodeMsg(dc)
				if err != nil {
					return
				}
			}
		case "Interfaces":
			var zsnv uint32
			zsnv, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Interfaces) >= int(zsnv) {
				z.Interfaces = (z.Interfaces)[:zsnv]
			} else {
				z.Interfaces = make([]InterfaceT, zsnv)
			}
			for zxpk := range z.Interfaces {
				err = z.Interfaces[zxpk].DecodeMsg(dc)
				if err != nil {
					return
				}
			}
		case "Deprecated":
			z.Deprecated, err = dc.ReadBool()
			if err != nil {
				return
			}
		case "Comment":
			z.Comment, err = dc.ReadString()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 25
0
// DecodeMsg implements msgp.Decodable
func (z *bitmapContainerShortIterator) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zhct uint32
	zhct, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zhct > 0 {
		zhct--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "ptr":
			if dc.IsNil() {
				err = dc.ReadNil()
				if err != nil {
					return
				}
				z.ptr = nil
			} else {
				if z.ptr == nil {
					z.ptr = new(bitmapContainer)
				}
				var zcua uint32
				zcua, err = dc.ReadMapHeader()
				if err != nil {
					return
				}
				for zcua > 0 {
					zcua--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						return
					}
					switch msgp.UnsafeString(field) {
					case "cardinality":
						z.ptr.cardinality, err = dc.ReadInt()
						if err != nil {
							return
						}
					case "bitmap":
						var zxhx uint32
						zxhx, err = dc.ReadArrayHeader()
						if err != nil {
							return
						}
						if cap(z.ptr.bitmap) >= int(zxhx) {
							z.ptr.bitmap = (z.ptr.bitmap)[:zxhx]
						} else {
							z.ptr.bitmap = make([]uint64, zxhx)
						}
						for zwht := range z.ptr.bitmap {
							z.ptr.bitmap[zwht], err = dc.ReadUint64()
							if err != nil {
								return
							}
						}
					default:
						err = dc.Skip()
						if err != nil {
							return
						}
					}
				}
			}
		case "i":
			z.i, err = dc.ReadInt()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 26
0
func (r *Response) DecodeMsg(mr *msgp.Reader) error {
	var bm msgp.Decodable

	if r.Body != nil {
		var ok bool
		bm, ok = r.Body.(msgp.Decodable)
		if !ok {
			return ErrNotDecodable
		}
	}

	if size, err := mr.ReadArrayHeader(); err != nil {
		return err
	} else if size != ResponsePackSize {
		return ErrBadPackSize
	}

	if typ, err := mr.ReadInt(); err != nil {
		return err
	} else if typ != ResponseType {
		return ErrBadMessageType
	}

	id, err := mr.ReadUint32()
	if err != nil {
		return err
	}

	r.ID = id

	// Error can be nil or a string.
	typ, err := mr.NextType()
	if err != nil {
		return err
	}

	switch typ {
	case msgp.StrType:
		s, err := mr.ReadString()
		if err != nil {
			return err
		}
		r.Error = s

	case msgp.NilType:
		if err := mr.ReadNil(); err != nil {
			return err
		}
		r.Error = ""

	default:
		return ErrBadErrorType
	}

	// Body can be nil.
	typ, err = mr.NextType()
	if err != nil {
		return err
	}

	if typ == msgp.NilType {
		r.hasBody = false
		return mr.ReadNil()
	}

	r.hasBody = true

	// Skip decoding the body if no value is present to decode into.
	// The caller is expected to read the body or skip it.
	if bm != nil {
		return decodeBody(mr, bm)
	}

	return nil

}
Ejemplo n.º 27
0
// DecodeMsg implements msgp.Decodable
func (z *StructT) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zywj uint32
	zywj, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zywj > 0 {
		zywj--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "StructId":
			z.StructId, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "StructName":
			z.StructName, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Fields":
			var zjpj uint32
			zjpj, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.Fields) >= int(zjpj) {
				z.Fields = (z.Fields)[:zjpj]
			} else {
				z.Fields = make([]FieldT, zjpj)
			}
			for zyzr := range z.Fields {
				err = z.Fields[zyzr].DecodeMsg(dc)
				if err != nil {
					return
				}
			}
		case "Deprecated":
			z.Deprecated, err = dc.ReadBool()
			if err != nil {
				return
			}
		case "Comment":
			z.Comment, err = dc.ReadString()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 28
0
// DecodeMsg implements msgp.Decodable
func (z *addHelper32) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zbai uint32
	zbai, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zbai > 0 {
		zbai--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "runstart":
			z.runstart, err = dc.ReadUint32()
			if err != nil {
				return
			}
		case "runlen":
			z.runlen, err = dc.ReadUint32()
			if err != nil {
				return
			}
		case "actuallyAdded":
			z.actuallyAdded, err = dc.ReadUint32()
			if err != nil {
				return
			}
		case "m":
			var zcmr uint32
			zcmr, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.m) >= int(zcmr) {
				z.m = (z.m)[:zcmr]
			} else {
				z.m = make([]interval32, zcmr)
			}
			for zxvk := range z.m {
				var zajw uint32
				zajw, err = dc.ReadMapHeader()
				if err != nil {
					return
				}
				for zajw > 0 {
					zajw--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						return
					}
					switch msgp.UnsafeString(field) {
					case "start":
						z.m[zxvk].start, err = dc.ReadUint32()
						if err != nil {
							return
						}
					case "last":
						z.m[zxvk].last, err = dc.ReadUint32()
						if err != nil {
							return
						}
					default:
						err = dc.Skip()
						if err != nil {
							return
						}
					}
				}
			}
		case "rc":
			if dc.IsNil() {
				err = dc.ReadNil()
				if err != nil {
					return
				}
				z.rc = nil
			} else {
				if z.rc == nil {
					z.rc = new(runContainer32)
				}
				var zwht uint32
				zwht, err = dc.ReadMapHeader()
				if err != nil {
					return
				}
				for zwht > 0 {
					zwht--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						return
					}
					switch msgp.UnsafeString(field) {
					case "iv":
						var zhct uint32
						zhct, err = dc.ReadArrayHeader()
						if err != nil {
							return
						}
						if cap(z.rc.iv) >= int(zhct) {
							z.rc.iv = (z.rc.iv)[:zhct]
						} else {
							z.rc.iv = make([]interval32, zhct)
						}
						for zbzg := range z.rc.iv {
							var zcua uint32
							zcua, err = dc.ReadMapHeader()
							if err != nil {
								return
							}
							for zcua > 0 {
								zcua--
								field, err = dc.ReadMapKeyPtr()
								if err != nil {
									return
								}
								switch msgp.UnsafeString(field) {
								case "start":
									z.rc.iv[zbzg].start, err = dc.ReadUint32()
									if err != nil {
										return
									}
								case "last":
									z.rc.iv[zbzg].last, err = dc.ReadUint32()
									if err != nil {
										return
									}
								default:
									err = dc.Skip()
									if err != nil {
										return
									}
								}
							}
						}
					case "card":
						z.rc.card, err = dc.ReadInt64()
						if err != nil {
							return
						}
					default:
						err = dc.Skip()
						if err != nil {
							return
						}
					}
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
Ejemplo n.º 29
0
// DecodeMsg implements msgp.Decodable
func (z *runContainer32) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zdnj uint32
	zdnj, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for zdnj > 0 {
		zdnj--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "iv":
			var zobc uint32
			zobc, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.iv) >= int(zobc) {
				z.iv = (z.iv)[:zobc]
			} else {
				z.iv = make([]interval32, zobc)
			}
			for zxpk := range z.iv {
				var zsnv uint32
				zsnv, err = dc.ReadMapHeader()
				if err != nil {
					return
				}
				for zsnv > 0 {
					zsnv--
					field, err = dc.ReadMapKeyPtr()
					if err != nil {
						return
					}
					switch msgp.UnsafeString(field) {
					case "start":
						z.iv[zxpk].start, err = dc.ReadUint32()
						if err != nil {
							return
						}
					case "last":
						z.iv[zxpk].last, err = dc.ReadUint32()
						if err != nil {
							return
						}
					default:
						err = dc.Skip()
						if err != nil {
							return
						}
					}
				}
			}
		case "card":
			z.card, err = dc.ReadInt64()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}