本文整理匯總了Golang中github.com/couchbase/gometa/protocol.ProposalMsg.GetReqId方法的典型用法代碼示例。如果您正苦於以下問題:Golang ProposalMsg.GetReqId方法的具體用法?Golang ProposalMsg.GetReqId怎麽用?Golang ProposalMsg.GetReqId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/couchbase/gometa/protocol.ProposalMsg
的用法示例。
在下文中一共展示了ProposalMsg.GetReqId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: LogProposal
func (w *watcher) LogProposal(p protocol.ProposalMsg) error {
w.mutex.Lock()
defer w.mutex.Unlock()
msg := w.factory.CreateLogEntry(p.GetTxnid(), p.GetOpCode(), p.GetKey(), p.GetContent())
w.pendings[common.Txnid(p.GetTxnid())] = msg
handle, ok := w.pendingReqs[p.GetReqId()]
if ok {
delete(w.pendingReqs, p.GetReqId())
w.loggedReqs[common.Txnid(p.GetTxnid())] = handle
}
return nil
}
示例2: UpdateStateOnNewProposal
//
// Callback when a new proposal arrives
//
func (s *Server) UpdateStateOnNewProposal(proposal protocol.ProposalMsg) {
fid := proposal.GetFid()
reqId := proposal.GetReqId()
txnid := proposal.GetTxnid()
// If this host is the one that sends the request to the leader
if fid == s.handler.GetFollowerId() {
s.state.mutex.Lock()
defer s.state.mutex.Unlock()
// look up the request handle from the pending list and
// move it to the proposed list
handle, ok := s.state.pendings[reqId]
if ok {
delete(s.state.pendings, reqId)
s.state.proposals[common.Txnid(txnid)] = handle
}
}
}
示例3: updateRequestOnNewProposal
//
// Update the request upon new proposal.
//
func (c *Coordinator) updateRequestOnNewProposal(proposal protocol.ProposalMsg) {
fid := proposal.GetFid()
reqId := proposal.GetReqId()
txnid := proposal.GetTxnid()
logging.Debugf("Coorindator.updateRequestOnNewProposal(): recieve proposal. Txnid %d, follower id %s, coorindator fid %s",
txnid, fid, c.GetFollowerId())
// If this host is the one that sends the request to the leader
if fid == c.GetFollowerId() {
c.state.mutex.Lock()
defer c.state.mutex.Unlock()
// look up the request handle from the pending list and
// move it to the proposed list
handle, ok := c.state.pendings[reqId]
if ok {
delete(c.state.pendings, reqId)
c.state.proposals[common.Txnid(txnid)] = handle
}
}
}