forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zkstat_bson.go
77 lines (68 loc) · 2.21 KB
/
zkstat_bson.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package zk
// DO NOT EDIT.
// FILE GENERATED BY BSONGEN.
import (
"bytes"
"github.com/youtube/vitess/go/bson"
"github.com/youtube/vitess/go/bytes2"
)
// MarshalBson bson-encodes ZkStat.
func (zkStat *ZkStat) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeInt64(buf, "Czxid", zkStat.czxid)
bson.EncodeInt64(buf, "Mzxid", zkStat.mzxid)
bson.EncodeTime(buf, "CTime", zkStat.cTime)
bson.EncodeTime(buf, "MTime", zkStat.mTime)
bson.EncodeInt(buf, "Version", zkStat.version)
bson.EncodeInt(buf, "CVersion", zkStat.cVersion)
bson.EncodeInt(buf, "AVersion", zkStat.aVersion)
bson.EncodeInt64(buf, "EphemeralOwner", zkStat.ephemeralOwner)
bson.EncodeInt(buf, "DataLength", zkStat.dataLength)
bson.EncodeInt(buf, "NumChildren", zkStat.numChildren)
bson.EncodeInt64(buf, "Pzxid", zkStat.pzxid)
lenWriter.Close()
}
// UnmarshalBson bson-decodes into ZkStat.
func (zkStat *ZkStat) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for ZkStat", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Czxid":
zkStat.czxid = bson.DecodeInt64(buf, kind)
case "Mzxid":
zkStat.mzxid = bson.DecodeInt64(buf, kind)
case "CTime":
zkStat.cTime = bson.DecodeTime(buf, kind)
case "MTime":
zkStat.mTime = bson.DecodeTime(buf, kind)
case "Version":
zkStat.version = bson.DecodeInt(buf, kind)
case "CVersion":
zkStat.cVersion = bson.DecodeInt(buf, kind)
case "AVersion":
zkStat.aVersion = bson.DecodeInt(buf, kind)
case "EphemeralOwner":
zkStat.ephemeralOwner = bson.DecodeInt64(buf, kind)
case "DataLength":
zkStat.dataLength = bson.DecodeInt(buf, kind)
case "NumChildren":
zkStat.numChildren = bson.DecodeInt(buf, kind)
case "Pzxid":
zkStat.pzxid = bson.DecodeInt64(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}