|
26 | 26 | #include <cstring> |
27 | 27 |
|
28 | 28 | // FFI ownership contract (Arrow C Data Interface): |
29 | | -// - `lance_get_schema` returns an opaque schema handle. The caller must release |
30 | | -// it exactly once via `lance_free_schema`. |
31 | | -// - `lance_schema_to_arrow` populates `out_schema` on success (return 0) and |
32 | | -// transfers ownership of the ArrowSchema to the caller, who must call |
33 | | -// `out_schema->release(out_schema)` exactly once (or wrap it in RAII). |
34 | | -// - `lance_create_stream`/`lance_create_fragment_stream` return an opaque stream |
35 | | -// handle. The caller must release it exactly once via `lance_close_stream`. |
36 | | -// - `lance_stream_next` returns an opaque RecordBatch handle. The caller must |
37 | | -// release it exactly once via `lance_free_batch` after use. |
38 | | -// - `lance_batch_to_arrow` populates `out_array` and `out_schema` on success |
39 | | -// (return 0) and transfers ownership of both to the caller, who must call |
40 | | -// `release` exactly once on each. |
41 | | -// - On error, the callee leaves output `ArrowSchema`/`ArrowArray` untouched; do |
42 | | -// not call `release` unless the caller initialized them to a valid value. |
| 29 | +// `lance_get_schema` returns an opaque schema handle; caller frees it via |
| 30 | +// `lance_free_schema` exactly once. |
| 31 | +// `lance_schema_to_arrow` populates `out_schema` on success (return 0) and |
| 32 | +// transfers ownership of the ArrowSchema to the caller, who must call |
| 33 | +// `out_schema->release(out_schema)` exactly once (or wrap it in RAII). |
| 34 | +// `lance_create_stream` and `lance_create_fragment_stream` return opaque stream |
| 35 | +// handles; caller closes them via `lance_close_stream` exactly once. |
| 36 | +// `lance_stream_next` returns an opaque RecordBatch handle; caller frees it via |
| 37 | +// `lance_free_batch` exactly once after use. |
| 38 | +// `lance_batch_to_arrow` populates `out_array` and `out_schema` on success |
| 39 | +// (return 0) and transfers ownership of both to the caller, who must call |
| 40 | +// `release` exactly once on each. |
| 41 | +// On error, the callee leaves output `ArrowSchema` / `ArrowArray` untouched; do |
| 42 | +// not call `release` unless the caller initialized them to a valid value. |
43 | 43 | extern "C" { |
44 | 44 | void *lance_open_dataset(const char *path); |
45 | 45 | void lance_close_dataset(void *dataset); |
|
0 commit comments