本文整理匯總了Golang中github.com/influxdata/influxdb/services/meta/internal.Data類的典型用法代碼示例。如果您正苦於以下問題:Golang Data類的具體用法?Golang Data怎麽用?Golang Data使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Data類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: unmarshal
// unmarshal deserializes from a protobuf representation.
func (data *Data) unmarshal(pb *internal.Data) {
data.Term = pb.GetTerm()
data.Index = pb.GetIndex()
data.ClusterID = pb.GetClusterID()
data.MaxNodeID = pb.GetMaxNodeID()
data.MaxShardGroupID = pb.GetMaxShardGroupID()
data.MaxShardID = pb.GetMaxShardID()
// TODO: Nodes is deprecated. This is being left here to make migration from 0.9.x to 0.10.0 possible
if len(pb.GetNodes()) > 0 {
data.DataNodes = make([]NodeInfo, len(pb.GetNodes()))
for i, x := range pb.GetNodes() {
data.DataNodes[i].unmarshal(x)
}
} else {
data.DataNodes = make([]NodeInfo, len(pb.GetDataNodes()))
for i, x := range pb.GetDataNodes() {
data.DataNodes[i].unmarshal(x)
}
}
data.MetaNodes = make([]NodeInfo, len(pb.GetMetaNodes()))
for i, x := range pb.GetMetaNodes() {
data.MetaNodes[i].unmarshal(x)
}
data.Databases = make([]DatabaseInfo, len(pb.GetDatabases()))
for i, x := range pb.GetDatabases() {
data.Databases[i].unmarshal(x)
}
data.Users = make([]UserInfo, len(pb.GetUsers()))
for i, x := range pb.GetUsers() {
data.Users[i].unmarshal(x)
}
}
示例2: unmarshal
// unmarshal deserializes from a protobuf representation.
func (data *Data) unmarshal(pb *internal.Data) {
data.Term = pb.GetTerm()
data.Index = pb.GetIndex()
data.ClusterID = pb.GetClusterID()
data.MaxShardGroupID = pb.GetMaxShardGroupID()
data.MaxShardID = pb.GetMaxShardID()
data.Databases = make([]DatabaseInfo, len(pb.GetDatabases()))
for i, x := range pb.GetDatabases() {
data.Databases[i].unmarshal(x)
}
data.Users = make([]UserInfo, len(pb.GetUsers()))
for i, x := range pb.GetUsers() {
data.Users[i].unmarshal(x)
}
}