当前位置: 首页>>代码示例>>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;未经允许,请勿转载。