(r *Runtime, req interface{}, minCount int)
| 53 | } |
| 54 | |
| 55 | func newTracker(r *Runtime, req interface{}, minCount int) (t *rpcTracker) { |
| 56 | // copy nodes |
| 57 | nodes := append([]proto.NodeID(nil), r.followers...) |
| 58 | |
| 59 | if minCount > len(nodes) { |
| 60 | minCount = len(nodes) |
| 61 | } |
| 62 | if minCount < 0 { |
| 63 | minCount = 0 |
| 64 | } |
| 65 | |
| 66 | t = &rpcTracker{ |
| 67 | r: r, |
| 68 | nodes: nodes, |
| 69 | method: r.applyRPCMethod, |
| 70 | req: req, |
| 71 | minCount: minCount, |
| 72 | errors: make(map[proto.NodeID]error, len(nodes)), |
| 73 | doneCh: make(chan struct{}), |
| 74 | } |
| 75 | |
| 76 | return |
| 77 | } |
| 78 | |
| 79 | func (t *rpcTracker) send() { |
| 80 | if !atomic.CompareAndSwapUint32(&t.sent, 0, 1) { |
no outgoing calls