diff --git a/.github/workflows/tiledb-go.yml b/.github/workflows/tiledb-go.yml index d9d488f8..16c03a17 100644 --- a/.github/workflows/tiledb-go.yml +++ b/.github/workflows/tiledb-go.yml @@ -10,9 +10,9 @@ on: env: # The version of TileDB to test against. - CORE_VERSION: "2.29.1" + CORE_VERSION: "2.30.0" # The abbreviated git commit hash to use. - CORE_HASH: "9a6284d" + CORE_HASH: "9b5305d" jobs: golangci: diff --git a/README.md b/README.md index 0ba48127..9cc93ef8 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ as such the below table reference which versions are compatible. | 0.36.0 | 2.28.X | | 0.37.0 | 2.28.X | | 0.38.0 | 2.29.X | +| 0.39.0 | 2.30.X | ## Deprecated Functionality diff --git a/context.go b/context.go index ac3ad39d..349a3773 100644 --- a/context.go +++ b/context.go @@ -214,3 +214,17 @@ func (c *Context) Stats() ([]byte, error) { return []byte(s), nil } + +// DataProtocol returns the data protocol version for the given URI +func (c *Context) DataProtocol(uri string) (DataProtocol, error) { + cURI := C.CString(uri) + defer C.free(unsafe.Pointer(cURI)) + var protocol C.tiledb_data_protocol_t + ret := C.tiledb_ctx_get_data_protocol(c.tiledbContext.Get(), cURI, &protocol) + runtime.KeepAlive(c) + if ret != C.TILEDB_OK { + return 0, fmt.Errorf("error getting data protocol for uri %s: %w", uri, c.LastError()) + } + + return DataProtocol(protocol), nil +} diff --git a/context_test.go b/context_test.go index 1e82bf38..d0fb4655 100644 --- a/context_test.go +++ b/context_test.go @@ -128,3 +128,13 @@ func TestContextSetTag(t *testing.T) { require.NoError(t, err) require.NoError(t, context.SetTag("key", "value")) } + +func TestDataProtocol(t *testing.T) { + context, err := NewContext(nil) + require.NoError(t, err) + v2, err := context.DataProtocol("s3://bucket/array") + require.NoError(t, err) + require.Equal(t, v2, TILEDB_DATA_PROTOCOL_V2) + // To test tiledb URIs we need to configure REST authentication. + // We don't have this in TileDB-Go CI currently, so these tests are excluded here. +} diff --git a/enums.go b/enums.go index 6962a358..4a9d8dd4 100644 --- a/enums.go +++ b/enums.go @@ -708,3 +708,13 @@ func DataOrderFromString(name string) (DataOrder, error) { } return DataOrder(cDataOrder), nil } + +// DataProtocol +type DataProtocol int8 + +const ( + // REST API v2 (legacy) + TILEDB_DATA_PROTOCOL_V2 DataProtocol = C.TILEDB_DATA_PROTOCOL_v2 + // REST API v3 (TileDB 3.0+) + TILEDB_DATA_PROTOCOL_V3 DataProtocol = C.TILEDB_DATA_PROTOCOL_v3 +)