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

Colin Patrick McCabe commented on HDFS-5191:
--------------------------------------------

The current proposal looks like this:
{code}
/**
 * Read from the current location at least 1 and up to maxLength bytes. In most 
situations, the returned
 * buffer will contain maxLength bytes unless either:
 *  * the read crosses a block boundary and zero copy is being used
 *  * the stream has fewer than maxLength bytes left
 * The returned buffer will either be one that was created by the factory or a 
MappedByteBuffer.
 */
public ByteBuffer read(ByteBufferFactory factory, int maxLength) throws 
IOException;

/**
 * Release a buffer that was returned from readByteBuffer. If the method was 
created by the factory
 * it will be returned to the factory.
 */
public void releaseByteBuffer(ByteBufferFactory factory, ByteBuffer buffer);

/**
 * Allow application to manage how ByteBuffers are created for fallback 
buffers. Only buffers created by
 * the factory will be released to it.
 */
public interface ByteBufferFactory {
  ByteBuffer createBuffer(int capacity);
  void releaseBuffer(ByteBuffer buffer);
}
{code}
                
> revisit zero-copy API in FSDataInputStream to make it more intuitive
> --------------------------------------------------------------------
>
>                 Key: HDFS-5191
>                 URL: https://issues.apache.org/jira/browse/HDFS-5191
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs-client, libhdfs
>    Affects Versions: HDFS-4949
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>
> As per the discussion on HDFS-4953, we should revisit the zero-copy API to 
> make it more intuitive for new users.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to