BIND 10 #172: cc channel - use JSON

BIND 10 Development do-not-reply at isc.org
Wed Jun 16 11:58:59 UTC 2010


#172: cc channel - use JSON
----------------------+-----------------------------------------------------
 Reporter:  larissas  |        Owner:  UnAssigned                                    
     Type:  task      |       Status:  reviewing                                     
 Priority:  major     |    Milestone:  05. 3rd Incremental Release: Serious Secondary
Component:  msgq      |   Resolution:                                                
 Keywords:            |    Sensitive:  0                                             
----------------------+-----------------------------------------------------
Changes (by jelte):

  * owner:  jelte => UnAssigned
  * status:  assigned => reviewing


Comment:

 Ok, changes in branches/trac172.

 For the python side, message.to_wire and from_wire are now simply
 functions that call json conversion (which is included in python).

 For the c++ side, we had three options; Boost has some limited support
 through property trees to read and write jsons, but property tree do not
 really map all that well to JSON and the way we use the data. We could
 have used a JSON library, like json-spirit (which in itself uses boost),
 but this was essentially what we already had but with a different API. So
 I decided to simply extend our Element class to do full JSON.

 So toJSON(ostream) convers to JSON and fromJSON parses it. .str() and
 .to_wire() are now essentially the same, but in the future we could add
 formatting options to the string output.

 Since the Element representation already was a subset of JSON, this didn't
 change much in all the other code (including msgq itself, btw).

 Two possible enhancements that are left are to abstract from specific
 number types until you need them (and make one NumberElement instead of
 IntElement and DoubleElement, that also has a variable e, so numbers
 aren't tied to the size of int), and checks that strings only contain the
 right escapes.

 Oh and we should rename the data namespace imo, and perhaps Element and
 ElementPtr too, but those changes would be quite simple to do in a
 separate ticket/branch (easier both to perform and to review if there are
 no other code changes).

 Ready for review.

-- 
Ticket URL: <https://bind10.isc.org/ticket/172#comment:5>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list