func (m *msgReleasingPartition) Type() msgType {
	return msgTypeReleasingPartition
}
Type returns the type of this message.
package marshal
import (
	"fmt"
	"strconv"
	"strings"
)
type msgType int
const (
	msgLengthBase int = 8
	idxType       int = 0
	idxVersion    int = 1
	idxTimestamp  int = 2
	idxInstanceID int = 3
	idxClientID   int = 4
	idxGroupID    int = 5
	idxTopic      int = 6
	idxPartID     int = 7
	idxBaseEnd    int = 7  
	msgTypeHeartbeat   msgType = 0
	msgLengthHeartbeat int     = msgLengthBase + 1
	idxHBCurrentOffset int     = idxBaseEnd + 1
	msgTypeClaimingPartition   msgType = 1
	msgLengthClaimingPartition int     = msgLengthBase
	msgTypeReleasingPartition   msgType = 2
	msgLengthReleasingPartition int     = msgLengthBase + 1
	idxRPCurrentOffset          int     = idxBaseEnd + 1
	msgTypeClaimingMessages    msgType = 3
	msgLengthClaimingMessages  int     = msgLengthBase + 1
	idxCMProposedCurrentOffset int     = idxBaseEnd + 1
)
type message interface {
	Encode() string
	Timestamp() int
	Type() msgType
	Ownership() (string, string, string)
}
func decode(inp []byte) (message, error) {
	parts := strings.Split(string(inp), "/")
	if len(parts) < msgLengthBase {
		return nil, fmt.Errorf("Invalid message (length): [%s]", string(inp))
	}
	version, err := strconv.Atoi(parts[idxVersion])
	if err != nil {
		return nil, fmt.Errorf("Invalid message (version): [%s]", string(inp))
	}
	partID, err := strconv.Atoi(parts[idxPartID])
	if err != nil {
		return nil, fmt.Errorf("Invalid message (partID): [%s]", string(inp))
	}
	ts, err := strconv.Atoi(parts[idxTimestamp])
	if err != nil {
		return nil, fmt.Errorf("Invalid message (timestamp): [%s]", string(inp))
	}
	base := msgBase{
		Version:    version,
		Time:       ts,
		InstanceID: parts[idxInstanceID],
		ClientID:   parts[idxClientID],
		GroupID:    parts[idxGroupID],
		Topic:      parts[idxTopic],
		PartID:     partID,
	}
	switch parts[0] {
	case "Heartbeat":
		if len(parts) != msgLengthHeartbeat {
			return nil, fmt.Errorf("Invalid message (hb length): [%s]", string(inp))
		}
		offset, err := strconv.ParseInt(parts[idxHBCurrentOffset], 10, 0)
		if err != nil {
			return nil, fmt.Errorf("Invalid message (hb offset): [%s]", string(inp))
		}
		return &msgHeartbeat{msgBase: base, CurrentOffset: int64(offset)}, nil
	case "ClaimingPartition":
		if len(parts) != msgLengthClaimingPartition {
			return nil, fmt.Errorf("Invalid message (cp length): [%s]", string(inp))
		}
		return &msgClaimingPartition{msgBase: base}, nil
	case "ReleasingPartition":
		if len(parts) != msgLengthReleasingPartition {
			return nil, fmt.Errorf("Invalid message (rp length): [%s]", string(inp))
		}
		offset, err := strconv.ParseInt(parts[idxRPCurrentOffset], 10, 0)
		if err != nil {
			return nil, fmt.Errorf("Invalid message (rp offset): [%s]", string(inp))
		}
		return &msgReleasingPartition{msgBase: base, CurrentOffset: offset}, nil
	case "ClaimingMessages":
		if len(parts) != msgLengthClaimingMessages {
			return nil, fmt.Errorf("Invalid message (cm length): [%s]", string(inp))
		}
		offset, err := strconv.ParseInt(parts[idxCMProposedCurrentOffset], 10, 0)
		if err != nil {
			return nil, fmt.Errorf("Invalid message (cm offset): [%s]", string(inp))
		}
		return &msgClaimingMessages{msgBase: base, ProposedCurrentOffset: offset}, nil
	}
	return nil, fmt.Errorf("Invalid message: [%s]", string(inp))
}
type msgBase struct {
	Version    int
	Time       int
	InstanceID string
	ClientID   string
	GroupID    string
	Topic      string
	PartID     int
}
func (m *msgBase) Encode() string {
	return fmt.Sprintf("%d/%d/%s/%s/%s/%s/%d",
		m.Version, m.Time, m.InstanceID, m.ClientID, m.GroupID, m.Topic, m.PartID)
}
func (m *msgBase) Type() msgType {
	panic("Attempted to type the base message. This should never happen.")
}
func (m *msgBase) Timestamp() int {
	return m.Time
}
func (m *msgBase) Ownership() (string, string, string) {
	return m.InstanceID, m.ClientID, m.GroupID
}
type msgHeartbeat struct {
	msgBase
	CurrentOffset int64
}
func (m *msgHeartbeat) Encode() string {
	return "Heartbeat/" + m.msgBase.Encode() + fmt.Sprintf("/%d", m.CurrentOffset)
}
func (m *msgHeartbeat) Type() msgType {
	return msgTypeHeartbeat
}
func (m *msgHeartbeat) Timestamp() int {
	return m.Time
}
func (m *msgHeartbeat) Ownership() (string, string, string) {
	return m.InstanceID, m.ClientID, m.GroupID
}
type msgClaimingPartition struct {
	msgBase
}
func (m *msgClaimingPartition) Encode() string {
	return "ClaimingPartition/" + m.msgBase.Encode()
}
func (m *msgClaimingPartition) Type() msgType {
	return msgTypeClaimingPartition
}
func (m *msgClaimingPartition) Timestamp() int {
	return m.Time
}
func (m *msgClaimingPartition) Ownership() (string, string, string) {
	return m.InstanceID, m.ClientID, m.GroupID
}
type msgReleasingPartition struct {
	msgBase
	CurrentOffset int64
}
func (m *msgReleasingPartition) Encode() string {
	return "ReleasingPartition/" + m.msgBase.Encode() + fmt.Sprintf("/%d", m.CurrentOffset)
}