Mercurial > public > mercurial-scm > hg
comparison mercurial/wireprototypes.py @ 40172:30f70d11c224
wireprotov2: advertise recommended batch size for requests
Currently, exchangev2 hardcodes the batch size for how many revisions
to fetch per command request. A single value is not appropriate
for every repository because some repositories may have a drastically
different "shape" from other repositories. e.g. a repo with lots of
small files may benefit from larger batch sizes than a repo with lots
of large files. And depending on caching used by the server, the server
may wish to control the number of commands (to e.g. mitigate overhead
of following content redirects).
This commit teaches wireprotov2 commands to declare extra metadata
which is advertised as part of the command descriptor. The manifestdata
command has been taught to advertise a recommended batch size for
requests.
Differential Revision: https://phab.mercurial-scm.org/D4975
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 08 Oct 2018 17:45:51 -0700 |
parents | f7011b44d205 |
children | 41263df08109 |
comparison
equal
deleted
inserted
replaced
40171:dac438b7346e | 40172:30f70d11c224 |
---|---|
233 """ | 233 """ |
234 | 234 |
235 class commandentry(object): | 235 class commandentry(object): |
236 """Represents a declared wire protocol command.""" | 236 """Represents a declared wire protocol command.""" |
237 def __init__(self, func, args='', transports=None, | 237 def __init__(self, func, args='', transports=None, |
238 permission='push', cachekeyfn=None): | 238 permission='push', cachekeyfn=None, extracapabilitiesfn=None): |
239 self.func = func | 239 self.func = func |
240 self.args = args | 240 self.args = args |
241 self.transports = transports or set() | 241 self.transports = transports or set() |
242 self.permission = permission | 242 self.permission = permission |
243 self.cachekeyfn = cachekeyfn | 243 self.cachekeyfn = cachekeyfn |
244 self.extracapabilitiesfn = extracapabilitiesfn | |
244 | 245 |
245 def _merge(self, func, args): | 246 def _merge(self, func, args): |
246 """Merge this instance with an incoming 2-tuple. | 247 """Merge this instance with an incoming 2-tuple. |
247 | 248 |
248 This is called when a caller using the old 2-tuple API attempts | 249 This is called when a caller using the old 2-tuple API attempts |