paleolimbot commented on code in PR #43632: URL: https://github.com/apache/arrow/pull/43632#discussion_r1712469719
########## cpp/src/arrow/c/abi.h: ########## @@ -228,6 +228,65 @@ struct ArrowDeviceArrayStream { #endif // ARROW_C_DEVICE_STREAM_INTERFACE +#ifndef ARROW_C_ASYNC_STREAM_INTERFACE +#define ARROW_C_ASYNC_STREAM_INTERFACE + +// Similar to ArrowDeviceArrayStream, except designed for an asynchronous +// style of interaction. While ArrowDeviceArrayStream provides producer +// defined callbacks, this is intended to be created by the consumer instead. +// The consumer passes this handler to the producer, which in turn uses the +// callbacks to inform the consumer of events in the stream. +struct ArrowAsyncDeviceStreamHandler { + // Handler for receiving a schema. The passed in stream_schema should be + // released or moved by the handler (producer is giving ownership of it to + // the handler). + // + // The `extension_param` argument can be null or can be used by a producer Review Comment: I am lukewarm on a vague extension parameter here...maybe `metadata` or a JSON string if we really need additional key/value information outside the scope of the schema's metadata? ########## cpp/src/arrow/c/abi.h: ########## @@ -228,6 +228,65 @@ struct ArrowDeviceArrayStream { #endif // ARROW_C_DEVICE_STREAM_INTERFACE +#ifndef ARROW_C_ASYNC_STREAM_INTERFACE +#define ARROW_C_ASYNC_STREAM_INTERFACE + +// Similar to ArrowDeviceArrayStream, except designed for an asynchronous +// style of interaction. While ArrowDeviceArrayStream provides producer +// defined callbacks, this is intended to be created by the consumer instead. +// The consumer passes this handler to the producer, which in turn uses the +// callbacks to inform the consumer of events in the stream. +struct ArrowAsyncDeviceStreamHandler { + // Handler for receiving a schema. The passed in stream_schema should be + // released or moved by the handler (producer is giving ownership of it to + // the handler). + // + // The `extension_param` argument can be null or can be used by a producer + // to pass arbitrary extra information to the consumer (such as total number + // of rows, context info, or otherwise). + // + // Return value: 0 if successful, `errno`-compatible error otherwise Review Comment: I imagine the consumer should be able to return something to tell the producer to stop (I agree this should be explicit, though, and errno might not be the most precise tool but it might be slightly more informative than a `bool` or invented enum). For argument's sake: If a non-zero value is returned, the producer must not call any other callbacks except the release callback. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org