當前位置: 首頁>>代碼示例>>Golang>>正文


Golang internal.Data類代碼示例

本文整理匯總了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)
	}
}
開發者ID:rwarren,項目名稱:influxdb,代碼行數:38,代碼來源:data.go

示例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)
	}
}
開發者ID:ChenXiukun,項目名稱:influxdb,代碼行數:19,代碼來源:data.go


注:本文中的github.com/influxdata/influxdb/services/meta/internal.Data類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。