Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to SDK alpha 6 #28

Merged
merged 3 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Temporalio" Version="0.1.0-alpha5" />
<PackageReference Include="Temporalio" Version="0.1.0-alpha6" />
<!--
Can also reference the SDK downloaded to a local directory:
<ProjectReference Include="$(MSBuildThisFileDirectory)..\temporal-sdk-dotnet\src\Temporalio\Temporalio.csproj" />
Expand Down
12 changes: 6 additions & 6 deletions src/Encryption/Codec/EncryptionCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void Dispose()
GC.SuppressFinalize(this);
}

public Task<IEnumerable<Payload>> EncodeAsync(IReadOnlyCollection<Payload> payloads) =>
Task.FromResult(payloads.Select(p =>
public Task<IReadOnlyCollection<Payload>> EncodeAsync(IReadOnlyCollection<Payload> payloads) =>
Task.FromResult<IReadOnlyCollection<Payload>>(payloads.Select(p =>
{
return new Payload()
{
Expand All @@ -47,10 +47,10 @@ public Task<IEnumerable<Payload>> EncodeAsync(IReadOnlyCollection<Payload> paylo
// TODO(cretz): Not clear here how to prevent copy
Data = ByteString.CopyFrom(Encrypt(p.ToByteArray())),
};
}));
}).ToList());

public Task<IEnumerable<Payload>> DecodeAsync(IReadOnlyCollection<Payload> payloads) =>
Task.FromResult(payloads.Select(p =>
public Task<IReadOnlyCollection<Payload>> DecodeAsync(IReadOnlyCollection<Payload> payloads) =>
Task.FromResult<IReadOnlyCollection<Payload>>(payloads.Select(p =>
{
// Ignore if it doesn't have our expected encoding
if (p.Metadata.GetValueOrDefault("encoding") != EncodingByteString)
Expand All @@ -65,7 +65,7 @@ public Task<IEnumerable<Payload>> DecodeAsync(IReadOnlyCollection<Payload> paylo
}
// Decrypt
return Payload.Parser.ParseFrom(Decrypt(p.Data.ToByteArray()));
}));
}).ToList());

private byte[] Encrypt(byte[] data)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Encryption/CodecServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static Task<IResult> DecodeAsync(
HttpContext ctx, IPayloadCodec codec) => ApplyCodecFuncAsync(ctx, codec.DecodeAsync);

private static async Task<IResult> ApplyCodecFuncAsync(
HttpContext ctx, Func<IReadOnlyCollection<Payload>, Task<IEnumerable<Payload>>> func)
HttpContext ctx, Func<IReadOnlyCollection<Payload>, Task<IReadOnlyCollection<Payload>>> func)
{
// Read payloads as JSON
if (ctx.Request.ContentType?.StartsWith("application/json") != true)
Expand Down