Ejemplo n.º 1
0
func (zkPathV *ZkPathV) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeStringArray(buf, "Paths", zkPathV.Paths)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 2
0
func (zkPathV *ZkPathV) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeStringArray(buf, "Paths", zkPathV.Paths)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 3
0
func (ste *StreamEvent) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)
	bson.EncodeString(buf, "Category", ste.Category)
	bson.EncodeString(buf, "TableName", ste.TableName)
	bson.EncodeStringArray(buf, "PKColNames", ste.PKColNames)
	MarshalPKValuesBson(buf, "PKValues", ste.PKValues)
	bson.EncodeString(buf, "Sql", ste.Sql)
	bson.EncodeInt64(buf, "Timestamp", ste.Timestamp)
	bson.EncodeInt64(buf, "GroupId", ste.GroupId)
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 4
0
func (zkNode *ZkNode) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Path", zkNode.Path)
	bson.EncodeString(buf, "Data", zkNode.Data)
	zkNode.Stat.MarshalBson(buf, "Stat")
	bson.EncodeStringArray(buf, "Children", zkNode.Children)
	bson.EncodeBool(buf, "Cached", zkNode.Cached)
	bson.EncodeBool(buf, "Stale", zkNode.Stale)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 5
0
// MarshalBson marshals BatchQueryShard into buf.
func (bqs *BatchQueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	tproto.EncodeQueriesBson(bqs.Queries, "Queries", buf)
	bson.EncodeString(buf, "Keyspace", bqs.Keyspace)
	bson.EncodeStringArray(buf, "Shards", bqs.Shards)
	bson.EncodeString(buf, "TabletType", string(bqs.TabletType))

	if bqs.Session != nil {
		bqs.Session.MarshalBson(buf, "Session")
	}

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 6
0
// MarshalBson marshals QueryShard into buf.
func (qrs *QueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "Sql", qrs.Sql)
	tproto.EncodeBindVariablesBson(buf, "BindVariables", qrs.BindVariables)
	bson.EncodeString(buf, "Keyspace", qrs.Keyspace)
	bson.EncodeStringArray(buf, "Shards", qrs.Shards)
	bson.EncodeString(buf, "TabletType", string(qrs.TabletType))

	if qrs.Session != nil {
		qrs.Session.MarshalBson(buf, "Session")
	}

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 7
0
func (bqs *BatchQueryShard) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Array, "Queries")
	encodeQueriesBson(bqs.Queries, buf)

	bson.EncodePrefix(buf, bson.Long, "SessionId")
	bson.EncodeUint64(buf, uint64(bqs.SessionId))

	bson.EncodePrefix(buf, bson.Binary, "Keyspace")
	bson.EncodeString(buf, bqs.Keyspace)

	bson.EncodeStringArray(buf, "Shards", bqs.Shards)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 8
0
func (qrs *QueryShard) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "Sql")
	bson.EncodeString(buf, qrs.Sql)

	bson.EncodePrefix(buf, bson.Object, "BindVariables")
	vproto.EncodeBindVariablesBson(buf, qrs.BindVariables)

	bson.EncodePrefix(buf, bson.Long, "SessionId")
	bson.EncodeUint64(buf, uint64(qrs.SessionId))

	bson.EncodePrefix(buf, bson.Binary, "Keyspace")
	bson.EncodeString(buf, qrs.Keyspace)

	bson.EncodeStringArray(buf, "Shards", qrs.Shards)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
Ejemplo n.º 9
0
func (zkNode *ZkNode) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "Path")
	bson.EncodeString(buf, zkNode.Path)

	bson.EncodePrefix(buf, bson.Binary, "Data")
	bson.EncodeString(buf, zkNode.Data)

	bson.EncodePrefix(buf, bson.Object, "Stat")
	zkNode.Stat.MarshalBson(buf)

	bson.EncodeStringArray(buf, "Children", zkNode.Children)

	bson.EncodePrefix(buf, bson.Boolean, "Cached")
	bson.EncodeBool(buf, zkNode.Cached)

	bson.EncodePrefix(buf, bson.Boolean, "Stale")
	bson.EncodeBool(buf, zkNode.Stale)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}