예제 #1
0
func (ste *StreamEvent) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Category":
			ste.Category = bson.DecodeString(buf, kind)
		case "TableName":
			ste.TableName = bson.DecodeString(buf, kind)
		case "PKColNames":
			ste.PKColNames = bson.DecodeStringArray(buf, kind)
		case "PKValues":
			ste.PKValues = UnmarshalPKValuesBson(buf, kind)
		case "Sql":
			ste.Sql = bson.DecodeString(buf, kind)
		case "Timestamp":
			ste.Timestamp = bson.DecodeInt64(buf, kind)
		case "GroupId":
			ste.GroupId = bson.DecodeInt64(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #2
0
func (zkStat *ZkStat) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		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:
			panic(bson.NewBsonError("Unrecognized tag %s for ZkStat", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #3
0
func (ste *StreamEvent) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Category":
			ste.Category = bson.DecodeString(buf, kind)
		case "TableName":
			ste.TableName = bson.DecodeString(buf, kind)
		case "PKColNames":
			ste.PKColNames = bson.DecodeStringArray(buf, kind)
		case "PKValues":
			ste.PKValues = UnmarshalPKValuesBson(buf, kind)
		case "Sql":
			ste.Sql = bson.DecodeString(buf, kind)
		case "Timestamp":
			ste.Timestamp = bson.DecodeInt64(buf, kind)
		case "GroupId":
			ste.GroupId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #4
0
// UnmarshalBson bson-decodes into ShardSession.
func (shardSession *ShardSession) 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 ShardSession", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Keyspace":
			shardSession.Keyspace = bson.DecodeString(buf, kind)
		case "Shard":
			shardSession.Shard = bson.DecodeString(buf, kind)
		case "TabletType":
			shardSession.TabletType.UnmarshalBson(buf, kind)
		case "TransactionId":
			shardSession.TransactionId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #5
0
func UnmarshalPKRowBson(buf *bytes.Buffer, kind byte) []interface{} {
	switch kind {
	case bson.Array:
		// valid
	case bson.Null:
		return nil
	default:
		panic(bson.NewBsonError("Unexpected data type %v for Query.Row", kind))
	}

	bson.Next(buf, 4)
	row := make([]interface{}, 0, 8)
	kind = bson.NextByte(buf)
	for i := 0; kind != bson.EOO; i++ {
		bson.ExpectIndex(buf, i)
		var val interface{}
		switch kind {
		case bson.Binary, bson.String:
			val = bson.DecodeString(buf, kind)
		case bson.Long:
			val = bson.DecodeInt64(buf, kind)
		case bson.Ulong:
			val = bson.DecodeUint64(buf, kind)
		}
		row = append(row, val)
		kind = bson.NextByte(buf)
	}
	return row
}
예제 #6
0
// UnmarshalBson bson-decodes into BinlogTransaction.
func (binlogTransaction *BinlogTransaction) 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 BinlogTransaction", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Statements":
			// []Statement
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for binlogTransaction.Statements", kind))
				}
				bson.Next(buf, 4)
				binlogTransaction.Statements = make([]Statement, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v1 Statement
					_v1.UnmarshalBson(buf, kind)
					binlogTransaction.Statements = append(binlogTransaction.Statements, _v1)
				}
			}
		case "GroupId":
			binlogTransaction.GroupId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #7
0
// UnmarshalBson bson-decodes into SessionInfo.
func (sessionInfo *SessionInfo) 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 SessionInfo", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "SessionId":
			sessionInfo.SessionId = bson.DecodeInt64(buf, kind)
		case "Err":
			// *mproto.RPCError
			if kind != bson.Null {
				sessionInfo.Err = new(mproto.RPCError)
				(*sessionInfo.Err).UnmarshalBson(buf, kind)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #8
0
파일: bson.go 프로젝트: rjammala/vitess
func (session *Session) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "TransactionId":
			session.TransactionId = bson.DecodeInt64(buf, kind)
		case "SessionId":
			session.SessionId = bson.DecodeInt64(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #9
0
파일: bson.go 프로젝트: rudyLi/vitess
func (session *Session) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "TransactionId":
			session.TransactionId = bson.DecodeInt64(buf, kind)
		case "SessionId":
			session.SessionId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #10
0
파일: bson.go 프로젝트: rjammala/vitess
func (query *Query) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Sql":
			query.Sql = bson.DecodeString(buf, kind)
		case "BindVariables":
			query.BindVariables = DecodeBindVariablesBson(buf, kind)
		case "TransactionId":
			query.TransactionId = bson.DecodeInt64(buf, kind)
		case "SessionId":
			query.SessionId = bson.DecodeInt64(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #11
0
// 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)
		}
	}
}
예제 #12
0
// UnmarshalBson bson-decodes into QueryList.
func (queryList *QueryList) 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 QueryList", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Queries":
			// []BoundQuery
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for queryList.Queries", kind))
				}
				bson.Next(buf, 4)
				queryList.Queries = make([]BoundQuery, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v1 BoundQuery
					_v1.UnmarshalBson(buf, kind)
					queryList.Queries = append(queryList.Queries, _v1)
				}
			}
		case "SessionId":
			queryList.SessionId = bson.DecodeInt64(buf, kind)
		case "AsTransaction":
			queryList.AsTransaction = bson.DecodeBool(buf, kind)
		case "TransactionId":
			queryList.TransactionId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #13
0
파일: bson.go 프로젝트: rudyLi/vitess
func (query *Query) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Sql":
			query.Sql = bson.DecodeString(buf, kind)
		case "BindVariables":
			query.BindVariables = DecodeBindVariablesBson(buf, kind)
		case "TransactionId":
			query.TransactionId = bson.DecodeInt64(buf, kind)
		case "SessionId":
			query.SessionId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #14
0
// UnmarshalBson bson-decodes into Query.
func (query *Query) 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 Query", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Sql":
			query.Sql = bson.DecodeString(buf, kind)
		case "BindVariables":
			// map[string]interface{}
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for query.BindVariables", kind))
				}
				bson.Next(buf, 4)
				query.BindVariables = make(map[string]interface{})
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v1 interface{}
					_v1 = bson.DecodeInterface(buf, kind)
					query.BindVariables[_k] = _v1
				}
			}
		case "SessionId":
			query.SessionId = bson.DecodeInt64(buf, kind)
		case "TransactionId":
			query.TransactionId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #15
0
// UnmarshalBson bson-decodes into Field.
func (field *Field) 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 Field", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Name":
			field.Name = bson.DecodeString(buf, kind)
		case "Type":
			field.Type = bson.DecodeInt64(buf, kind)
		case "Flags":
			field.Flags = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #16
0
파일: zkocc_bson.go 프로젝트: rudyLi/vitess
func (zkStat *ZkStat) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		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)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #17
0
func (stmt *Statement) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Category":
			stmt.Category = int(bson.DecodeInt64(buf, kind))
		case "Sql":
			stmt.Sql = bson.DecodeBytes(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #18
0
func (blt *BinlogTransaction) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Statements":
			blt.Statements = UnmarshalStatementsBson(buf, kind)
		case "GroupId":
			blt.GroupId = bson.DecodeInt64(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #19
0
파일: bson.go 프로젝트: rudyLi/vitess
func UnmarshalFieldBson(field *Field, buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Name":
			field.Name = bson.DecodeString(buf, kind)
		case "Type":
			field.Type = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #20
0
파일: bson.go 프로젝트: rjammala/vitess
func UnmarshalFieldBson(field *Field, buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Name":
			field.Name = bson.DecodeString(buf, kind)
		case "Type":
			field.Type = bson.DecodeInt64(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #21
0
func (stmt *Statement) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Category":
			stmt.Category = int(bson.DecodeInt64(buf, kind))
		case "Sql":
			stmt.Sql = bson.DecodeBinary(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #22
0
func (blt *BinlogTransaction) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Statements":
			blt.Statements = UnmarshalStatementsBson(buf, kind)
		case "GroupId":
			blt.GroupId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #23
0
// UnmarshalBson bson-decodes into MyType.
func (myType *MyType) 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 MyType", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Float64":
			myType.Float64 = bson.DecodeFloat64(buf, kind)
		case "String":
			myType.String = bson.DecodeString(buf, kind)
		case "Bool":
			myType.Bool = bson.DecodeBool(buf, kind)
		case "Int64":
			myType.Int64 = bson.DecodeInt64(buf, kind)
		case "Int32":
			myType.Int32 = bson.DecodeInt32(buf, kind)
		case "Int":
			myType.Int = bson.DecodeInt(buf, kind)
		case "Uint64":
			myType.Uint64 = bson.DecodeUint64(buf, kind)
		case "Uint32":
			myType.Uint32 = bson.DecodeUint32(buf, kind)
		case "Uint":
			myType.Uint = bson.DecodeUint(buf, kind)
		case "Bytes":
			myType.Bytes = bson.DecodeBinary(buf, kind)
		case "Time":
			myType.Time = bson.DecodeTime(buf, kind)
		case "Interface":
			myType.Interface = bson.DecodeInterface(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #24
0
// UnmarshalBson bson-decodes into MyType.
func (myType *MyType) 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 MyType", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Val":
			myType.Val = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #25
0
func (pos *BinlogPosition) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Position":
			pos.Position = ReplicationCoordinates{}
			pos.Position.UnmarshalBson(buf)
		case "Timestamp":
			pos.Timestamp = bson.DecodeInt64(buf, kind)
		case "Xid":
			pos.Xid = bson.DecodeUint64(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #26
0
func (bqs *BatchQueryShard) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Queries":
			bqs.Queries = decodeQueriesBson(buf, kind)
		case "SessionId":
			bqs.SessionId = bson.DecodeInt64(buf, kind)
		case "Keyspace":
			bqs.Keyspace = bson.DecodeString(buf, kind)
		case "Shards":
			bqs.Shards = bson.DecodeStringArray(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #27
0
// UnmarshalBson unmarshals ShardSession from buf.
func (shardSession *ShardSession) UnmarshalBson(buf *bytes.Buffer) {
	bson.Next(buf, 4)

	kind := bson.NextByte(buf)
	for kind != bson.EOO {
		key := bson.ReadCString(buf)
		switch key {
		case "Keyspace":
			shardSession.Keyspace = bson.DecodeString(buf, kind)
		case "Shard":
			shardSession.Shard = bson.DecodeString(buf, kind)
		case "TabletType":
			shardSession.TabletType = topo.TabletType(bson.DecodeString(buf, kind))
		case "TransactionId":
			shardSession.TransactionId = bson.DecodeInt64(buf, kind)
		default:
			panic(bson.NewBsonError("Unrecognized tag %s", key))
		}
		kind = bson.NextByte(buf)
	}
}
예제 #28
0
// UnmarshalBson bson-decodes into RPCError.
func (rPCError *RPCError) 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 RPCError", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Code":
			rPCError.Code = bson.DecodeInt64(buf, kind)
		case "Message":
			rPCError.Message = bson.DecodeString(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
예제 #29
0
// UnmarshalBson unmarshals ShardSession from buf.
func (shardSession *ShardSession) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	bson.VerifyObject(kind)
	bson.Next(buf, 4)

	kind = bson.NextByte(buf)
	for kind != bson.EOO {
		keyName := bson.ReadCString(buf)
		switch keyName {
		case "Keyspace":
			shardSession.Keyspace = bson.DecodeString(buf, kind)
		case "Shard":
			shardSession.Shard = bson.DecodeString(buf, kind)
		case "TabletType":
			shardSession.TabletType = topo.TabletType(bson.DecodeString(buf, kind))
		case "TransactionId":
			shardSession.TransactionId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
예제 #30
0
// UnmarshalBson bson-decodes into BlpPosition.
func (blpPosition *BlpPosition) 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 BlpPosition", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Uid":
			blpPosition.Uid = bson.DecodeUint32(buf, kind)
		case "GroupId":
			blpPosition.GroupId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}