[ 
https://issues.apache.org/jira/browse/HDFS-14478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sahil Takiar updated HDFS-14478:
--------------------------------
    Description: 
HADOOP-15229 added a "FileSystem builder-based openFile() API" that allows 
specifying configuration values for opening files (similar to HADOOP-14365).

Support for {{openFile}} will be a little tricky as it is asynchronous and 
{{FutureDataInputStreamBuilder#build}} returns a {{CompletableFuture}}.

At a high level, the API for {{openFile}} could look something like this:
{code:java}
hdfsFile hdfsOpenFile(hdfsFS fs, const char* path, int flags,
                      int bufferSize, short replication, tSize blocksize);

hdfsOpenFileBuilder *hdfsOpenFileBuilderAlloc(hdfsFS fs,
        const char *path);

hdfsOpenFileBuilder *hdfsOpenFileBuilderMust(hdfsOpenFileBuilder *builder,
        const char *key, const char *value);

hdfsOpenFileBuilder *hdfsOpenFileBuilderOpt(hdfsOpenFileBuilder *builder,
        const char *key, const char *value);

hdfsOpenFileFuture *hdfsOpenFileBuilderBuild(hdfsOpenFileBuilder *builder);

void hdfsOpenFileBuilderFree(hdfsOpenFileBuilder *builder);

hdfsFile hdfsOpenFileFutureGet(hdfsOpenFileFuture *future);

hdfsFile hdfsOpenFileFutureGetWithTimeout(hdfsOpenFileFuture *future,
        int64_t timeout, javaConcurrentTimeUnit timeUnit);

int hdfsOpenFileFutureCancel(hdfsOpenFileFuture *future,
        int mayInterruptIfRunning);

void hdfsOpenFileFutureFree(hdfsOpenFileFuture *future);

{code}
Instead of exposing all the functionality of {{CompleteableFuture}} libhdfs 
would just expose the functionality of {{Future}}.

  was:
HADOOP-15229 added a "FileSystem builder-based openFile() API" that allows 
specifying configuration values for opening files (similar to HADOOP-14365).

 

Support for {{openFile}} will be a little tricky as it is asynchronous and 
{{FutureDataInputStreamBuilder#build}} returns a {{CompletableFuture}}.

At a high level, the API for {{openFile}} could look something like this:
{code:java}
    LIBHDFS_EXTERNAL
    struct hdfsOpenFileBuilder *hdfsOpenFileBuilderAlloc(hdfsFS fs,
            const char *path, int flags);

    LIBHDFS_EXTERNAL
    void hdfsOpenFileBuilderFree(struct hdfsOpenFileBuilder *bld);

    LIBHDFS_EXTERNAL
    struct hdfsOpenFileBuilder *hdfsOpenFileBuilderMust(hdfsFS fs,
            const char *key, const char *value);

    LIBHDFS_EXTERNAL
    struct hdfsOpenFileBuilder *hdfsOpenFileBuilderOpt(hdfsFS fs,
            const char *key, const char *value);

    LIBHDFS_EXTERNAL
    hdfsFileFuture *hdfsOpenFileBuilderBuild(struct hdfsOpenFileBuilder *bld);

    LIBHDFS_EXTERNAL
    void hdfsOpenFileFutureFree(struct hdfsFileFuture *future);

    LIBHDFS_EXTERNAL
    hdfsFile hdfsOpenFileFutureGet(struct hdfsFileFuture *future);

    LIBHDFS_EXTERNAL
    hdfsFile hdfsOpenFileFutureGet(struct hdfsFileFuture *future, int64_t
            timeout, const char* timeUnit);

    LIBHDFS_EXTERNAL
    void hdfsOpenFileFutureCancel(struct hdfsFileFuture *future,
            bool mayInterruptIfRunning);
{code}
Instead of exposing all the functionality of {{CompleteableFuture}} libhdfs 
would just expose the functionality of {{Future}}.


> Add libhdfs APIs for openFile
> -----------------------------
>
>                 Key: HDFS-14478
>                 URL: https://issues.apache.org/jira/browse/HDFS-14478
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: hdfs-client, libhdfs, native
>            Reporter: Sahil Takiar
>            Assignee: Sahil Takiar
>            Priority: Major
>
> HADOOP-15229 added a "FileSystem builder-based openFile() API" that allows 
> specifying configuration values for opening files (similar to HADOOP-14365).
> Support for {{openFile}} will be a little tricky as it is asynchronous and 
> {{FutureDataInputStreamBuilder#build}} returns a {{CompletableFuture}}.
> At a high level, the API for {{openFile}} could look something like this:
> {code:java}
> hdfsFile hdfsOpenFile(hdfsFS fs, const char* path, int flags,
>                       int bufferSize, short replication, tSize blocksize);
> hdfsOpenFileBuilder *hdfsOpenFileBuilderAlloc(hdfsFS fs,
>         const char *path);
> hdfsOpenFileBuilder *hdfsOpenFileBuilderMust(hdfsOpenFileBuilder *builder,
>         const char *key, const char *value);
> hdfsOpenFileBuilder *hdfsOpenFileBuilderOpt(hdfsOpenFileBuilder *builder,
>         const char *key, const char *value);
> hdfsOpenFileFuture *hdfsOpenFileBuilderBuild(hdfsOpenFileBuilder *builder);
> void hdfsOpenFileBuilderFree(hdfsOpenFileBuilder *builder);
> hdfsFile hdfsOpenFileFutureGet(hdfsOpenFileFuture *future);
> hdfsFile hdfsOpenFileFutureGetWithTimeout(hdfsOpenFileFuture *future,
>         int64_t timeout, javaConcurrentTimeUnit timeUnit);
> int hdfsOpenFileFutureCancel(hdfsOpenFileFuture *future,
>         int mayInterruptIfRunning);
> void hdfsOpenFileFutureFree(hdfsOpenFileFuture *future);
> {code}
> Instead of exposing all the functionality of {{CompleteableFuture}} libhdfs 
> would just expose the functionality of {{Future}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to