Skip to content

Commit 97d1b89

Browse files
committed
updated to kernel v0.14 and added a dev container
1 parent b6ccff3 commit 97d1b89

File tree

10 files changed

+159
-81
lines changed

10 files changed

+159
-81
lines changed

.devcontainer/devcontainer.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
3+
{
4+
"name": "C# (.NET)",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/dotnet:1-9.0-bookworm",
7+
8+
// Features to add to the dev container. More info: https://containers.dev/features.
9+
"features": {
10+
"ghcr.io/devcontainers/features/dotnet:2": {
11+
"version": "8.0"
12+
},
13+
"ghcr.io/devcontainers/features/rust:1": {
14+
"version": "1.88"
15+
},
16+
// "ghcr.io/lee-orr/rusty-dev-containers/cargo-llvm-cov:0": {},
17+
"ghcr.io/devcontainers-community/features/llvm": {
18+
"version": "20"
19+
}
20+
},
21+
"onCreateCommand": "bash tools/clangsharp/install_libraries.sh",
22+
"postStartCommand": "git submodule update"
23+
24+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
25+
// "forwardPorts": [5000, 5001],
26+
// "portsAttributes": {
27+
// "5001": {
28+
// "protocol": "https"
29+
// }
30+
// }
31+
32+
// Use 'postCreateCommand' to run commands after the container is created.
33+
// "postCreateCommand": "dotnet restore",
34+
35+
// Configure tool-specific properties.
36+
// "customizations": {},
37+
38+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
39+
// "remoteUser": "root"
40+
}

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ jobs:
5555
- name: Build
5656
# We intentionally just build debug mode in this CI. We build before
5757
# regen to confirm no interop header changes.
58-
run: dotnet build
58+
run: dotnet build -C Release
5959

6060
- name: Regen confirm unchanged
6161
if: ${{ matrix.checkTarget }}
6262
# Needs to be 16.0.0 until https://github.com/dotnet/ClangSharp/pull/506 released
6363
run: |
64-
dotnet tool install --global --version 16.0.0 ClangSharpPInvokeGenerator
65-
# ClangSharpPInvokeGenerator @src/DeltaLake/Bridge/GenerateInterop.rsp
64+
dotnet tool install --global --version 20.1.2 ClangSharpPInvokeGenerator
65+
ClangSharpPInvokeGenerator @src/DeltaLake/Bridge/GenerateInterop.rsp
66+
ClangSharpPInvokeGenerator -D DEFINE_DEFAULT_ENGINE_BASE=1 @src/DeltaLake/Kernel/GenerateInterop.rsp
6667
npx doctoc README.md
6768
git config --global core.safecrlf false
6869
git diff --exit-code

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "src/DeltaLake/Kernel/delta-kernel-rs"]
22
path = src/DeltaLake/Kernel/delta-kernel-rs
3-
url = https://github.com/mightyshazam/delta-kernel-rs
3+
url = https://github.com/delta-io/delta-kernel-rs

CONTRIBUTING.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
- [Build C# Interop](#build-c-interop)
55
- [Regenerating API docs](#regenerating-api-docs)
66

7+
### Using the dev container
8+
The devcontainer comes preloaded with all of the requisite dependencies.
9+
It includes a `Makefile` to generate bindings.
10+
Use `make generate-bindings` to generate everything.
11+
Use `make generate-bridge-bindings` for the bridge code.
12+
Use `make generate-kernel-bindings` for the kernel code
13+
714
### Rebuilding Rust extension and interop layer
815

916
To regen core interop from header, install
@@ -67,11 +74,11 @@ $CSHARP_FRIENDLY_FFI_HEADER = "$GIT_ROOT/src/DeltaLake/Kernel/include/${HEADER_F
6774
6875
Copy-Item -Path $GENERATED_FFI_HEADER -Destination $CSHARP_FRIENDLY_FFI_HEADER -Force
6976
70-
ClangSharpPInvokeGenerator -D DEFINE_DEFAULT_ENGINE=1 @src/DeltaLake/Kernel/GenerateInterop.rsp
77+
ClangSharpPInvokeGenerator -D DEFINE_DEFAULT_ENGINE_BASE=1 @src/DeltaLake/Kernel/GenerateInterop.rsp
7178
Alternatively, if you have an environment that is not particularly cooperative, you can use the included
7279
docker container and run
7380
```bash
74-
docker run --mount type=bind,src=.,dst=/app clangsharp -D DEFINE_DEFAULT_ENGINE=1 @src/DeltaLake/Kernel/GenerateInterop.rsp
81+
docker run --mount type=bind,src=.,dst=/app clangsharp -D DEFINE_DEFAULT_ENGINE_RUSTLS=1 @src/DeltaLake/Kernel/GenerateInterop.rsp
7582
```
7683
# Post-processing script to remove Mangled entrpoints - ClangSharpPInvokeGenerator
7784
# does not seem to have a built-in arg that does this.

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
generate-kernel-bindings:
2+
cargo build --manifest-path src/DeltaLake/Kernel/delta-kernel-rs/ffi/Cargo.toml --no-default-features --features "default-engine-rustls"
3+
cp src/DeltaLake/Kernel/delta-kernel-rs/target/ffi-headers/delta_kernel_ffi.h src/DeltaLake/Kernel/include/
4+
ClangSharpPInvokeGenerator -I "$$(llvm-config --libdir)/clang/20/include" -D DEFINE_DEFAULT_ENGINE_BASE=1 @src/DeltaLake/Kernel/GenerateInterop.rsp
5+
6+
generate-bridge-bindings:
7+
cargo build --manifest-path src/DeltaLake/Bridge/Cargo.toml
8+
ClangSharpPInvokeGenerator -I "$$(llvm-config --libdir)/clang/20/include" @src/DeltaLake/Bridge/GenerateInterop.rsp
9+
10+
generate-bindings: generate-bridge-bindings generate-kernel-bindings

src/DeltaLake/Bridge/Interop/Interop.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ internal unsafe partial struct TableCreatOptions
176176
internal unsafe partial struct TableOptions
177177
{
178178
[NativeTypeName("int64_t")]
179-
public long version;
179+
public IntPtr version;
180180

181181
[NativeTypeName("struct Map *")]
182182
public Map* storage_options;
@@ -258,7 +258,7 @@ internal unsafe partial struct VacuumOptions
258258
public byte dry_run;
259259

260260
[NativeTypeName("uint64_t")]
261-
public ulong retention_hours;
261+
public UIntPtr retention_hours;
262262

263263
[NativeTypeName("bool")]
264264
public byte enforce_retention_duration;
@@ -303,31 +303,31 @@ internal unsafe partial struct Dictionary
303303
internal unsafe partial struct TableMetadata
304304
{
305305
[NativeTypeName("const char *")]
306-
public sbyte* id;
306+
public byte* id;
307307

308308
[NativeTypeName("const char *")]
309-
public sbyte* name;
309+
public byte* name;
310310

311311
[NativeTypeName("const char *")]
312-
public sbyte* description;
312+
public byte* description;
313313

314314
[NativeTypeName("const char *")]
315-
public sbyte* format_provider;
315+
public byte* format_provider;
316316

317317
[NativeTypeName("struct Dictionary")]
318318
public Dictionary format_options;
319319

320320
[NativeTypeName("const char *")]
321-
public sbyte* schema_string;
321+
public byte* schema_string;
322322

323323
[NativeTypeName("char **")]
324-
public sbyte** partition_columns;
324+
public byte** partition_columns;
325325

326326
[NativeTypeName("uintptr_t")]
327327
public UIntPtr partition_columns_count;
328328

329329
[NativeTypeName("int64_t")]
330-
public long created_time;
330+
public IntPtr created_time;
331331

332332
[NativeTypeName("struct Dictionary")]
333333
public Dictionary configuration;
@@ -424,13 +424,13 @@ internal static unsafe partial class Methods
424424
public static extern void history([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("uintptr_t")] UIntPtr limit, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);
425425

426426
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
427-
public static extern void table_update_incremental([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] long max_version, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
427+
public static extern void table_update_incremental([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] IntPtr max_version, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
428428

429429
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
430-
public static extern void table_load_version([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] long version, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
430+
public static extern void table_load_version([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] IntPtr version, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
431431

432432
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
433-
public static extern void 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);
433+
public static extern void table_load_with_datetime([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] IntPtr ts_milliseconds, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
434434

435435
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
436436
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, [NativeTypeName("void * _Nonnull")] void* stream, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);
@@ -440,7 +440,7 @@ internal static unsafe partial class Methods
440440
public static extern ProtocolResponse table_protocol_versions([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table);
441441

442442
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
443-
public static extern void table_restore([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] long version_or_timestamp, [NativeTypeName("bool")] byte is_timestamp, [NativeTypeName("bool")] byte ignore_missing_files, [NativeTypeName("bool")] byte protocol_downgrade_allowed, [NativeTypeName("struct Map *")] Map* custom_metadata, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
443+
public static extern void table_restore([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("int64_t")] IntPtr version_or_timestamp, [NativeTypeName("bool")] byte is_timestamp, [NativeTypeName("bool")] byte ignore_missing_files, [NativeTypeName("bool")] byte protocol_downgrade_allowed, [NativeTypeName("struct Map *")] Map* custom_metadata, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("TableEmptyCallback")] IntPtr callback);
444444

445445
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
446446
public static extern void table_update([NativeTypeName("struct Runtime * _Nonnull")] Runtime* runtime, [NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table, [NativeTypeName("struct ByteArrayRef * _Nonnull")] ByteArrayRef* query, [NativeTypeName("const struct CancellationToken *")] CancellationToken* cancellation_token, [NativeTypeName("GenericErrorCallback")] IntPtr callback);
@@ -469,7 +469,7 @@ internal static unsafe partial class Methods
469469

470470
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
471471
[return: NativeTypeName("int64_t")]
472-
public static extern long table_version([NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table_handle);
472+
public static extern IntPtr table_version([NativeTypeName("struct RawDeltaTable * _Nonnull")] RawDeltaTable* table_handle);
473473

474474
[DllImport("delta_rs_bridge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
475475
[return: NativeTypeName("struct MetadataOrError")]

0 commit comments

Comments
 (0)