本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletmanager/actionnode.ActionNode.Error方法的典型用法代码示例。如果您正苦于以下问题:Golang ActionNode.Error方法的具体用法?Golang ActionNode.Error怎么用?Golang ActionNode.Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/tabletmanager/actionnode.ActionNode
的用法示例。
在下文中一共展示了ActionNode.Error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: StoreActionResponse
// Write the result of an action into topology server
func StoreActionResponse(ts topo.Server, actionNode *actionnode.ActionNode, actionPath string, actionErr error) error {
// change our state
if actionErr != nil {
// on failure, set an error field on the node
actionNode.Error = actionErr.Error()
actionNode.State = actionnode.ACTION_STATE_FAILED
} else {
actionNode.Error = ""
actionNode.State = actionnode.ACTION_STATE_DONE
}
actionNode.Pid = 0
// Write the data first to our action node, then to the log.
// In the error case, this node will be left behind to debug.
data := actionNode.ToJson()
return ts.StoreTabletActionResponse(actionPath, data)
}
示例2: unlockShard
func (wr *Wrangler) unlockShard(keyspace, shard string, actionNode *actionnode.ActionNode, lockPath string, actionError error) error {
// first update the actionNode
if actionError != nil {
log.Infof("Unlocking shard %v/%v for action %v with error %v", keyspace, shard, actionNode.Action, actionError)
actionNode.Error = actionError.Error()
actionNode.State = actionnode.ACTION_STATE_FAILED
} else {
log.Infof("Unlocking shard %v/%v for successful action %v", keyspace, shard, actionNode.Action)
actionNode.Error = ""
actionNode.State = actionnode.ACTION_STATE_DONE
}
err := wr.ts.UnlockShardForAction(keyspace, shard, lockPath, actionNode.ToJson())
if actionError != nil {
if err != nil {
// this will be masked
log.Warningf("UnlockShardForAction failed: %v", err)
}
return actionError
}
return err
}