// MarshalMsg implements msgp.Marshaler func (z *Message) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) o = msgp.AppendArrayHeader(o, 4) o = msgp.AppendString(o, z.Tag) o = msgp.AppendInt64(o, z.Time) o, err = msgp.AppendIntf(o, z.Record) if err != nil { return } o, err = msgp.AppendIntf(o, z.Option) if err != nil { return } return }
// 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 }
// MarshalMsg implements msgp.Marshaler func (z *CacheRegistry) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) // map header, size 6 // string "CacheKey" o = append(o, 0x86, 0xa8, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4b, 0x65, 0x79) o = msgp.AppendString(o, z.CacheKey) // string "Payload" o = append(o, 0xa7, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64) o, err = msgp.AppendIntf(o, z.Payload) if err != nil { return } // string "StoreTTL" o = append(o, 0xa8, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x54, 0x54, 0x4c) o = msgp.AppendFloat64(o, z.StoreTTL) // string "CacheTime" o = append(o, 0xa9, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65) o = msgp.AppendTime(o, z.CacheTime) // string "HasValue" o = append(o, 0xa8, 0x48, 0x61, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65) o = msgp.AppendBool(o, z.HasValue) // string "TypeName" o = append(o, 0xa8, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65) o = msgp.AppendString(o, z.TypeName) return }
// MarshalMsg implements msgp.Marshaler func (z *Node) 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.AppendBytes(o, []byte(z.ID)) // string "il" o = append(o, 0xa2, 0x69, 0x6c) o = msgp.AppendBool(o, z.IsLeaf) // string "cv" o = append(o, 0xa2, 0x63, 0x76) o = msgp.AppendArrayHeader(o, uint32(len(z.ChildValues))) for cmr := range z.ChildValues { o, err = msgp.AppendIntf(o, z.ChildValues[cmr]) if err != nil { return } } // string "ck" o = append(o, 0xa2, 0x63, 0x6b) o = msgp.AppendArrayHeader(o, uint32(len(z.ChildKeys))) for ajw := range z.ChildKeys { if z.ChildKeys[ajw] == nil { o = msgp.AppendNil(o) } else { o, err = z.ChildKeys[ajw].MarshalMsg(o) if err != nil { return } } } return }
func (s *initialDispatchSuite) TestSpoolCancel(c *C) { var ( args = Profile{ "type": "testSleep", } appName = "application" spoolMsg, _ = msgp.AppendIntf(nil, []interface{}{map[string]interface{}(args), appName}) cancelMsg, _ = msgp.AppendIntf(nil, []interface{}{}) ) spoolDisp, err := s.d.Handle(spool, msgp.NewReader(bytes.NewReader(spoolMsg))) c.Assert(err, IsNil) c.Assert(spoolDisp, FitsTypeOf, &spoolCancelationDispatch{}) spoolDisp.Handle(spoolCancel, msgp.NewReader(bytes.NewReader(cancelMsg))) msg := <-s.dw.ch c.Assert(msg.code, DeepEquals, int64(replySpoolOk)) }
// MarshalMsg implements msgp.Marshaler func (z Entry) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) o = msgp.AppendArrayHeader(o, 2) o = msgp.AppendInt64(o, z.Time) o, err = msgp.AppendIntf(o, z.Record) if err != nil { return } return }
// MarshalMsg implements msgp.Marshaler func (z *Forward) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) o = msgp.AppendArrayHeader(o, 3) o = msgp.AppendString(o, z.Tag) o = msgp.AppendArrayHeader(o, uint32(len(z.Entries))) for xvk := range z.Entries { o = msgp.AppendArrayHeader(o, 2) o = msgp.AppendInt64(o, z.Entries[xvk].Time) o, err = msgp.AppendIntf(o, z.Entries[xvk].Record) if err != nil { return } } o, err = msgp.AppendIntf(o, z.Option) if err != nil { return } return }
func (s *initialDispatchSuite) TestSpawnAndKill(c *C) { var ( opts = Profile{ "type": "testSleep", } appName = "application" executable = "test_app.exe" args = make(map[string]string, 0) env = make(map[string]string, 0) // spawnMsg = message{s.session, spawn, []interface{}{opts, appName, executable, args, env}} spawnMsg, _ = msgp.AppendIntf(nil, []interface{}{map[string]interface{}(opts), appName, executable, args, env}) killMsg, _ = msgp.AppendIntf(nil, []interface{}{}) ) spawnDisp, err := s.d.Handle(spawn, msgp.NewReader(bytes.NewReader(spawnMsg))) c.Assert(err, IsNil) c.Assert(spawnDisp, FitsTypeOf, &spawnDispatch{}) // First chunk must be empty to notify about start msg := <-s.dw.ch c.Assert(msg.code, DeepEquals, int64(replySpawnWrite)) c.Assert(msg.args, HasLen, 1) data, ok := msg.args[0].([]byte) c.Assert(ok, Equals, true) c.Assert(data, HasLen, 0) // Let's read some output msg = <-s.dw.ch c.Assert(msg.code, Equals, int64(replySpawnWrite)) c.Assert(msg.args, HasLen, 1) data, ok = msg.args[0].([]byte) c.Assert(ok, Equals, true) c.Assert(data, Not(HasLen), 0) noneDisp, err := spawnDisp.Handle(spawnKill, msgp.NewReader(bytes.NewReader(killMsg))) c.Assert(err, IsNil) c.Assert(noneDisp, IsNil) }
// MarshalMsg implements msgp.Marshaler func (z *Key) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) // map header, size 3 // string "u" o = append(o, 0x83, 0xa1, 0x75) o = msgp.AppendBytes(o, []byte(z.UUID)) // string "v" o = append(o, 0xa1, 0x76) o, err = msgp.AppendIntf(o, z.Value) if err != nil { return } // string "p" o = append(o, 0xa1, 0x70) o = msgp.AppendBytes(o, z.Payload) return }
// MarshalMsg implements msgp.Marshaler func (z *Message) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) // map header, size 3 // string "body" o = append(o, 0x83, 0xa4, 0x62, 0x6f, 0x64, 0x79) o = msgp.AppendBytes(o, z.Body) // string "meta" o = append(o, 0xa4, 0x6d, 0x65, 0x74, 0x61) o = msgp.AppendMapHeader(o, uint32(len(z.Meta))) for xvk, bzg := range z.Meta { o = msgp.AppendString(o, xvk) o, err = msgp.AppendIntf(o, bzg) if err != nil { return } } // string "ct" o = append(o, 0xa2, 0x63, 0x74) o = msgp.AppendString(o, z.ContentType) return }