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


Golang zk.CreateOrUpdate函數代碼示例

本文整理匯總了Golang中github.com/youtube/vitess/go/zk.CreateOrUpdate函數的典型用法代碼示例。如果您正苦於以下問題:Golang CreateOrUpdate函數的具體用法?Golang CreateOrUpdate怎麽用?Golang CreateOrUpdate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CreateOrUpdate函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: WriteAddrs

// WriteAddrs writes a ZknsAddres record to a path in Zookeeper.
func WriteAddrs(zconn zk.Conn, zkPath string, addrs *ZknsAddrs) error {
	if !(addrs.IsValidA() || addrs.IsValidCNAME() || addrs.IsValidSRV()) {
		return fmt.Errorf("invalid addrs: %v", zkPath)
	}
	data := toJson(addrs)
	_, err := zk.CreateOrUpdate(zconn, zkPath, data, 0, zookeeper.WorldACL(zk.PERM_FILE), true)
	return err
}
開發者ID:pranjal5215,項目名稱:vitess,代碼行數:9,代碼來源:zkns.go

示例2: writeAddrs

func writeAddrs(zconn zk.Conn, zkPath string, addrs *LegacyZknsAddrs) error {
	data, err := json.MarshalIndent(addrs, "", "  ")
	if err != nil {
		return err
	}
	_, err = zk.CreateOrUpdate(zconn, zkPath, string(data), 0, zookeeper.WorldACL(zookeeper.PERM_ALL), true)
	return err
}
開發者ID:richarwu,項目名稱:vitess,代碼行數:8,代碼來源:zkns.go

示例3: SaveVSchema

// SaveVSchema saves the JSON vschema into the topo.
func (zkts *Server) SaveVSchema(ctx context.Context, vschema string) error {
	_, err := planbuilder.NewSchema([]byte(vschema))
	if err != nil {
		return err
	}
	_, err = zk.CreateOrUpdate(zkts.zconn, globalVSchemaPath, vschema, 0, zookeeper.WorldACL(zookeeper.PERM_ALL), true)
	return err
}
開發者ID:littleyang,項目名稱:vitess,代碼行數:9,代碼來源:vschema.go

示例4: SaveVSchema

// SaveVSchema saves the vschema into the topo.
func (zkts *Server) SaveVSchema(ctx context.Context, keyspace string, vschema *vschemapb.Keyspace) error {
	data, err := json.MarshalIndent(vschema, "", "  ")
	if err != nil {
		return err
	}
	vschemaPath := path.Join(GlobalKeyspacesPath, keyspace, vschemaPath)
	_, err = zk.CreateOrUpdate(zkts.zconn, vschemaPath, string(data), 0, zookeeper.WorldACL(zookeeper.PermAll), true)
	return convertError(err)
}
開發者ID:jmptrader,項目名稱:vitess,代碼行數:10,代碼來源:vschema.go

示例5: SaveVSchema

// SaveVSchema saves the JSON vschema into the topo.
func (zkts *Server) SaveVSchema(ctx context.Context, keyspace, vschema string) error {
	err := vindexes.ValidateVSchema([]byte(vschema))
	if err != nil {
		return err
	}
	vschemaPath := path.Join(GlobalKeyspacesPath, keyspace, vschemaPath)
	_, err = zk.CreateOrUpdate(zkts.zconn, vschemaPath, vschema, 0, zookeeper.WorldACL(zookeeper.PERM_ALL), true)
	return err
}
開發者ID:aaijazi,項目名稱:vitess,代碼行數:10,代碼來源:vschema.go

示例6: writeAddrs

func writeAddrs(zconn zk.Conn, zkPath string, addrs *LegacyZknsAddrs) error {
	data := jscfg.ToJSON(addrs)
	_, err := zk.CreateOrUpdate(zconn, zkPath, data, 0, zookeeper.WorldACL(zookeeper.PERM_ALL), true)
	return err
}
開發者ID:haoqoo,項目名稱:vitess,代碼行數:5,代碼來源:zkns.go

示例7: WriteAddr

func WriteAddr(zconn zk.Conn, zkPath string, addr *zkns.ZknsAddr) error {
	data := jscfg.ToJson(addr)
	_, err := zk.CreateOrUpdate(zconn, zkPath, data, 0, zookeeper.WorldACL(zookeeper.PERM_ALL), true)
	return err
}
開發者ID:Eric-Chen,項目名稱:vitess,代碼行數:5,代碼來源:zkns.go


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