[ 
https://issues.apache.org/jira/browse/HBASE-10771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13951095#comment-13951095
 ] 

stack commented on HBASE-10771:
-------------------------------

Why again is it that we don't just do ByteBuffer?  ByteRange doc says:

{code}
 * This interface differs from ByteBuffer:
 * <li>On-heap bytes only</li>
 * <li>Raw {@code byte} access only; does not encode other primitives.</li>
 * <li>Implements {@code equals(Object)}, {@code #hashCode()}, and
 * {@code #compareTo(ByteRange)} so that it can be used in standard java
 * Collections. Comparison operations are lexicographic, which is native to
 * HBase.</li>
 * <li>Allows the addition of simple core methods like the deep and shallow
 * copy methods.</li>
 * <li>Can be reused in tight loops like a major compaction which can save
 * significant amounts of garbage. (Without reuse, we throw off garbage like
 * <a href="http://www.youtube.com/watch?v=lkmBH-MjZF4";>this thing</a>.)</li>
 * </p>
 * <p>
 * Mutable, and always evaluates {@code #equals(Object)}, {@code #hashCode()},
 * and {@code #compareTo(ByteRange)} based on the current contents.
 * </p>
 * <p>
 * Can contain convenience methods for comparing, printing, cloning, spawning
 * new arrays, copying to other arrays, etc. Please place non-core methods into
 * {@link ByteRangeUtils}.
{code}

So, we are violating at least the first two items in the Interface with these 
changes, right?

Will we want to evolve to this 
http://netty.io/4.0/api/io/netty/buffer/ByteBuf.html eventually?  Or pull in 
some of this functionality too?  (If we did ByteBuf, then we'd have other 
facility available to us from netty)

Have we written up an end-to-end for ByteRange any place going in and out?  
Pardon me if we have and I've just not kept up.

> Primitive type put/get APIs in ByteRange 
> -----------------------------------------
>
>                 Key: HBASE-10771
>                 URL: https://issues.apache.org/jira/browse/HBASE-10771
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John
>             Fix For: 0.99.0
>
>         Attachments: HBASE-10771.patch, HBASE-10771_V2.patch
>
>
> While doing HBASE-10713 I came across the need to write int/long (and read 
> also) from a ByteRange.  CellBlocks are backed by ByteRange. So we can add 
> such APIs.
> Also as per HBASE-10750  we return a ByteRange from MSLAB and also discussion 
> under HBASE-10191 suggest we can have BR backed HFileBlocks etc.  



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to