getPeerSync returns the peer if it has been creaated, and other wise creates it.
(peer string)
| 203 | // getPeerSync returns the peer if it has been creaated, and other wise creates |
| 204 | // it. |
| 205 | func (r *replicator) getPeerSync(peer string) *peerSync { |
| 206 | r.lock.Lock() |
| 207 | defer r.lock.Unlock() |
| 208 | p, ok := r.peers[peer] |
| 209 | if ok { |
| 210 | return p |
| 211 | } |
| 212 | |
| 213 | p = newPeerSync(peer, r) |
| 214 | r.peers[peer] = p |
| 215 | return p |
| 216 | } |
| 217 | |
| 218 | // peerSync is used to replicate keys to a particular peer |
| 219 | type peerSync struct { |
no test coverage detected