本文整理汇总了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
}
示例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
}
示例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
}
示例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)
}
示例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
}
示例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
}
示例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
}