예제 #1
0
// EncodeMsg implements msgp.Encodable
func (z *Forward) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(3)
	if err != nil {
		return
	}
	err = en.WriteString(z.Tag)
	if err != nil {
		return
	}
	err = en.WriteArrayHeader(uint32(len(z.Entries)))
	if err != nil {
		return
	}
	for xvk := range z.Entries {
		err = en.WriteArrayHeader(2)
		if err != nil {
			return
		}
		err = en.WriteInt64(z.Entries[xvk].Time)
		if err != nil {
			return
		}
		err = en.WriteIntf(z.Entries[xvk].Record)
		if err != nil {
			return
		}
	}
	err = en.WriteIntf(z.Option)
	if err != nil {
		return
	}
	return
}
예제 #2
0
// EncodeMsg implements msgp.Encodable
func (z *CacheRegistry) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 6
	// write "CacheKey"
	err = en.Append(0x86, 0xa8, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4b, 0x65, 0x79)
	if err != nil {
		return err
	}
	err = en.WriteString(z.CacheKey)
	if err != nil {
		return
	}
	// write "Payload"
	err = en.Append(0xa7, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64)
	if err != nil {
		return err
	}
	err = en.WriteIntf(z.Payload)
	if err != nil {
		return
	}
	// write "StoreTTL"
	err = en.Append(0xa8, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x54, 0x54, 0x4c)
	if err != nil {
		return err
	}
	err = en.WriteFloat64(z.StoreTTL)
	if err != nil {
		return
	}
	// write "CacheTime"
	err = en.Append(0xa9, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteTime(z.CacheTime)
	if err != nil {
		return
	}
	// write "HasValue"
	err = en.Append(0xa8, 0x48, 0x61, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteBool(z.HasValue)
	if err != nil {
		return
	}
	// write "TypeName"
	err = en.Append(0xa8, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteString(z.TypeName)
	if err != nil {
		return
	}
	return
}
예제 #3
0
// EncodeMsg implements msgp.Encodable
func (z *ServerResponse) EncodeMsg(en *msgp.Writer) (err error) {
	// array header, size 3
	err = en.Append(0x93)
	if err != nil {
		return err
	}
	if z.Header == nil {
		err = en.WriteNil()
		if err != nil {
			return
		}
	} else {
		// map header, size 3
		// write "message_id"
		err = en.Append(0x83, 0xaa, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64)
		if err != nil {
			return err
		}
		err = en.WriteString(z.Header.Id)
		if err != nil {
			return
		}
		// write "v"
		err = en.Append(0xa1, 0x76)
		if err != nil {
			return err
		}
		err = en.WriteInt(z.Header.Version)
		if err != nil {
			return
		}
		// write "response_to"
		err = en.Append(0xab, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x6f)
		if err != nil {
			return err
		}
		err = en.WriteString(z.Header.ResponseTo)
		if err != nil {
			return
		}
	}
	err = en.WriteString(z.Name)
	if err != nil {
		return
	}
	err = en.WriteArrayHeader(uint32(len(z.Params)))
	if err != nil {
		return
	}
	for bzg := range z.Params {
		err = en.WriteIntf(z.Params[bzg])
		if err != nil {
			return
		}
	}
	return
}
예제 #4
0
// EncodeMsg implements msgp.Encodable
func (z Entry) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(2)
	if err != nil {
		return
	}
	err = en.WriteInt64(z.Time)
	if err != nil {
		return
	}
	err = en.WriteIntf(z.Record)
	if err != nil {
		return
	}
	return
}
예제 #5
0
// EncodeMsg implements msgp.Encodable
func (z *Message) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 3
	// write "body"
	err = en.Append(0x83, 0xa4, 0x62, 0x6f, 0x64, 0x79)
	if err != nil {
		return err
	}
	err = en.WriteBytes(z.Body)
	if err != nil {
		return
	}
	// write "meta"
	err = en.Append(0xa4, 0x6d, 0x65, 0x74, 0x61)
	if err != nil {
		return err
	}
	err = en.WriteMapHeader(uint32(len(z.Meta)))
	if err != nil {
		return
	}
	for xvk, bzg := range z.Meta {
		err = en.WriteString(xvk)
		if err != nil {
			return
		}
		err = en.WriteIntf(bzg)
		if err != nil {
			return
		}
	}
	// write "ct"
	err = en.Append(0xa2, 0x63, 0x74)
	if err != nil {
		return err
	}
	err = en.WriteString(z.ContentType)
	if err != nil {
		return
	}
	return
}
예제 #6
0
// EncodeMsg implements msgp.Encodable
func (z *Message) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(4)
	if err != nil {
		return
	}
	err = en.WriteString(z.Tag)
	if err != nil {
		return
	}
	err = en.WriteInt64(z.Time)
	if err != nil {
		return
	}
	err = en.WriteIntf(z.Record)
	if err != nil {
		return
	}
	err = en.WriteIntf(z.Option)
	if err != nil {
		return
	}
	return
}