Skip to content

Commit

Permalink
replaced all do_with_* methods with macros
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyshazam committed Feb 7, 2024
1 parent e957baf commit 6f045d0
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 254 deletions.
12 changes: 6 additions & 6 deletions src/DeltaLake/Bridge/Interop/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ internal static unsafe partial class Methods
public static extern ByteArray* table_uri([NativeTypeName("const struct RawDeltaTable *")] RawDeltaTable* table);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void table_free([NativeTypeName("struct RawDeltaTable *")] RawDeltaTable* table);
public static extern void table_free([NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void create_deltalake([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct TableCreatOptions * _Nonnull")] TableCreatOptions* options, [NativeTypeName("TableNewCallback")] IntPtr callback);
public static extern void create_deltalake([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct TableCreatOptions * _Nonnull")] TableCreatOptions* options, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableNewCallback")] IntPtr callback);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void table_new([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct ByteArrayRef * _Nonnull")] ByteArrayRef* table_uri, [NativeTypeName("struct TableOptions * _Nonnull")] TableOptions* table_options, [NativeTypeName("TableNewCallback")] IntPtr callback);
public static extern void table_new([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct ByteArrayRef * _Nonnull")] ByteArrayRef* table_uri, [NativeTypeName("struct TableOptions * _Nonnull")] TableOptions* table_options, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableNewCallback")] IntPtr callback);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct GenericOrError")]
Expand All @@ -396,7 +396,7 @@ internal static unsafe partial class Methods
public static extern byte table_load_with_datetime([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] long ts_milliseconds, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void table_merge([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* delta_table, [NativeTypeName("const struct ByteArrayRef *")] ByteArrayRef* query, void* stream, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);
public static extern void table_merge([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* delta_table, [NativeTypeName("struct ByteArrayRef * _Nonnull")] ByteArrayRef* query, void* stream, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("struct ProtocolResponse")]
Expand All @@ -412,7 +412,7 @@ internal static unsafe partial class Methods
public static extern void table_delete([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("const struct ByteArrayRef *")] ByteArrayRef* predicate, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void table_query([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("const struct ByteArrayRef *")] ByteArrayRef* query, [NativeTypeName("const struct ByteArrayRef *")] ByteArrayRef* table_name, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);
public static extern void table_query([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("struct ByteArrayRef * _Nonnull")] ByteArrayRef* query, [NativeTypeName("struct ByteArrayRef * _Nonnull")] ByteArrayRef* table_name, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void table_insert([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("void * _Nonnull")] void* stream, [NativeTypeName("const struct ByteArrayRef *")] ByteArrayRef* predicate, [NativeTypeName("const struct ByteArrayRef * _Nonnull")] ByteArrayRef* mode, [NativeTypeName("uintptr_t")] UIntPtr max_rows_per_group, [NativeTypeName("bool")] byte overwrite_schema, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);
Expand All @@ -422,7 +422,7 @@ internal static unsafe partial class Methods
public static extern GenericOrError table_schema([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void table_checkpoint([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
public static extern void table_checkpoint([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);

[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void table_vacuum([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("const struct VacuumOptions *")] VacuumOptions* options, [NativeTypeName("GenericErrorCallback")] IntPtr callback);
Expand Down
2 changes: 2 additions & 0 deletions src/DeltaLake/Bridge/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ internal async Task<Table> LoadTableAsync(
Ptr,
scope.Pointer(scope.ByteArray(tableUri)),
scope.Pointer(nativeOptions),
scope.CancellationToken(cancellationToken),
scope.FunctionPointer<Interop.TableNewCallback>((success, fail) =>
{
if (cancellationToken.IsCancellationRequested)
Expand Down Expand Up @@ -133,6 +134,7 @@ internal async Task<Table> CreateTableAsync(DeltaLake.Table.TableCreateOptions o
Interop.Methods.create_deltalake(
Ptr,
scope.Pointer(nativeOptions),
scope.CancellationToken(cancellationToken),
scope.FunctionPointer<Interop.TableNewCallback>((success, fail) =>
{
if (cancellationToken.IsCancellationRequested)
Expand Down
13 changes: 8 additions & 5 deletions src/DeltaLake/Bridge/include/delta-lake-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,17 @@ void partition_filter_list_free(struct PartitionFilterList *list);

struct ByteArray *table_uri(const struct RawDeltaTable *table);

void table_free(struct RawDeltaTable *table);
void table_free(struct RawDeltaTable *_Nonnull table);

void create_deltalake(struct Runtime *_Nonnull runtime,
struct TableCreatOptions *_Nonnull options,
const struct CancellationToken *cancellation_token,
TableNewCallback callback);

void table_new(struct Runtime *_Nonnull runtime,
struct ByteArrayRef *_Nonnull table_uri,
struct TableOptions *_Nonnull table_options,
const struct CancellationToken *cancellation_token,
TableNewCallback callback);

struct GenericOrError table_file_uris(struct Runtime *_Nonnull runtime,
Expand Down Expand Up @@ -317,8 +319,8 @@ bool table_load_with_datetime(struct Runtime *_Nonnull runtime,

void table_merge(struct Runtime *_Nonnull runtime,
struct RawDeltaTable *_Nonnull delta_table,
const struct ByteArrayRef *query,
void *stream,
struct ByteArrayRef *_Nonnull query,
void *_Nonnull stream,
const struct CancellationToken *cancellation_token,
GenericErrorCallback callback);

Expand Down Expand Up @@ -349,8 +351,8 @@ void table_delete(struct Runtime *_Nonnull runtime,

void table_query(struct Runtime *_Nonnull runtime,
struct RawDeltaTable *_Nonnull table,
const struct ByteArrayRef *query,
const struct ByteArrayRef *table_name,
struct ByteArrayRef *_Nonnull query,
struct ByteArrayRef *_Nonnull table_name,
const struct CancellationToken *cancellation_token,
GenericErrorCallback callback);

Expand All @@ -372,6 +374,7 @@ struct GenericOrError table_schema(struct Runtime *_Nonnull runtime,

void table_checkpoint(struct Runtime *_Nonnull runtime,
struct RawDeltaTable *_Nonnull table,
const struct CancellationToken *cancellation_token,
TableEmptyCallback callback);

void table_vacuum(struct Runtime *_Nonnull runtime,
Expand Down
Loading

0 comments on commit 6f045d0

Please sign in to comment.