282 ipeerrequests): |
282 ipeerrequests): |
283 """Unified interface for peer repositories. |
283 """Unified interface for peer repositories. |
284 |
284 |
285 All peer instances must conform to this interface. |
285 All peer instances must conform to this interface. |
286 """ |
286 """ |
287 def iterbatch(): |
|
288 """Obtain an object to be used for multiple method calls. |
|
289 |
|
290 Various operations call several methods on peer instances. If each |
|
291 method call were performed immediately and serially, this would |
|
292 require round trips to remote peers and/or would slow down execution. |
|
293 |
|
294 Some peers have the ability to "batch" method calls to avoid costly |
|
295 round trips or to facilitate concurrent execution. |
|
296 |
|
297 This method returns an object that can be used to indicate intent to |
|
298 perform batched method calls. |
|
299 |
|
300 The returned object is a proxy of this peer. It intercepts calls to |
|
301 batchable methods and queues them instead of performing them |
|
302 immediately. This proxy object has a ``submit`` method that will |
|
303 perform all queued batchable method calls. A ``results()`` method |
|
304 exposes the results of queued/batched method calls. It is a generator |
|
305 of results in the order they were called. |
|
306 |
|
307 Not all peers or wire protocol implementations may actually batch method |
|
308 calls. However, they must all support this API. |
|
309 """ |
|
310 |
287 |
311 class ipeerbaselegacycommands(ipeerbase, ipeerlegacycommands): |
288 class ipeerbaselegacycommands(ipeerbase, ipeerlegacycommands): |
312 """Unified peer interface that supports legacy commands.""" |
289 """Unified peer interface that supports legacy commands.""" |
313 |
290 |
314 @zi.implementer(ipeerbase) |
291 @zi.implementer(ipeerbase) |