Skip to content

Commit

Permalink
Wrap tiledb_handle_load_array_schema_request
Browse files Browse the repository at this point in the history
This wraps the new tiledb_handle_load_array_schema_request function in
TileDB.
  • Loading branch information
davisp committed Jan 24, 2024
1 parent c2acef8 commit bd45631
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions array_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "C"
import (
"fmt"
"os"
"runtime"
"unsafe"
)

Expand Down Expand Up @@ -423,3 +424,22 @@ func (a *ArraySchema) Type() (ArrayType, error) {

return ArrayType(arrayType), nil
}

// HandleLoadArraySchemaRequest Used by TileDB Cloud to handle loading array schemas.
func HandleLoadArraySchemaRequest(array *Array, serializationType SerializationType, request *Buffer) (*Buffer, error) {
response, err := NewBuffer(array.context)
if err != nil {
return nil, fmt.Errorf("error allocating response buffer: %s", array.context.LastError())
}

ret := C.tiledb_handle_load_array_schema_request(array.context.tiledbContext, array.tiledbArray, C.tiledb_serialization_type_t(serializationType),
request.tiledbBuffer, response.tiledbBuffer)
if ret != C.TILEDB_OK {
return nil, fmt.Errorf("error handling load array schema request: %s", array.context.LastError())
}

runtime.KeepAlive(request)
runtime.KeepAlive(array)

return response, nil
}

0 comments on commit bd45631

Please sign in to comment.