[MERGE] Protocol encoding/decoding logic for protocol v3 (protocol v3 patch 6/7)

Andrew Bennetts andrew at canonical.com
Thu Apr 24 00:23:35 BST 2008


This is the sixth in a series of patches that implement version 3 of the smart
server protocol.  The full branch with all changes combined is at
<http://people.ubuntu.com/~andrew/bzr/protocol-v3-loom/>

protocol.py
-----------

This is the real guts of the new protocol logic, apart from what's in
message.py.  Lots of changes:

As mentioned before (in patch 2/7, the bzrlib.smart.message module), I've
disentangled the encoding and decoding logic.

I've added a 'Requester' class that implements the a subset of
SmartClientRequestProtocolOne's interface that is used for issuing requests
('call' and friends).

I've renamed excess_data to unused_data in a few places (a fairly arbitrary
change, it just seemed more consistent at the time).

The request decoding (i.e. server-side) for all protocol versions now catches
UnknownSmartMethod.  v1 and v2 still generate the same ugly, generic error they
always did for this.  v3 has a specific error code for it.

The _StatefulDecoder base class has grown more powerful: the state_accept
methods can raise _NeedMoreBytes.  This makes writing the state machine for the
decoders a little easier and neater, and also made implementing next_read_size
in the new protocol much simpler.

read_response_tuple for all protocol versions now raise ErrorFromSmartServer if
the response was an error, rather than leaving it up to the caller to notice an
error.  (See also patch 5/7)


-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-protocol-logic.patch
Type: text/x-diff
Size: 23851 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080424/259cc889/attachment-0002.bin 


More information about the bazaar mailing list