// EncodeMsg implements msgp.Encodable func (z Outgoing) EncodeMsg(en *msgp.Writer) (err error) { // map header, size 3 // write "time" err = en.Append(0x83, 0xa4, 0x74, 0x69, 0x6d, 0x65) if err != nil { return err } err = en.WriteUint32(z.Time) if err != nil { return } // write "from" err = en.Append(0xa4, 0x66, 0x72, 0x6f, 0x6d) if err != nil { return err } err = en.WriteString(z.From) if err != nil { return } // write "message" err = en.Append(0xa7, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65) if err != nil { return err } err = en.WriteString(z.Message) if err != nil { return } return }
// EncodeMsg implements msgp.Encodable func (z uint32Slice) EncodeMsg(en *msgp.Writer) (err error) { err = en.WriteArrayHeader(uint32(len(z))) if err != nil { return } for zzpf := range z { err = en.WriteUint32(z[zzpf]) if err != nil { return } } return }
// EncodeMsg implements msgp.Encodable func (z *runIterator32) EncodeMsg(en *msgp.Writer) (err error) { // map header, size 4 // write "rc" err = en.Append(0x84, 0xa2, 0x72, 0x63) if err != nil { return err } if z.rc == nil { err = en.WriteNil() if err != nil { return } } else { err = z.rc.EncodeMsg(en) if err != nil { return } } // write "curIndex" err = en.Append(0xa8, 0x63, 0x75, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78) if err != nil { return err } err = en.WriteInt64(z.curIndex) if err != nil { return } // write "curPosInIndex" err = en.Append(0xad, 0x63, 0x75, 0x72, 0x50, 0x6f, 0x73, 0x49, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78) if err != nil { return err } err = en.WriteUint32(z.curPosInIndex) if err != nil { return } // write "curSeq" err = en.Append(0xa6, 0x63, 0x75, 0x72, 0x53, 0x65, 0x71) if err != nil { return err } err = en.WriteInt64(z.curSeq) if err != nil { return } return }
// EncodeMsg implements msgp.Encodable func (z *runContainer32) EncodeMsg(en *msgp.Writer) (err error) { // map header, size 2 // write "iv" err = en.Append(0x82, 0xa2, 0x69, 0x76) if err != nil { return err } err = en.WriteArrayHeader(uint32(len(z.iv))) if err != nil { return } for zxpk := range z.iv { // map header, size 2 // write "start" err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74) if err != nil { return err } err = en.WriteUint32(z.iv[zxpk].start) if err != nil { return } // write "last" err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74) if err != nil { return err } err = en.WriteUint32(z.iv[zxpk].last) if err != nil { return } } // write "card" err = en.Append(0xa4, 0x63, 0x61, 0x72, 0x64) if err != nil { return err } err = en.WriteInt64(z.card) if err != nil { return } return }
func (r *Response) EncodeMsg(w *msgp.Writer) error { var bm msgp.Encodable if r.Body != nil { var ok bool bm, ok = r.Body.(msgp.Encodable) if !ok { return ErrNotEncodable } } var err error if err = w.WriteArrayHeader(ResponsePackSize); err != nil { return err } if err = w.WriteInt(ResponseType); err != nil { return err } if err = w.WriteUint32(r.ID); err != nil { return err } // No error. if r.Error == "" { if err = w.WriteNil(); err != nil { return err } if bm != nil { return msgp.Encode(w, bm) } } else { if err = w.WriteString(r.Error); err != nil { return err } } // Write nil body. return w.WriteNil() }
// EncodeMsg encodes the request to writer. The body is expected to // be an encodable type. func (r *Request) EncodeMsg(w *msgp.Writer) error { var bm msgp.Encodable if r.Body != nil { var ok bool bm, ok = r.Body.(msgp.Encodable) if !ok { return ErrNotEncodable } } var err error if err = w.WriteArrayHeader(RequestPackSize); err != nil { return err } if err = w.WriteInt(RequestType); err != nil { return err } if err = w.WriteUint32(r.ID); err != nil { return err } if err = w.WriteString(r.Method); err != nil { return err } // No body to encode. Write a zero-length params array. if bm == nil { return w.WriteArrayHeader(0) } // 1-item array containing the body. if err = w.WriteArrayHeader(1); err != nil { return err } return msgp.Encode(w, bm) }
// EncodeMsg implements msgp.Encodable func (z interval32) EncodeMsg(en *msgp.Writer) (err error) { // map header, size 2 // write "start" err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74) if err != nil { return err } err = en.WriteUint32(z.start) if err != nil { return } // write "last" err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74) if err != nil { return err } err = en.WriteUint32(z.last) if err != nil { return } return }
// EncodeMsg implements msgp.Encodable func (z *addHelper32) EncodeMsg(en *msgp.Writer) (err error) { // map header, size 5 // write "runstart" err = en.Append(0x85, 0xa8, 0x72, 0x75, 0x6e, 0x73, 0x74, 0x61, 0x72, 0x74) if err != nil { return err } err = en.WriteUint32(z.runstart) if err != nil { return } // write "runlen" err = en.Append(0xa6, 0x72, 0x75, 0x6e, 0x6c, 0x65, 0x6e) if err != nil { return err } err = en.WriteUint32(z.runlen) if err != nil { return } // write "actuallyAdded" err = en.Append(0xad, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x41, 0x64, 0x64, 0x65, 0x64) if err != nil { return err } err = en.WriteUint32(z.actuallyAdded) if err != nil { return } // write "m" err = en.Append(0xa1, 0x6d) if err != nil { return err } err = en.WriteArrayHeader(uint32(len(z.m))) if err != nil { return } for zxvk := range z.m { // map header, size 2 // write "start" err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74) if err != nil { return err } err = en.WriteUint32(z.m[zxvk].start) if err != nil { return } // write "last" err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74) if err != nil { return err } err = en.WriteUint32(z.m[zxvk].last) if err != nil { return } } // write "rc" err = en.Append(0xa2, 0x72, 0x63) if err != nil { return err } if z.rc == nil { err = en.WriteNil() if err != nil { return } } else { // map header, size 2 // write "iv" err = en.Append(0x82, 0xa2, 0x69, 0x76) if err != nil { return err } err = en.WriteArrayHeader(uint32(len(z.rc.iv))) if err != nil { return } for zbzg := range z.rc.iv { // map header, size 2 // write "start" err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74) if err != nil { return err } err = en.WriteUint32(z.rc.iv[zbzg].start) if err != nil { return } // write "last" err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74) if err != nil { return err } err = en.WriteUint32(z.rc.iv[zbzg].last) if err != nil { return } } // write "card" err = en.Append(0xa4, 0x63, 0x61, 0x72, 0x64) if err != nil { return err } err = en.WriteInt64(z.rc.card) if err != nil { return } } return }