chyezh c725416288
enhance: move streaming proto into pkg (#35284)
issue: #33285

- move streaming related proto into pkg.
- add v2 message type and change flush message into v2 message.

Signed-off-by: chyezh <chyezh@outlook.com>
2024-08-07 10:34:16 +08:00

31 lines
665 B
Go

package message
import "strconv"
var (
VersionOld Version = 0 // old version before streamingnode.
VersionV1 Version = 1 // The message marshal unmarshal still use msgstream.
VersionV2 Version = 2 // The message marshal unmsarhsl is not rely on msgstream.
)
type Version int // message version for compatibility.
func newMessageVersionFromString(s string) Version {
if s == "" {
return VersionOld
}
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
panic("unexpected message version")
}
return Version(v)
}
func (v Version) String() string {
return strconv.FormatInt(int64(v), 10)
}
func (v Version) GT(v2 Version) bool {
return v > v2
}