You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "James Clampffer (JIRA)" <ji...@apache.org> on 2016/04/27 23:44:12 UTC
[jira] [Created] (HDFS-10339) libhdfs++: Expose async operations
through the C API
James Clampffer created HDFS-10339:
--------------------------------------
Summary: 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
Reporter: James Clampffer
Assignee: James Clampffer
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
(v6.3.4#6332)