Skip to content

Commit

Permalink
[5.3] Add back removed APIs from the TileDB.Interop namespace. (#269)
Browse files Browse the repository at this point in the history
* Make `MarshaledString` and `MarshaledStringOut` public but obsolete and hidden.

* Bring back the old safe handles and obsolete and hide them.

* Bring back `SpanExtensions` and obsolete and hide it.

* Bring back two empty types and obsolete and hide them.

* Fix compile errors.

* Run CI on release branches.

* Bump version to 5.3.1.

* Deprecate `tiledb_filter_webp_format_t`.
  • Loading branch information
teo-tsirpanis authored Sep 8, 2023
1 parent 6b5b873 commit 520296a
Show file tree
Hide file tree
Showing 25 changed files with 778 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tiledb-csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ main ]
branches: [ main, 'release/*' ]
pull_request:
branches: [ main ]
branches: [ main, 'release/*' ]
workflow_dispatch:
workflow_call:

Expand Down
2 changes: 2 additions & 0 deletions sources/TileDB.CSharp/Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using TileDB.CSharp.Marshalling;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ArrayHandle = TileDB.CSharp.Marshalling.SafeHandles.ArrayHandle;
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;

namespace TileDB.CSharp
{
Expand Down
4 changes: 4 additions & 0 deletions sources/TileDB.CSharp/ArraySchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
using System.Collections.Generic;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;
using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle;
using AttributeHandle = TileDB.CSharp.Marshalling.SafeHandles.AttributeHandle;

namespace TileDB.CSharp
{
Expand Down
1 change: 1 addition & 0 deletions sources/TileDB.CSharp/ArraySchemaEvolution.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ArraySchemaEvolutionHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaEvolutionHandle;

namespace TileDB.CSharp
{
Expand Down
4 changes: 3 additions & 1 deletion sources/TileDB.CSharp/Attribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using TileDB.CSharp.Marshalling.SafeHandles;
using AttributeHandle = TileDB.CSharp.Marshalling.SafeHandles.AttributeHandle;
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;

namespace TileDB.CSharp
{
Expand Down
1 change: 1 addition & 0 deletions sources/TileDB.CSharp/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Text;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;

namespace TileDB.CSharp
{
Expand Down
2 changes: 2 additions & 0 deletions sources/TileDB.CSharp/ConfigIterator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;
using ConfigIteratorHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigIteratorHandle;

namespace TileDB.CSharp
{
Expand Down
1 change: 1 addition & 0 deletions sources/TileDB.CSharp/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ContextHandle = TileDB.CSharp.Marshalling.SafeHandles.ContextHandle;

namespace TileDB.CSharp
{
Expand Down
2 changes: 2 additions & 0 deletions sources/TileDB.CSharp/Dimension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using TileDB.CSharp.Marshalling;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using DimensionHandle = TileDB.CSharp.Marshalling.SafeHandles.DimensionHandle;
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;

namespace TileDB.CSharp
{
Expand Down
2 changes: 2 additions & 0 deletions sources/TileDB.CSharp/Domain.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle;
using DimensionHandle = TileDB.CSharp.Marshalling.SafeHandles.DimensionHandle;

namespace TileDB.CSharp
{
Expand Down
1 change: 1 addition & 0 deletions sources/TileDB.CSharp/File.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.ComponentModel;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;

namespace TileDB.CSharp
{
Expand Down
1 change: 1 addition & 0 deletions sources/TileDB.CSharp/Filter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Runtime.InteropServices;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using FilterHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterHandle;

namespace TileDB.CSharp
{
Expand Down
2 changes: 2 additions & 0 deletions sources/TileDB.CSharp/FilterList.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using FilterHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterHandle;
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;

namespace TileDB.CSharp
{
Expand Down
2 changes: 2 additions & 0 deletions sources/TileDB.CSharp/FragmentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using TileDB.CSharp.Marshalling;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using ArraySchemaHandle = TileDB.CSharp.Marshalling.SafeHandles.ArraySchemaHandle;
using ConfigHandle = TileDB.CSharp.Marshalling.SafeHandles.ConfigHandle;

namespace TileDB.CSharp
{
Expand Down
1 change: 1 addition & 0 deletions sources/TileDB.CSharp/Group.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using TileDB.CSharp.Marshalling.SafeHandles;
using TileDB.Interop;
using GroupHandle = TileDB.CSharp.Marshalling.SafeHandles.GroupHandle;

namespace TileDB.CSharp
{
Expand Down
13 changes: 13 additions & 0 deletions sources/TileDB.CSharp/Interop/InteropAux.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.ComponentModel;
using System;
using TileDB.CSharp;

namespace TileDB.Interop
{
[Obsolete(Obsoletions.TileDBInteropMessage, DiagnosticId = Obsoletions.TileDBInteropDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
// placeholder struct to avoid errors loading generated code
public partial struct __sFILE
{
}
}
31 changes: 31 additions & 0 deletions sources/TileDB.CSharp/Interop/SpanExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
//https://github.com/dotnet/ClangSharp/blob/67c1e5243b9d58f2b28f10e3f9a82f7537fd9d88/sources/ClangSharp.Interop/Internals/SpanExtensions.cs

using System;
using System.ComponentModel;
using System.Text;
using TileDB.CSharp;

namespace TileDB.Interop
{
[Obsolete(Obsoletions.TileDBInteropMessage, DiagnosticId = Obsoletions.TileDBInteropDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
public static unsafe class SpanExtensions
{
public static string AsString(this Span<byte> self) => AsString((ReadOnlySpan<byte>)self);

public static string AsString(this ReadOnlySpan<byte> self)
{
if (self.IsEmpty)
{
return string.Empty;
}

fixed (byte* pSelf = self)
{
return Encoding.ASCII.GetString(pSelf, self.Length);
}
}
}

}//namespace
Loading

0 comments on commit 520296a

Please sign in to comment.