~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/trace.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-13 19:08:57 UTC
  • mto: (5050.17.7 2.2)
  • mto: This revision was merged to the branch mainline in revision 5379.
  • Revision ID: john@arbash-meinel.com-20100813190857-mvzwnimrxvm0zimp
Lots of documentation updates.

We had a lot of http links pointing to the old domain. They should
all now be properly updated to the new domain. (only bazaar-vcs.org
entry left is for pqm, which seems to still reside at the old url.)

Also removed one 'TODO' doc entry about switching to binary xdelta, since
we basically did just that with groupcompress.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
and then delegates it.
21
21
"""
22
22
 
23
 
from bzrlib.transport.decorator import TransportDecorator, DecoratorServer
24
 
 
25
 
 
26
 
class TransportTraceDecorator(TransportDecorator):
 
23
from bzrlib.transport import decorator
 
24
 
 
25
 
 
26
class TransportTraceDecorator(decorator.TransportDecorator):
27
27
    """A tracing decorator for Transports.
28
28
 
29
29
    Calls that potentially perform IO are logged to self._activity. The
33
33
    Not all operations are logged at this point, if you need an unlogged
34
34
    operation please add a test to the tests of this transport, for the logging
35
35
    of the operation you want logged.
 
36
 
 
37
    See also TransportLogDecorator, that records a machine-readable log in 
 
38
    memory for eg testing.
36
39
    """
37
40
 
38
41
    def __init__(self, url, _decorated=None, _from_transport=None):
40
43
 
41
44
        _decorated is a private parameter for cloning.
42
45
        """
43
 
        TransportDecorator.__init__(self, url, _decorated)
 
46
        super(TransportTraceDecorator, self).__init__(url, _decorated)
44
47
        if _from_transport is None:
45
48
            # newly created
46
49
            self._activity = []
126
129
 
127
130
    def readv(self, relpath, offsets, adjust_for_latency=False,
128
131
        upper_limit=None):
129
 
        """See Transport.readv."""
 
132
        # we override at the readv() level rather than _readv() so that any
 
133
        # latency adjustments will be done by the underlying transport
130
134
        self._trace(('readv', relpath, offsets, adjust_for_latency,
131
135
            upper_limit))
132
136
        return self._decorated.readv(relpath, offsets, adjust_for_latency,
165
169
        self._activity.append(operation_tuple)
166
170
 
167
171
 
168
 
class TraceServer(DecoratorServer):
169
 
    """Server for the TransportTraceDecorator for testing with."""
170
 
 
171
 
    def get_decorator_class(self):
172
 
        return TransportTraceDecorator
173
 
 
174
 
 
175
172
def get_test_permutations():
176
173
    """Return the permutations to be used in testing."""
177
 
    return [(TransportTraceDecorator, TraceServer)]
 
174
    from bzrlib.tests import test_server
 
175
    return [(TransportTraceDecorator, test_server.TraceServer)]