Sahil Takiar created HDFS-14478: ----------------------------------- Summary: Add libhdfs APIs for readFully and 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
HADOOP-15229 added a "FileSystem builder-based openFile() API" that allows specifying configuration values for opening files (similar to HADOOP-14365). The {{PositionedReadable#readFully}} APIs have always existed. Both of these APIs should be exposed by libhdfs. Adding support for {{readFully}} should be straight-forward (a new libhdfs API called {{hdfsPreadFully}} whose implementation is similar to {{hdfsPread}}). Support for {{openFile}} will be a little tricker 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}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org