Esempio n. 1
0
// MarshalMsg implements msgp.Marshaler
func (z *MetricData) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 9
	// string "OrgId"
	o = append(o, 0x89, 0xa5, 0x4f, 0x72, 0x67, 0x49, 0x64)
	o = msgp.AppendInt(o, z.OrgId)
	// string "Name"
	o = append(o, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "Metric"
	o = append(o, 0xa6, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63)
	o = msgp.AppendString(o, z.Metric)
	// string "Interval"
	o = append(o, 0xa8, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c)
	o = msgp.AppendInt(o, z.Interval)
	// string "Value"
	o = append(o, 0xa5, 0x56, 0x61, 0x6c, 0x75, 0x65)
	o = msgp.AppendFloat64(o, z.Value)
	// string "Unit"
	o = append(o, 0xa4, 0x55, 0x6e, 0x69, 0x74)
	o = msgp.AppendString(o, z.Unit)
	// string "Time"
	o = append(o, 0xa4, 0x54, 0x69, 0x6d, 0x65)
	o = msgp.AppendInt64(o, z.Time)
	// string "TargetType"
	o = append(o, 0xaa, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65)
	o = msgp.AppendString(o, z.TargetType)
	// string "Tags"
	o = append(o, 0xa4, 0x54, 0x61, 0x67, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Tags)))
	for xvk := range z.Tags {
		o = msgp.AppendString(o, z.Tags[xvk])
	}
	return
}
Esempio n. 2
0
func (r *responseStream) Error(ctx context.Context, num uint64, code [2]int, msg string) error {
	r.Lock()
	defer r.Unlock()
	if r.closed {
		apexctx.GetLogger(r.ctx).WithError(errStreamIsClosed).Error("responseStream.Error")
		return errStreamIsClosed
	}
	defer r.close(ctx)

	p := msgpackBytePool.Get().([]byte)[:0]
	defer msgpackBytePool.Put(p)

	// NOTE: `3` without headers!
	p = msgp.AppendArrayHeader(p, 3)
	p = msgp.AppendUint64(p, r.channel)
	p = msgp.AppendUint64(p, num)

	// code_category + error message
	p = msgp.AppendArrayHeader(p, 2)

	// code & category
	p = msgp.AppendArrayHeader(p, 2)
	p = msgp.AppendInt(p, code[0])
	p = msgp.AppendInt(p, code[1])

	// error message
	p = msgp.AppendString(p, msg)

	if _, err := r.wr.Write(p); err != nil {
		apexctx.GetLogger(r.ctx).WithError(err).Errorf("responseStream.Error")
		return err
	}
	return nil
}
Esempio n. 3
0
// MarshalMsg implements msgp.Marshaler
func (z *MetricDefinition) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 9
	// string "Id"
	o = append(o, 0x89, 0xa2, 0x49, 0x64)
	o = msgp.AppendString(o, z.Id)
	// string "OrgId"
	o = append(o, 0xa5, 0x4f, 0x72, 0x67, 0x49, 0x64)
	o = msgp.AppendInt(o, z.OrgId)
	// string "Name"
	o = append(o, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "Metric"
	o = append(o, 0xa6, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63)
	o = msgp.AppendString(o, z.Metric)
	// string "Interval"
	o = append(o, 0xa8, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c)
	o = msgp.AppendInt(o, z.Interval)
	// string "Unit"
	o = append(o, 0xa4, 0x55, 0x6e, 0x69, 0x74)
	o = msgp.AppendString(o, z.Unit)
	// string "TargetType"
	o = append(o, 0xaa, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65)
	o = msgp.AppendString(o, z.TargetType)
	// string "Tags"
	o = append(o, 0xa4, 0x54, 0x61, 0x67, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Tags)))
	for hct := range z.Tags {
		o = msgp.AppendString(o, z.Tags[hct])
	}
	// string "LastUpdate"
	o = append(o, 0xaa, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65)
	o = msgp.AppendInt64(o, z.LastUpdate)
	return
}
Esempio n. 4
0
// MarshalMsg implements msgp.Marshaler
func (z Date) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "Year"
	o = append(o, 0x83, 0xa4, 0x59, 0x65, 0x61, 0x72)
	o = msgp.AppendInt(o, z.Year)
	// string "Month"
	o = append(o, 0xa5, 0x4d, 0x6f, 0x6e, 0x74, 0x68)
	o = msgp.AppendInt(o, z.Month)
	// string "Day"
	o = append(o, 0xa3, 0x44, 0x61, 0x79)
	o = msgp.AppendInt(o, z.Day)
	return
}
Esempio n. 5
0
// MarshalMsg implements msgp.Marshaler
func (z *ServerResponse) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// array header, size 3
	o = append(o, 0x93)
	if z.Header == nil {
		o = msgp.AppendNil(o)
	} else {
		// map header, size 3
		// string "message_id"
		o = append(o, 0x83, 0xaa, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64)
		o = msgp.AppendString(o, z.Header.Id)
		// string "v"
		o = append(o, 0xa1, 0x76)
		o = msgp.AppendInt(o, z.Header.Version)
		// string "response_to"
		o = append(o, 0xab, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x6f)
		o = msgp.AppendString(o, z.Header.ResponseTo)
	}
	o = msgp.AppendString(o, z.Name)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Params)))
	for bzg := range z.Params {
		o, err = msgp.AppendIntf(o, z.Params[bzg])
		if err != nil {
			return
		}
	}
	return
}
Esempio n. 6
0
// MarshalMsg implements msgp.Marshaler
func (z *Event) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 4
	// string "id"
	o = append(o, 0x84, 0xa2, 0x69, 0x64)
	o = msgp.AppendInt(o, z.Id)
	// string "user"
	// map header, size 2
	// string "first"
	o = append(o, 0xa4, 0x75, 0x73, 0x65, 0x72, 0x82, 0xa5, 0x66, 0x69, 0x72, 0x73, 0x74)
	o = msgp.AppendString(o, z.User.First)
	// string "last"
	o = append(o, 0xa4, 0x6c, 0x61, 0x73, 0x74)
	o = msgp.AppendString(o, z.User.Last)
	// string "flight"
	o = append(o, 0xa6, 0x66, 0x6c, 0x69, 0x67, 0x68, 0x74)
	o = msgp.AppendString(o, z.Flight)
	// string "pilot"
	o = append(o, 0xa5, 0x70, 0x69, 0x6c, 0x6f, 0x74)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Pilot)))
	for xvk := range z.Pilot {
		o = msgp.AppendString(o, z.Pilot[xvk])
	}
	return
}
Esempio n. 7
0
// MarshalMsg implements msgp.Marshaler
func (z *Incident) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	o = msgp.AppendMapHeader(o, 9)
	o = msgp.AppendString(o, "event_name")
	o = msgp.AppendBytes(o, z.EventName)
	o = msgp.AppendString(o, "time")
	o = msgp.AppendInt64(o, z.Time)
	o = msgp.AppendString(o, "id")
	o = msgp.AppendInt64(o, z.Id)
	o = msgp.AppendString(o, "active")
	o = msgp.AppendBool(o, z.Active)
	o = msgp.AppendString(o, "escalation")
	o = msgp.AppendString(o, z.Escalation)
	o = msgp.AppendString(o, "description")
	o = msgp.AppendString(o, z.Description)
	o = msgp.AppendString(o, "policy")
	o = msgp.AppendString(o, z.Policy)
	o = msgp.AppendString(o, "Status")
	o = msgp.AppendInt(o, z.Status)
	o = msgp.AppendString(o, "Event")
	o, err = z.Event.MarshalMsg(o)
	if err != nil {
		return
	}
	return
}
Esempio n. 8
0
// MarshalMsg implements msgp.Marshaler
func (z Attribute) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "Id"
	o = append(o, 0x83, 0xa2, 0x49, 0x64)
	o = msgp.AppendInt(o, z.Id)
	// string "Name"
	o = append(o, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "Value"
	o = append(o, 0xa5, 0x56, 0x61, 0x6c, 0x75, 0x65)
	o = msgp.AppendString(o, z.Value)
	return
}
// MarshalMsg implements msgp.Marshaler
func (z *bitmapContainer) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 2
	// string "cardinality"
	o = append(o, 0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
	o = msgp.AppendInt(o, z.cardinality)
	// string "bitmap"
	o = append(o, 0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
	o = msgp.AppendArrayHeader(o, uint32(len(z.bitmap)))
	for zxvk := range z.bitmap {
		o = msgp.AppendUint64(o, z.bitmap[zxvk])
	}
	return
}
Esempio n. 10
0
// MarshalMsg implements msgp.Marshaler
func (z EventHeader) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "message_id"
	o = append(o, 0x83, 0xaa, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64)
	o = msgp.AppendString(o, z.Id)
	// string "v"
	o = append(o, 0xa1, 0x76)
	o = msgp.AppendInt(o, z.Version)
	// string "response_to"
	o = append(o, 0xab, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x6f)
	o = msgp.AppendString(o, z.ResponseTo)
	return
}
Esempio n. 11
0
// MarshalMsg implements msgp.Marshaler
func (z *Car) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 5
	// string "CarId"
	o = append(o, 0x85, 0xa5, 0x43, 0x61, 0x72, 0x49, 0x64)
	o = msgp.AppendInt(o, z.CarId)
	// string "CarName"
	o = append(o, 0xa7, 0x43, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.CarName)
	// string "Attributes"
	o = append(o, 0xaa, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Attributes)))
	for bai := range z.Attributes {
		// map header, size 3
		// string "Id"
		o = append(o, 0x83, 0xa2, 0x49, 0x64)
		o = msgp.AppendInt(o, z.Attributes[bai].Id)
		// string "Name"
		o = append(o, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
		o = msgp.AppendString(o, z.Attributes[bai].Name)
		// string "Value"
		o = append(o, 0xa5, 0x56, 0x61, 0x6c, 0x75, 0x65)
		o = msgp.AppendString(o, z.Attributes[bai].Value)
	}
	// string "FlagMap"
	o = append(o, 0xa7, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x61, 0x70)
	o = msgp.AppendMapHeader(o, uint32(len(z.FlagMap)))
	for cmr, ajw := range z.FlagMap {
		o = msgp.AppendString(o, cmr)
		o = msgp.AppendString(o, ajw)
	}
	// string "Ttl"
	o = append(o, 0xa3, 0x54, 0x74, 0x6c)
	o = msgp.AppendInt(o, z.Ttl)
	return
}
Esempio n. 12
0
// MarshalMsg implements msgp.Marshaler
func (z *bitmapContainerShortIterator) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 2
	// string "ptr"
	o = append(o, 0x82, 0xa3, 0x70, 0x74, 0x72)
	if z.ptr == nil {
		o = msgp.AppendNil(o)
	} else {
		// map header, size 2
		// string "cardinality"
		o = append(o, 0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
		o = msgp.AppendInt(o, z.ptr.cardinality)
		// string "bitmap"
		o = append(o, 0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
		o = msgp.AppendArrayHeader(o, uint32(len(z.ptr.bitmap)))
		for zwht := range z.ptr.bitmap {
			o = msgp.AppendUint64(o, z.ptr.bitmap[zwht])
		}
	}
	// string "i"
	o = append(o, 0xa1, 0x69)
	o = msgp.AppendInt(o, z.i)
	return
}
Esempio n. 13
0
// MarshalMsg implements msgp.Marshaler
func (z *Packet) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 4
	// string "type"
	o = append(o, 0x84, 0xa4, 0x74, 0x79, 0x70, 0x65)
	o = msgp.AppendByte(o, z.pType)
	// string "id"
	o = append(o, 0xa2, 0x69, 0x64)
	o = msgp.AppendInt(o, z.id)
	// string "event"
	o = append(o, 0xa5, 0x65, 0x76, 0x65, 0x6e, 0x74)
	o = msgp.AppendString(o, z.eventName)
	// string "payload"
	o = append(o, 0xa7, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64)
	o = msgp.AppendBytes(o, z.payload)
	return
}
Esempio n. 14
0
// MarshalMsg implements msgp.Marshaler
func (z *ColorGroup) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "id"
	o = append(o, 0x83, 0xa2, 0x69, 0x64)
	o = msgp.AppendInt(o, z.Id)
	// string "name"
	o = append(o, 0xa4, 0x6e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "colors"
	o = append(o, 0xa6, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Colors)))
	for xvk := range z.Colors {
		o = msgp.AppendString(o, z.Colors[xvk])
	}
	return
}
// MarshalMsg implements msgp.Marshaler
func (z *A) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 6
	// string "Name"
	o = append(o, 0x86, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "BirthDay"
	o = append(o, 0xa8, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x79)
	o = msgp.AppendTime(o, z.BirthDay)
	// string "Phone"
	o = append(o, 0xa5, 0x50, 0x68, 0x6f, 0x6e, 0x65)
	o = msgp.AppendString(o, z.Phone)
	// string "Siblings"
	o = append(o, 0xa8, 0x53, 0x69, 0x62, 0x6c, 0x69, 0x6e, 0x67, 0x73)
	o = msgp.AppendInt(o, z.Siblings)
	// string "Spouse"
	o = append(o, 0xa6, 0x53, 0x70, 0x6f, 0x75, 0x73, 0x65)
	o = msgp.AppendBool(o, z.Spouse)
	// string "Money"
	o = append(o, 0xa5, 0x4d, 0x6f, 0x6e, 0x65, 0x79)
	o = msgp.AppendFloat64(o, z.Money)
	return
}