Esempio n. 1
0
func (this *Castaway) String() string {
	if this == nil {
		return "nil"
	}
	keysForCastMapValueMessage := make([]int32, 0, len(this.CastMapValueMessage))
	for k := range this.CastMapValueMessage {
		keysForCastMapValueMessage = append(keysForCastMapValueMessage, k)
	}
	github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessage)
	mapStringForCastMapValueMessage := "map[int32]MyWilson{"
	for _, k := range keysForCastMapValueMessage {
		mapStringForCastMapValueMessage += fmt.Sprintf("%v: %v,", k, this.CastMapValueMessage[k])
	}
	mapStringForCastMapValueMessage += "}"
	keysForCastMapValueMessageNullable := make([]int32, 0, len(this.CastMapValueMessageNullable))
	for k := range this.CastMapValueMessageNullable {
		keysForCastMapValueMessageNullable = append(keysForCastMapValueMessageNullable, k)
	}
	github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessageNullable)
	mapStringForCastMapValueMessageNullable := "map[int32]*MyWilson{"
	for _, k := range keysForCastMapValueMessageNullable {
		mapStringForCastMapValueMessageNullable += fmt.Sprintf("%v: %v,", k, this.CastMapValueMessageNullable[k])
	}
	mapStringForCastMapValueMessageNullable += "}"
	s := strings.Join([]string{`&Castaway{`,
		`CastMapValueMessage:` + mapStringForCastMapValueMessage + `,`,
		`CastMapValueMessageNullable:` + mapStringForCastMapValueMessageNullable + `,`,
		`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
		`}`,
	}, "")
	return s
}
Esempio n. 2
0
func (m *AllRoomCountReply) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Counter) > 0 {
		keysForCounter := make([]int32, 0, len(m.Counter))
		for k, _ := range m.Counter {
			keysForCounter = append(keysForCounter, k)
		}
		github_com_gogo_protobuf_sortkeys.Int32s(keysForCounter)
		for _, k := range keysForCounter {
			data[i] = 0xa
			i++
			v := m.Counter[k]
			mapSize := 1 + sovRouter(uint64(k)) + 1 + sovRouter(uint64(v))
			i = encodeVarintRouter(data, i, uint64(mapSize))
			data[i] = 0x8
			i++
			i = encodeVarintRouter(data, i, uint64(k))
			data[i] = 0x10
			i++
			i = encodeVarintRouter(data, i, uint64(v))
		}
	}
	return i, nil
}
Esempio n. 3
0
func (m *RoomsReply) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Rooms) > 0 {
		keysForRooms := make([]int32, 0, len(m.Rooms))
		for k, _ := range m.Rooms {
			keysForRooms = append(keysForRooms, k)
		}
		github_com_gogo_protobuf_sortkeys.Int32s(keysForRooms)
		for _, k := range keysForRooms {
			data[i] = 0xa
			i++
			v := m.Rooms[k]
			mapSize := 1 + sovComet(uint64(k)) + 1 + 1
			i = encodeVarintComet(data, i, uint64(mapSize))
			data[i] = 0x8
			i++
			i = encodeVarintComet(data, i, uint64(k))
			data[i] = 0x10
			i++
			if v {
				data[i] = 1
			} else {
				data[i] = 0
			}
			i++
		}
	}
	return i, nil
}
Esempio n. 4
0
func (this *Castaway) GoString() string {
	if this == nil {
		return "nil"
	}
	s := make([]string, 0, 6)
	s = append(s, "&castvalue.Castaway{")
	keysForCastMapValueMessage := make([]int32, 0, len(this.CastMapValueMessage))
	for k := range this.CastMapValueMessage {
		keysForCastMapValueMessage = append(keysForCastMapValueMessage, k)
	}
	github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessage)
	mapStringForCastMapValueMessage := "map[int32]MyWilson{"
	for _, k := range keysForCastMapValueMessage {
		mapStringForCastMapValueMessage += fmt.Sprintf("%#v: %#v,", k, this.CastMapValueMessage[k])
	}
	mapStringForCastMapValueMessage += "}"
	if this.CastMapValueMessage != nil {
		s = append(s, "CastMapValueMessage: "+mapStringForCastMapValueMessage+",\n")
	}
	keysForCastMapValueMessageNullable := make([]int32, 0, len(this.CastMapValueMessageNullable))
	for k := range this.CastMapValueMessageNullable {
		keysForCastMapValueMessageNullable = append(keysForCastMapValueMessageNullable, k)
	}
	github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessageNullable)
	mapStringForCastMapValueMessageNullable := "map[int32]*MyWilson{"
	for _, k := range keysForCastMapValueMessageNullable {
		mapStringForCastMapValueMessageNullable += fmt.Sprintf("%#v: %#v,", k, this.CastMapValueMessageNullable[k])
	}
	mapStringForCastMapValueMessageNullable += "}"
	if this.CastMapValueMessageNullable != nil {
		s = append(s, "CastMapValueMessageNullable: "+mapStringForCastMapValueMessageNullable+",\n")
	}
	if this.XXX_unrecognized != nil {
		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
	}
	s = append(s, "}")
	return strings.Join(s, "")
}
Esempio n. 5
0
func (m *Response) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.NodeID != 0 {
		data[i] = 0x8
		i++
		i = encodeVarintGossip(data, i, uint64(m.NodeID))
	}
	data[i] = 0x12
	i++
	i = encodeVarintGossip(data, i, uint64(m.Addr.Size()))
	n4, err := m.Addr.MarshalTo(data[i:])
	if err != nil {
		return 0, err
	}
	i += n4
	if m.AlternateAddr != nil {
		data[i] = 0x1a
		i++
		i = encodeVarintGossip(data, i, uint64(m.AlternateAddr.Size()))
		n5, err := m.AlternateAddr.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n5
	}
	if m.AlternateNodeID != 0 {
		data[i] = 0x20
		i++
		i = encodeVarintGossip(data, i, uint64(m.AlternateNodeID))
	}
	if len(m.Delta) > 0 {
		keysForDelta := make([]string, 0, len(m.Delta))
		for k := range m.Delta {
			keysForDelta = append(keysForDelta, string(k))
		}
		github_com_gogo_protobuf_sortkeys.Strings(keysForDelta)
		for _, k := range keysForDelta {
			data[i] = 0x2a
			i++
			v := m.Delta[string(k)]
			if v == nil {
				return 0, errors.New("proto: map has nil element")
			}
			msgSize := v.Size()
			mapSize := 1 + len(k) + sovGossip(uint64(len(k))) + 1 + msgSize + sovGossip(uint64(msgSize))
			i = encodeVarintGossip(data, i, uint64(mapSize))
			data[i] = 0xa
			i++
			i = encodeVarintGossip(data, i, uint64(len(k)))
			i += copy(data[i:], k)
			data[i] = 0x12
			i++
			i = encodeVarintGossip(data, i, uint64(v.Size()))
			n6, err := v.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n6
		}
	}
	if len(m.HighWaterStamps) > 0 {
		keysForHighWaterStamps := make([]int32, 0, len(m.HighWaterStamps))
		for k := range m.HighWaterStamps {
			keysForHighWaterStamps = append(keysForHighWaterStamps, int32(k))
		}
		github_com_gogo_protobuf_sortkeys.Int32s(keysForHighWaterStamps)
		for _, k := range keysForHighWaterStamps {
			data[i] = 0x32
			i++
			v := m.HighWaterStamps[github_com_cockroachdb_cockroach_roachpb.NodeID(k)]
			mapSize := 1 + sovGossip(uint64(k)) + 1 + sovGossip(uint64(v))
			i = encodeVarintGossip(data, i, uint64(mapSize))
			data[i] = 0x8
			i++
			i = encodeVarintGossip(data, i, uint64(k))
			data[i] = 0x10
			i++
			i = encodeVarintGossip(data, i, uint64(v))
		}
	}
	return i, nil
}
Esempio n. 6
0
func (m *Request) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.NodeID != 0 {
		data[i] = 0x8
		i++
		i = encodeVarintGossip(data, i, uint64(m.NodeID))
	}
	data[i] = 0x12
	i++
	i = encodeVarintGossip(data, i, uint64(m.Addr.Size()))
	n1, err := m.Addr.MarshalTo(data[i:])
	if err != nil {
		return 0, err
	}
	i += n1
	data[i] = 0x1a
	i++
	i = encodeVarintGossip(data, i, uint64(m.LAddr.Size()))
	n2, err := m.LAddr.MarshalTo(data[i:])
	if err != nil {
		return 0, err
	}
	i += n2
	if len(m.HighWaterStamps) > 0 {
		keysForHighWaterStamps := make([]int32, 0, len(m.HighWaterStamps))
		for k := range m.HighWaterStamps {
			keysForHighWaterStamps = append(keysForHighWaterStamps, k)
		}
		github_com_gogo_protobuf_sortkeys.Int32s(keysForHighWaterStamps)
		for _, k := range keysForHighWaterStamps {
			data[i] = 0x22
			i++
			v := m.HighWaterStamps[k]
			mapSize := 1 + sovGossip(uint64(k)) + 1 + sovGossip(uint64(v))
			i = encodeVarintGossip(data, i, uint64(mapSize))
			data[i] = 0x8
			i++
			i = encodeVarintGossip(data, i, uint64(k))
			data[i] = 0x10
			i++
			i = encodeVarintGossip(data, i, uint64(v))
		}
	}
	if len(m.Delta) > 0 {
		keysForDelta := make([]string, 0, len(m.Delta))
		for k := range m.Delta {
			keysForDelta = append(keysForDelta, k)
		}
		github_com_gogo_protobuf_sortkeys.Strings(keysForDelta)
		for _, k := range keysForDelta {
			data[i] = 0x2a
			i++
			v := m.Delta[k]
			if v == nil {
				return 0, errors.New("proto: map has nil element")
			}
			msgSize := v.Size()
			mapSize := 1 + len(k) + sovGossip(uint64(len(k))) + 1 + msgSize + sovGossip(uint64(msgSize))
			i = encodeVarintGossip(data, i, uint64(mapSize))
			data[i] = 0xa
			i++
			i = encodeVarintGossip(data, i, uint64(len(k)))
			i += copy(data[i:], k)
			data[i] = 0x12
			i++
			i = encodeVarintGossip(data, i, uint64(v.Size()))
			n3, err := v.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n3
		}
	}
	return i, nil
}