<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Not sure I understand. Why does this need to be as complex as this? When you say encoding of data, surely all this data is, is a byte[]?<div><br></div><div><div><div>On 18 Feb 2010, at 15:26, Galder Zamarreno wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br>I've been looking again at the encoding of data in Hot Rod <br>(<a href="http://community.jboss.org/wiki/HotRodProtocol">http://community.jboss.org/wiki/HotRodProtocol</a>) and there's a few things <br>I'm not too happy about or they're not totally clear:<br><br>1. The type appears to be pretty wasteful because the majority of types <br>cannot combined with others, for example: You cannot have a type that is <br>Boolean and Long at the same time, or Double and Character. However, you <br>can potentially have an Arrays of Serialized. So, I propose instead <br>separating between a meta type and type.<br><br>Meta types would be: Array, Map, Primitive and Compressed. The meta type <br>would be encoded using bit ops, so you could combine them in diff ways, <br>i.e. Array of primitives. I don't think we should support combinations off <br>diff collections, i.e Map of Array, or Array of Maps. It would complexity <br>and don't forsee an immediate req for this.<br><br>Type would be: Byte, Boolean, Character, String, Date, Double, Float, <br>Integer, Long, Short, Serialized, StringBuilder, and Any. These would <br>literals from 1 to N. Note that I've added Any to separate between two <br>different collections. For example, if you send an Array of String, each <br>individual element just follows together with its size. However, if you <br>send an Array of Any, each individual entry must define its type.<br><br>For Maps, we've got two options: First, no type assumptions made and let <br>each key/value define its own type. Or allow maps meta-type definitions to <br>be followed by not one but two type fields. Even if the map was of mixed <br>types, you could have Any, Any. My preference is for the latter.<br><br>Both type and metatype would be variable length integers.<br><br>2. Serialized will be stored as byte[] internally, no attempt to <br>unmarshalling will be done in Hot Rod. Clients decide how they wanna <br>marshall this Serialized types. They just need to gives us a byte[] and <br>its length.<br></div></blockquote><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font>3. To clarify something that Alex mentioned in the previous encoding data <br>email, Arrays and Maps are followed by the number of items in Hot Rod and <br>not the number of bytes. In case of Arrays of Any, each individual field <br>gives us its size, type and the data. In case of Array of Booleans, each <br>individual field comes with size and data. Size might have been optional <br>in each field of Array of Boolean, but it simplifies deadling with Array <br>of Serialized, where each individual field is a byte[] of arbitrary length.<br><br>For Maps, a similar thing happens. If we have a Map of String, Boolean, we <br>get key/value pair like: k=[size+data]v=[size+data]. If it's a Map of Any, <br>Any, we get k=[type+size+data],v=[size+data]<br></div></blockquote><div><br></div></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div>Lead, Infinispan</div><div>Lead, JBoss Cache</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><a href="http://www.jbosscache.org">http://www.jbosscache.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></div></body></html>