[ https://issues.apache.org/jira/browse/HDFS-10339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Clampffer updated HDFS-10339: ----------------------------------- Parent Issue: HDFS-14032 (was: HDFS-8707) > libhdfs++: Expose async operations through the C API > ---------------------------------------------------- > > Key: HDFS-10339 > URL: https://issues.apache.org/jira/browse/HDFS-10339 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: hdfs-client > Reporter: James Clampffer > Priority: Major > > I propose an API that looks like the following for doing async operations in > C. > (might be some typeos, going off memory of what I tried, will clean up) > {code} > typedef struct { > int status; > ssize_t count; > ... whatever else ... > } async_context; > typedef void* caller_context; > typedef void (*)(const async_context*, caller_context*) capi_callback; > void hdfsAsyncPread(hdfsFS fs, hdfsFile file, off_t offset, void *buf, size_t > count, capi_callback, caller_context); > {code} > When invoked we take a copy of the caller context that gets forwarded to the > callback when the async op completes; this is where a user can keep a pointer > to some state associated with the operation. The callback is invoked by a > const async_contex* analogous to the Status object in the C++ API so the > callback code can check status, bytes read, and other stuff. > Internally this can be implemented by a callable struct/lambda that captures > the caller_context and invokes the capi_callback with the caller_context and > result async_context. -- 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