comparison mercurial/wireprototypes.py @ 40020:ed919b90acda

wireprotov2: define type to represent pre-encoded object An upcoming commit will introduce a caching layer to command serving. This will require the ability to cache pre-encoded data. This commit introduces a type to represent pre-encoded data and teaches the output layer to not CBOR encode an instance of that type. Differential Revision: https://phab.mercurial-scm.org/D4772
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 26 Sep 2018 17:16:27 -0700
parents d059cb669632
children c537144fdbef
comparison
equal deleted inserted replaced
40019:f5a05bb48116 40020:ed919b90acda
8 from .node import ( 8 from .node import (
9 bin, 9 bin,
10 hex, 10 hex,
11 ) 11 )
12 from .i18n import _ 12 from .i18n import _
13 from .thirdparty import (
14 attr,
15 )
13 from . import ( 16 from . import (
14 error, 17 error,
15 util, 18 util,
16 ) 19 )
17 from .utils import ( 20 from .utils import (
350 'compression engines') % config, 353 'compression engines') % config,
351 hint=_('usable compression engines: %s') % 354 hint=_('usable compression engines: %s') %
352 ', '.sorted(validnames)) 355 ', '.sorted(validnames))
353 356
354 return compengines 357 return compengines
358
359 @attr.s
360 class encodedresponse(object):
361 """Represents response data that is already content encoded.
362
363 Wire protocol version 2 only.
364
365 Commands typically emit Python objects that are encoded and sent over the
366 wire. If commands emit an object of this type, the encoding step is bypassed
367 and the content from this object is used instead.
368 """
369 data = attr.ib()