Skip to content

Commit 8db923c

Browse files
authored
Env config (#509)
* Env config * remove merge conflicts * feat: Update bridge integration to use new synchronous C API * Convert ClientConfig classes to records and improve immutability - Convert ClientConfig, ClientConfigProfile, and ClientConfigTls to record types - Remove ICloneable interface (records have built-in cloning) - Use private init setters instead of private set - Replace Dictionary parameters with IReadOnlyDictionary in public API Replace JSON serialization with record serialization - Replace ToJson()/FromJson() methods with ToRecord()/FromRecord() methods - Create ClientConfigTlsRecord and ClientConfigProfileRecord for TOML structure - Support conversion between config objects and TOML-ready record structures Rename namespace from Configuration to EnvConfig - Change namespace: Temporalio.Client.Configuration → Temporalio.Client.EnvConfig Rename ClientConfig class to ClientEnvConfig - Rename ClientConfig → ClientEnvConfig - Update all references in tests and documentation - Rename file ClientConfig.cs → ClientEnvConfig.cs - Renaming EnvProfile -> ConfigProfile Fix TLS disabled tri-state and profile not found behavior in environment config - Change Tls.Disabled from bool to bool? to support tri-state behavior (null/true/false) - Consolidate DataSource class back into ClientEnvConfig.cs - Add test for tri-state TLS behavior and profile resolution - Update profile loading logic to match Rust core behavior: - profile=null with missing "default" → return empty profile - profile="default" with missing "default" → throw exception * Remove CLAUDE files * Remove useless disableFile parameter when loading ClientConfig. Parse Vec<u8> from DataSource instead of String * Tests formatting * Address most PR feedback * Use scope.ByteArray in favor of sbyte* * Deserialize JSON from core using JSON DTO objects * Clean up - renaming and using shorthand returns * Use renamed core methods with Env prefix before Config. Use tri-state TLS configuration (disabled, enabled, not configured) * Rename ConfigProfile -> Profile, with suppression of build warning * TlsRecord & ProfileRecord removed, in favor of to/fromDictionary methods on the existing Tls and Profile inner classes * Make to/from dictionary conversion non-null. Minor style improvements * Remove runtime usage * Update submodule with merged commit * Formatting * Fix interop conflicts * update test file paths for windows
1 parent e29940d commit 8db923c

File tree

7 files changed

+5803
-32
lines changed

7 files changed

+5803
-32
lines changed

src/Temporalio/Bridge/ByteArray.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ namespace Temporalio.Bridge
1010
/// </summary>
1111
internal class ByteArray : SafeHandle
1212
{
13-
private readonly Runtime runtime;
13+
private readonly Runtime? runtime;
1414
private readonly unsafe Interop.TemporalCoreByteArray* byteArray;
1515

1616
/// <summary>
1717
/// Initializes a new instance of the <see cref="ByteArray"/> class.
1818
/// </summary>
19-
/// <param name="runtime">Runtime to use to free the byte array.</param>
19+
/// <param name="runtime">Runtime to use to free the byte array, or null to use no runtime.</param>
2020
/// <param name="byteArray">Byte array pointer.</param>
21-
public unsafe ByteArray(Runtime runtime, Interop.TemporalCoreByteArray* byteArray)
21+
public unsafe ByteArray(Runtime? runtime, Interop.TemporalCoreByteArray* byteArray)
2222
: base((IntPtr)byteArray, true)
2323
{
2424
this.runtime = runtime;
@@ -75,7 +75,8 @@ public byte[] ToByteArray()
7575
/// <inheritdoc/>
7676
protected override unsafe bool ReleaseHandle()
7777
{
78-
runtime.FreeByteArray(byteArray);
78+
var runtimePtr = runtime != null ? runtime.Ptr : (Interop.TemporalCoreRuntime*)null;
79+
Interop.Methods.temporal_core_byte_array_free(runtimePtr, byteArray);
7980
return true;
8081
}
8182
}

0 commit comments

Comments
 (0)