本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletserver.Controller类的典型用法代码示例。如果您正苦于以下问题:Golang Controller类的具体用法?Golang Controller怎么用?Golang Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Controller类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: addStatusParts
func addStatusParts(qsc tabletserver.Controller) {
servenv.AddStatusPart("Tablet", tabletTemplate, func() interface{} {
return map[string]interface{}{
"Tablet": topo.NewTabletInfo(agent.Tablet(), -1),
"BlacklistedTables": agent.BlacklistedTables(),
"DisallowQueryService": agent.DisallowQueryService(),
"DisableUpdateStream": !agent.EnableUpdateStream(),
}
})
servenv.AddStatusFuncs(template.FuncMap{
"github_com_youtube_vitess_health_html_name": healthHTMLName,
})
servenv.AddStatusPart("Health", healthTemplate, func() interface{} {
return &healthStatus{
Records: agent.History.Records(),
Config: tabletmanager.ConfigHTML(),
}
})
qsc.AddStatusPart()
servenv.AddStatusPart("Binlog Player", binlogTemplate, func() interface{} {
return agent.BinlogPlayerMap.Status()
})
if onStatusRegistered != nil {
onStatusRegistered()
}
}
开发者ID:jmptrader,项目名称:vitess,代码行数:26,代码来源:status.go
示例2: Open
// Open try to build query rules from local file and push the rules to vttablet
func (fcr *FileCustomRule) Open(qsc tabletserver.Controller, rulePath string) error {
fcr.path = rulePath
if fcr.path == "" {
// Don't go further if path is empty
return nil
}
data, err := ioutil.ReadFile(fcr.path)
if err != nil {
log.Warningf("Error reading file %v: %v", fcr.path, err)
// Don't update any internal cache, just return error
return err
}
qrs := tabletserver.NewQueryRules()
err = qrs.UnmarshalJSON(data)
if err != nil {
log.Warningf("Error unmarshaling query rules %v", err)
return err
}
fcr.currentRuleSetTimestamp = time.Now().Unix()
fcr.currentRuleSet = qrs.Copy()
// Push query rules to vttablet
qsc.SetQueryRules(FileCustomRuleSource, qrs.Copy())
log.Infof("Custom rule loaded from file: %s", fcr.path)
return nil
}
开发者ID:littleyang,项目名称:vitess,代码行数:26,代码来源:filecustomrule.go
示例3: refreshData
// refreshData gets query rules from Zookeeper and refresh internal QueryRules cache
// this function will also call TabletServer.SetQueryRules to propagate rule changes to query service
func (zkcr *ZkCustomRule) refreshData(qsc tabletserver.Controller, nodeRemoval bool) error {
data, stat, err := zkcr.zconn.Get(zkcr.path)
zkcr.mu.Lock()
defer zkcr.mu.Unlock()
if err == nil {
qrs := tabletserver.NewQueryRules()
if !nodeRemoval {
err = qrs.UnmarshalJSON([]byte(data))
if err != nil {
log.Warningf("Error unmarshaling query rules %v, original data '%s'", err, data)
return nil
}
}
zkcr.currentRuleSetVersion = stat.Mzxid()
if !reflect.DeepEqual(zkcr.currentRuleSet, qrs) {
zkcr.currentRuleSet = qrs.Copy()
qsc.SetQueryRules(ZkCustomRuleSource, qrs.Copy())
log.Infof("Custom rule version %v fetched from Zookeeper and applied to vttablet", zkcr.currentRuleSetVersion)
}
return nil
}
log.Warningf("Error encountered when trying to get data and watch from Zk: %v", err)
return err
}
开发者ID:littleyang,项目名称:vitess,代码行数:26,代码来源:zkcustomrule.go
示例4: ActivateZkCustomRules
// ActivateZkCustomRules activates zookeeper dynamic custom rule mechanism
func ActivateZkCustomRules(qsc tabletserver.Controller) {
if *zkRulePath != "" {
qsc.RegisterQueryRuleSource(ZkCustomRuleSource)
zkCustomRule.Open(qsc, *zkRulePath)
}
}
开发者ID:littleyang,项目名称:vitess,代码行数:7,代码来源:zkcustomrule.go
示例5: ActivateFileCustomRules
// ActivateFileCustomRules activates this static file based custom rule mechanism
func ActivateFileCustomRules(qsc tabletserver.Controller) {
if *fileRulePath != "" {
qsc.RegisterQueryRuleSource(FileCustomRuleSource)
fileCustomRule.Open(qsc, *fileRulePath)
}
}
开发者ID:littleyang,项目名称:vitess,代码行数:7,代码来源:filecustomrule.go
注:本文中的github.com/youtube/vitess/go/vt/tabletserver.Controller类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论