Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tiledb-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
10 changes: 10 additions & 0 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
10 changes: 10 additions & 0 deletions enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +717 to +719

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataProtocolV(2|3)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I agree it's the expected format for golang, but the rest of our enumerations use the TILEDB_ format. If we want to switch to this format IMO we should be consistent and update them all. We can open a story to do this in future releases if you'd like, provided there are no objections from others.

We'd need to go through a deprecation cycle to rename the existing enumerations. At the end of that cycle we could start using this format moving forward, so we don't have any mixed conventions for enumerations in the meantime.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, that's something to consider if we ever do a TileDB-Go-v2.

)