bkietz commented on code in PR #555:
URL: https://github.com/apache/arrow-nanoarrow/pull/555#discussion_r1674089889
##########
src/nanoarrow/nanoarrow_ipc.h:
##########
@@ -379,6 +381,49 @@ ArrowErrorCode ArrowIpcArrayStreamReaderInit(
struct ArrowArrayStream* out, struct ArrowIpcInputStream* input_stream,
struct ArrowIpcArrayStreamReaderOptions* options);
+/// \brief Encode an ArrowSchema
+///
+/// The buffer will be allocated by flatcc.
+///
+/// Note: the resulting Message is not encapsulated; it does not include a
continuation indicator,
+/// inline metadata size, or padding bytes.
+///
+/// Returns ENOMEM if allocation fails, NANOARROW_OK otherwise.
+ArrowErrorCode ArrowIpcEncodeSchema(
+ struct ArrowBuffer* out,
+ const struct ArrowSchema* schema,
+ struct ArrowError* error);
+
+/// \brief Callback invoked against each buffer to be encoded.
+///
+/// Encoding of buffers is left as a callback to accommodate dissociated data
storage.
+/// One implementation of this callback might copy all buffers into a
contiguous body
+/// for use in an arrow IPC stream, another implementation might store offsets
and lengths
+/// relative to a known arena.
+typedef ArrowErrorCode (*ArrowIpcBufferEncodeCallback)(struct ArrowBufferView
to_be_encoded,
+ int64_t* offset,
int64_t* body_length,
+ void *user_data, struct
ArrowError* error);
+
+/// \brief Encode a struct typed ArrayView to a flatbuffer RecordBatch,
embedded in a Message.
+///
+/// The buffer will be allocated by flatcc.
+///
+/// Note: the resulting Message is not encapsulated; it does not include a
continuation indicator,
+/// inline metadata size, or padding bytes.
+///
+/// This function may be called with null out buffer, in which case the
callback will be invoked
+/// but no message will be encoded.
+///
+/// Returns ENOMEM if allocation fails, NANOARROW_OK otherwise.
+ArrowErrorCode ArrowIpcEncodeRecordBatch(
+ struct ArrowBuffer* out,
+ struct ArrowArray* to_be_encoded,
+ ArrowIpcBufferEncodeCallback encode_buffer,
+ void *user_data, struct ArrowError* error);
+
+/// \brief Encapsulate a Message stored in a buffer by prepending the
continuation indicator and size.
+ArrowErrorCode ArrowIpcEncodeEncapsulatedMessage(struct ArrowBuffer* buffer);
Review Comment:
I am hoping to leave full stream support for a follow up
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]