hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ramkrishna.s.vasudevan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-10771) Primitive type put/get APIs in ByteRange
Date Mon, 24 Mar 2014 06:30:48 GMT

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

ramkrishna.s.vasudevan commented on HBASE-10771:
------------------------------------------------

I think we could name the put() as putInt, putShort, putLong and can have the variant with
index as param also. 
Also 
{code}
+  /**
+   * Store {@code buf} another {@link PositionedByteRange} into the current one
+   * @param buf
+   *          the byterange to store.
+   * @return this.
+   */
+  public void put(PositionedByteRange buf);
{code}
{code}
+  /**
+   * Compares the byte retrieved from the {@link PositionedByteRange} with the specifed byte[]
b
+   * @param srcOffset - offset from which the source has to be read for comparison
+   * @param srcLength - length upto which the source has to be compared
+   * @param b - byte array with comparison is to happen
+   * @param offset - offset of the array to be compared
+   * @param length - length of the array to be compared
+   * @return
+   */
+  public int compare(int srcOffset, int srcLength, byte[] b, int offset, int length);
+
+  /**
+   * Store {@code buf} another {@link PositionedByteRange} into the current one
+   * @param buf
+   *          the byterange to store.
+   * @return this.
+   */
+  public void put(PositionedByteRange buf);
+  
+  /**
+   * Copies the bytes from the {@link PositionedByteRange} to the destination byte array
+   * @param srcOffset - offset from which the copy should happen
+   * @param dest -  byte array into which the elements should be copied
+   * @param destOffset - offset of the byte array from which the copy should happen
+   * @param length - length to be copied
+   * @return
+   */
+  public void copy(int srcOffset, byte[] dest, int destOffset, int length);
{code}

These are things that may be needed.  I created other apis like setLimit and getLimit also
to mock the ByteBuffer related things.  but that we can add later also.



> 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
>
>
> 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)

Mime
View raw message