本文整理匯總了Golang中github.com/cockroachdb/cockroach/proto.InternalHeartbeatTxnResponse.Status方法的典型用法代碼示例。如果您正苦於以下問題:Golang InternalHeartbeatTxnResponse.Status方法的具體用法?Golang InternalHeartbeatTxnResponse.Status怎麽用?Golang InternalHeartbeatTxnResponse.Status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/proto.InternalHeartbeatTxnResponse
的用法示例。
在下文中一共展示了InternalHeartbeatTxnResponse.Status方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: InternalHeartbeatTxn
// InternalHeartbeatTxn updates the transaction status and heartbeat
// timestamp after receiving transaction heartbeat messages from
// coordinator. The range will return the current status for this
// transaction to the coordinator.
func (r *Range) InternalHeartbeatTxn(args *proto.InternalHeartbeatTxnRequest, reply *proto.InternalHeartbeatTxnResponse) {
// Create the actual key to the system-local transaction table.
key := engine.MakeKey(engine.KeyLocalTransactionPrefix, args.Key)
var txn proto.Transaction
if _, err := engine.GetProto(r.engine, key, &txn); err != nil {
reply.SetGoError(err)
return
}
if txn.Status == proto.PENDING {
if !args.Header().Timestamp.Less(txn.LastHeartbeat) {
txn.LastHeartbeat = args.Header().Timestamp
}
if err := engine.PutProto(r.engine, key, &txn); err != nil {
reply.SetGoError(err)
return
}
}
reply.Status = txn.Status
}