Skip to content

Commit 733aaba

Browse files
Update Core to 2.19. (#364)
* Regenerate bindings for 2.19. * Bump Core to 2.19.0. * Run nightly builds on release-2.19. * Bump version to 5.9.0. * Update the Group class to use the new C APIs. And expose `tiledb_group_get_member_by_name_v2`. * Make the group member APIs public (they weren't) and add tests for them.
1 parent d676140 commit 733aaba

File tree

6 files changed

+45
-16
lines changed

6 files changed

+45
-16
lines changed

Diff for: .github/workflows/nightly.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
platform: windows-x86_64
3030
BOOTSTRAP: ../bootstrap.ps1 -EnableS3 -EnableSerialization -EnableVcpkg
3131
- tag: dev
32-
tag: [release-2.18, dev]
32+
tag: [release-2.19, dev]
3333
runs-on: ${{ matrix.os }}
3434
steps:
3535
- name: Checkout TileDB
@@ -67,7 +67,7 @@ jobs:
6767
strategy:
6868
fail-fast: false
6969
matrix:
70-
tag: [release-2.18, dev]
70+
tag: [release-2.19, dev]
7171
runs-on: ubuntu-latest
7272
steps:
7373
- name: Checkout TileDB-CSharp
@@ -107,7 +107,7 @@ jobs:
107107
fail-fast: false
108108
matrix:
109109
os: [ubuntu-latest, macos-latest, windows-latest]
110-
tag: [release-2.18, dev]
110+
tag: [release-2.19, dev]
111111
runs-on: ${{ matrix.os }}
112112
steps:
113113
- name: Checkout TileDB-CSharp

Diff for: Directory.Packages.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
<TileDBNativePackageName>TileDB.Native</TileDBNativePackageName>
5-
<TileDBNativePackageVersion>[2.18.0,2.19.0)</TileDBNativePackageVersion>
5+
<TileDBNativePackageVersion>[2.19.0,2.20.0)</TileDBNativePackageVersion>
66

77
<!-- The DevelopmentBuild property switches to the locally built native packages.
88
They have a different name to avoid publishing them by mistake, and to

Diff for: sources/TileDB.CSharp/Group.cs

+27-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using TileDB.Interop;
44
using GroupHandle = TileDB.CSharp.Marshalling.SafeHandles.GroupHandle;
55
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
6+
using TileDB.CSharp.Marshalling;
67

78
namespace TileDB.CSharp;
89

@@ -278,23 +279,40 @@ public ulong MemberCount()
278279
/// <summary>
279280
/// Get member by index.
280281
/// </summary>
281-
/// <param name="index"></param>
282-
/// <returns></returns>
283-
(string uri, ObjectType object_type, string name) MemberByIndex(ulong index)
282+
/// <param name="index">The member's index.</param>
283+
public (string Uri, ObjectType ObjectType, string Name) GetMemberByIndex(ulong index)
284284
{
285285
using var ctxHandle = _ctx.Handle.Acquire();
286286
using var handle = _handle.Acquire();
287-
sbyte* uriPtr;
288-
sbyte* namePtr;
287+
using StringHandleHolder uriPtr = new();
288+
using StringHandleHolder namePtr = new();
289289
tiledb_object_t tiledb_objecttype;
290-
_ctx.handle_error(Methods.tiledb_group_get_member_by_index(
291-
ctxHandle, handle, index, &uriPtr, &tiledb_objecttype, &namePtr));
290+
_ctx.handle_error(Methods.tiledb_group_get_member_by_index_v2(
291+
ctxHandle, handle, index, &uriPtr._handle, &tiledb_objecttype, &namePtr._handle));
292292

293-
string uri = MarshaledStringOut.GetStringFromNullTerminated(uriPtr);
294-
string name = MarshaledStringOut.GetStringFromNullTerminated(namePtr);
293+
string uri = uriPtr.ToString();
294+
string name = namePtr.ToString();
295295
return (uri, (ObjectType)tiledb_objecttype, name);
296296
}
297297

298+
/// <summary>
299+
/// Get member by name.
300+
/// </summary>
301+
/// <param name="name">The member's name.</param>
302+
public (string Uri, ObjectType ObjectType) GetMemberByName(string name)
303+
{
304+
using var ctxHandle = _ctx.Handle.Acquire();
305+
using var handle = _handle.Acquire();
306+
using var ms_name = new MarshaledString(name);
307+
using StringHandleHolder uriPtr = new();
308+
tiledb_object_t tiledb_objecttype;
309+
_ctx.handle_error(Methods.tiledb_group_get_member_by_name_v2(
310+
ctxHandle, handle, ms_name, &uriPtr._handle, &tiledb_objecttype));
311+
312+
string uri = uriPtr.ToString();
313+
return (uri, (ObjectType)tiledb_objecttype);
314+
}
315+
298316
/// <summary>
299317
/// Returns if this group is open or not.
300318
/// </summary>

Diff for: sources/TileDB.CSharp/Interop/Methods.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
384384

385385
[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
386386
[return: NativeTypeName("capi_return_t")]
387-
[Obsolete]
388387
public static extern int tiledb_group_create(tiledb_ctx_t* ctx, [NativeTypeName("const char *")] sbyte* group_uri);
389388

390389
[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -1417,12 +1416,22 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
14171416

14181417
[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
14191418
[return: NativeTypeName("capi_return_t")]
1419+
[Obsolete]
14201420
public static extern int tiledb_group_get_member_by_index(tiledb_ctx_t* ctx, tiledb_group_t* group, [NativeTypeName("uint64_t")] ulong index, [NativeTypeName("char **")] sbyte** uri, tiledb_object_t* type, [NativeTypeName("char **")] sbyte** name);
14211421

14221422
[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
14231423
[return: NativeTypeName("capi_return_t")]
1424+
public static extern int tiledb_group_get_member_by_index_v2(tiledb_ctx_t* ctx, tiledb_group_t* group, [NativeTypeName("uint64_t")] ulong index, tiledb_string_t** uri, tiledb_object_t* type, tiledb_string_t** name);
1425+
1426+
[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
1427+
[return: NativeTypeName("capi_return_t")]
1428+
[Obsolete]
14241429
public static extern int tiledb_group_get_member_by_name(tiledb_ctx_t* ctx, tiledb_group_t* group, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("char **")] sbyte** uri, tiledb_object_t* type);
14251430

1431+
[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
1432+
[return: NativeTypeName("capi_return_t")]
1433+
public static extern int tiledb_group_get_member_by_name_v2(tiledb_ctx_t* ctx, tiledb_group_t* group, [NativeTypeName("const char *")] sbyte* name, tiledb_string_t** uri, tiledb_object_t* type);
1434+
14261435
[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
14271436
[return: NativeTypeName("capi_return_t")]
14281437
public static extern int tiledb_group_get_is_relative_uri_by_name(tiledb_ctx_t* ctx, tiledb_group_t* group, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("uint8_t *")] byte* relative);

Diff for: sources/TileDB.CSharp/TileDB.CSharp.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
<Nullable>enable</Nullable>
88
<RootNamespace>TileDB.CSharp</RootNamespace>
9-
<Version>5.8.0</Version>
9+
<Version>5.9.0</Version>
1010
<Description>C# wrapper of the TileDB Embedded universal data engine.</Description>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1313
<EnablePackageValidation>true</EnablePackageValidation>
14-
<PackageValidationBaselineVersion>5.7.0</PackageValidationBaselineVersion>
14+
<PackageValidationBaselineVersion>5.8.0</PackageValidationBaselineVersion>
1515
<NoWarn>$(NoWarn);TILEDB0012;TILEDB0013;TILEDB0014</NoWarn>
1616
</PropertyGroup>
1717

Diff for: tests/TileDB.CSharp.Test/GroupTest.cs

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public void TestGroupMember()
7373
//Reopen in read mode
7474
group1.Open(QueryType.Read);
7575
Assert.AreEqual<ulong>(2, group1.MemberCount());
76+
Assert.AreEqual("array1", group1.GetMemberByIndex(0).Name);
77+
Assert.AreEqual(ObjectType.Array, group1.GetMemberByName("array2").ObjectType);
7678
group1.Close();
7779

7880
//Reopen in write mode

0 commit comments

Comments
 (0)