本文整理汇总了Golang中github.com/youtube/vitess/go/zk.NewMetaConn函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMetaConn函数的具体用法?Golang NewMetaConn怎么用?Golang NewMetaConn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMetaConn函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
zconn := zk.NewMetaConn(false)
zkts := zktopo.NewServer(zconn)
zkoccconn := zk.NewMetaConn(true)
zktsro := zktopo.NewServer(zkoccconn)
db.Register("vtdb", &sDriver{zkts, false})
db.Register("vtdb-zkocc", &sDriver{zktsro, false})
db.Register("vtdb-streaming", &sDriver{zkts, true})
db.Register("vtdb-zkocc-streaming", &sDriver{zktsro, true})
db.Register("vtdb-streaming-zkocc", &sDriver{zktsro, true})
}
示例2: main
func main() {
defer exit.Recover()
defer logutil.Flush()
zknsDomain := flag.String("zkns-domain", "", "The naming hierarchy portion to serve")
zknsRoot := flag.String("zkns-root", "", "The root path from which to resolve")
bindAddr := flag.String("bind-addr", ":31981", "Bind the debug http server")
flag.Parse()
if *bindAddr != "" {
go func() {
err := http.ListenAndServe(*bindAddr, nil)
if err != nil {
log.Errorf("ListenAndServe: %s", err)
exit.Return(1)
}
}()
}
zconn := zk.NewMetaConn()
fqdn := netutil.FullyQualifiedHostnameOrPanic()
zr1 := newZknsResolver(zconn, fqdn, *zknsDomain, *zknsRoot)
pd := &pdns{zr1}
pd.Serve(os.Stdin, os.Stdout)
os.Stdout.Close()
}
示例3: RegisterShardedDrivers
func RegisterShardedDrivers() {
// default topo server
ts := topo.GetServer()
db.Register("vtdb", &sDriver{ts, false})
db.Register("vtdb-streaming", &sDriver{ts, true})
// forced zk topo server
zconn := zk.NewMetaConn(false)
zkts := zktopo.NewServer(zconn)
db.Register("vtdb-zk", &sDriver{zkts, false})
db.Register("vtdb-zk-streaming", &sDriver{zkts, true})
// forced zkocc topo server
zkoccconn := zk.NewMetaConn(true)
zktsro := zktopo.NewServer(zkoccconn)
db.Register("vtdb-zkocc", &sDriver{zktsro, false})
db.Register("vtdb-zkocc-streaming", &sDriver{zktsro, true})
}
示例4: init
func init() {
cmdMap = map[string]cmdFunc{
"cat": cmdCat,
"chmod": cmdChmod,
"cp": cmdCp,
"edit": cmdEdit,
"elock": cmdElock,
"ls": cmdLs,
"qlock": cmdQlock,
"rm": cmdRm,
"stat": cmdStat,
"touch": cmdTouch,
"unzip": cmdUnzip,
"wait": cmdWait,
"watch": cmdWatch,
"zip": cmdZip,
}
zconn = zk.NewMetaConn()
}
示例5: init
func init() {
opts.Description = doc
cmdMap = map[string]cmdFunc{
"cat": cmdCat,
"chmod": cmdChmod,
"cp": cmdCp,
"edit": cmdEdit,
"elock": cmdElock,
"ls": cmdLs,
"qlock": cmdQlock,
"rm": cmdRm,
"stat": cmdStat,
"touch": cmdTouch,
"unzip": cmdUnzip,
"wait": cmdWait,
"watch": cmdWatch,
"zip": cmdZip,
}
log.SetFlags(0)
zconn = zk.NewMetaConn(false)
}
示例6:
import (
"flag"
"reflect"
"sync"
"time"
log "github.com/golang/glog"
"github.com/youtube/vitess/go/vt/servenv"
"github.com/youtube/vitess/go/vt/tabletserver"
"github.com/youtube/vitess/go/zk"
"launchpad.net/gozk/zookeeper"
)
var (
// Actual ZkCustomRule object in charge of rule updates
zkCustomRule = NewZkCustomRule(zk.NewMetaConn())
// Commandline flag to specify rule path in zookeeper
zkRulePath = flag.String("zkcustomrules", "", "zookeeper based custom rule path")
)
// Invalid rule version, used to mark invalid query rules
const InvalidQueryRulesVersion int64 = -1
// Zookeeper based custom rule source name
const ZkCustomRuleSource string = "ZK_CUSTOM_RULE"
// ZkCustomRule is Zookeeper backed implementation of CustomRuleManager
type ZkCustomRule struct {
mu sync.Mutex
path string
zconn zk.Conn
示例7: init
func init() {
zconn := zk.NewMetaConn()
topo.RegisterServer("zookeeper", &Server{zconn: zconn})
}
示例8: init
func init() {
zconn := zk.NewMetaConn()
stats.PublishJSONFunc("ZkMetaConn", zconn.String)
topo.RegisterServer("zookeeper", &Server{zconn: zconn})
}
示例9: init
func init() {
zkoccconn := zk.NewMetaConn(true)
topo.RegisterServer("zkocc", zktopo.NewServer(zkoccconn))
}
示例10: init
func init() {
zconn := zk.NewMetaConn(false)
stats.PublishJSONFunc("ZkMetaConn", zconn.String)
topo.RegisterServer("zookeeper", NewServer(zconn))
}
示例11: init
func init() {
zconn := zk.NewMetaConn(false)
expvar.Publish("ZkMetaConn", zconn)
topo.RegisterServer("zookeeper", NewServer(zconn))
}