[MERGE] Add bzrlib.smart.message module: new abstractions for protocol logic (protocol v3 patch 2/7)

Andrew Bennetts andrew at canonical.com
Wed Apr 23 23:54:06 BST 2008


This is the second 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/>

message.py
----------

New abstractions for handling smart server messages.  The previous protocol
logic was implemented basically by a pair of classes:
SmartServerRequestProtocolNNN/SmartClientRequestProtocolNNN.  I've broken these
into smaller pieces:
 - RequestEncoder
 - RequestDecoder
 - ResponseEncoder
 - ResponseDecoder
 - RequestHandler
 - ResponseHandler

This has made testing and reasoning about the code simpler.

The Decoder classes take bytes, and turn them into events that are dispatched to
a MessageHandler.  bzrlib.smart.message implements ConventionalRequestHandler
and ConventionalResponseHandler.  (See the v3 specification in
network-protocol.txt for the meaning of "conventional" in this context.)
ResponseHandler implements a subset of the interface from
SmartClientRequestProtocolOne, the parts useful to client code in
bzrlib.smart.client (and thus to bzrlib.remote and bzrlib.transport.remote).

client.py
---------

Change _build_client_protocol to return separate encoder and handler objects.

-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-message-module.patch
Type: text/x-diff
Size: 14710 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080424/92f5c097/attachment-0002.bin 


More information about the bazaar mailing list