Skip to content

Commit 8ce977f

Browse files
committed
one package finalize
1 parent 069201f commit 8ce977f

File tree

10 files changed

+999
-8
lines changed

10 files changed

+999
-8
lines changed

src/Extensions/AzureBlobPayloads/AzureBlobPayloads.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
<ProjectReference Include="..\..\Worker\Core\Worker.csproj" />
2222
<ProjectReference Include="..\..\Client\Grpc\Client.Grpc.csproj" />
2323
<ProjectReference Include="..\..\Worker\Grpc\Worker.Grpc.csproj" />
24+
<ProjectReference Include="..\..\Grpc.AzureManagedBackend\Grpc.AzureManagedBackend.csproj" />
2425
</ItemGroup>
2526

2627
<ItemGroup>
2728
<SharedSection Include="Core" />
2829
</ItemGroup>
29-
3030
</Project>

src/Extensions/AzureBlobPayloads/Interceptors/AzureBlobPayloadsManagedBackendInterceptor.cs

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using Grpc.Core.Interceptors;
5-
6-
using P = Microsoft.DurableTask.Protobuf;
4+
using P = Microsoft.DurableTask.AzureManagedBackend.Protobuf;
75

86
namespace Microsoft.DurableTask;
97

108
/// <summary>
119
/// gRPC interceptor that externalizes large payloads to an <see cref="IPayloadStore"/> on requests
1210
/// and resolves known payload tokens on responses for Azure Managed Backend.
1311
/// </summary>
14-
public sealed class AzureBlobPayloadsManagedBackendInterceptor(IPayloadStore payloadStore, LargePayloadStorageOptions options)
12+
public sealed class AzureBlobPayloadsManagedBackendInterceptor(IPayloadStore payloadStore, LargePayloadStorageOptions options)
1513
: BasePayloadInterceptor<object, object>(payloadStore, options)
1614
{
15+
/// <inheritdoc/>
1716
protected override Task ExternalizeRequestPayloadsAsync<TRequest>(TRequest request, CancellationToken cancellation)
1817
{
1918
// Azure Managed Backend -> Backend Service
@@ -147,96 +146,112 @@ async Task ExternalizeHistoryEventAsync(P.HistoryEvent e, CancellationToken canc
147146
{
148147
await this.MaybeExternalizeAsync(v => es.Input = v, es.Input, cancellation);
149148
}
149+
150150
break;
151151
case P.HistoryEvent.EventTypeOneofCase.ExecutionCompleted:
152152
if (e.ExecutionCompleted is { } ec)
153153
{
154154
await this.MaybeExternalizeAsync(v => ec.Result = v, ec.Result, cancellation);
155155
}
156+
156157
break;
157158
case P.HistoryEvent.EventTypeOneofCase.EventRaised:
158159
if (e.EventRaised is { } er)
159160
{
160161
await this.MaybeExternalizeAsync(v => er.Input = v, er.Input, cancellation);
161162
}
163+
162164
break;
163165
case P.HistoryEvent.EventTypeOneofCase.TaskScheduled:
164166
if (e.TaskScheduled is { } ts)
165167
{
166168
await this.MaybeExternalizeAsync(v => ts.Input = v, ts.Input, cancellation);
167169
}
170+
168171
break;
169172
case P.HistoryEvent.EventTypeOneofCase.TaskCompleted:
170173
if (e.TaskCompleted is { } tc)
171174
{
172175
await this.MaybeExternalizeAsync(v => tc.Result = v, tc.Result, cancellation);
173176
}
177+
174178
break;
175179
case P.HistoryEvent.EventTypeOneofCase.SubOrchestrationInstanceCreated:
176180
if (e.SubOrchestrationInstanceCreated is { } soc)
177181
{
178182
await this.MaybeExternalizeAsync(v => soc.Input = v, soc.Input, cancellation);
179183
}
184+
180185
break;
181186
case P.HistoryEvent.EventTypeOneofCase.SubOrchestrationInstanceCompleted:
182187
if (e.SubOrchestrationInstanceCompleted is { } sox)
183188
{
184189
await this.MaybeExternalizeAsync(v => sox.Result = v, sox.Result, cancellation);
185190
}
191+
186192
break;
187193
case P.HistoryEvent.EventTypeOneofCase.EventSent:
188194
if (e.EventSent is { } esent)
189195
{
190196
await this.MaybeExternalizeAsync(v => esent.Input = v, esent.Input, cancellation);
191197
}
198+
192199
break;
193200
case P.HistoryEvent.EventTypeOneofCase.GenericEvent:
194201
if (e.GenericEvent is { } ge)
195202
{
196203
await this.MaybeExternalizeAsync(v => ge.Data = v, ge.Data, cancellation);
197204
}
205+
198206
break;
199207
case P.HistoryEvent.EventTypeOneofCase.ContinueAsNew:
200208
if (e.ContinueAsNew is { } can)
201209
{
202210
await this.MaybeExternalizeAsync(v => can.Input = v, can.Input, cancellation);
203211
}
212+
204213
break;
205214
case P.HistoryEvent.EventTypeOneofCase.ExecutionTerminated:
206215
if (e.ExecutionTerminated is { } et)
207216
{
208217
await this.MaybeExternalizeAsync(v => et.Input = v, et.Input, cancellation);
209218
}
219+
210220
break;
211221
case P.HistoryEvent.EventTypeOneofCase.ExecutionSuspended:
212222
if (e.ExecutionSuspended is { } esus)
213223
{
214224
await this.MaybeExternalizeAsync(v => esus.Input = v, esus.Input, cancellation);
215225
}
226+
216227
break;
217228
case P.HistoryEvent.EventTypeOneofCase.ExecutionResumed:
218229
if (e.ExecutionResumed is { } eres)
219230
{
220231
await this.MaybeExternalizeAsync(v => eres.Input = v, eres.Input, cancellation);
221232
}
233+
222234
break;
223235
case P.HistoryEvent.EventTypeOneofCase.EntityOperationSignaled:
224236
if (e.EntityOperationSignaled is { } eos)
225237
{
226238
await this.MaybeExternalizeAsync(v => eos.Input = v, eos.Input, cancellation);
227239
}
240+
228241
break;
229242
case P.HistoryEvent.EventTypeOneofCase.EntityOperationCalled:
230243
if (e.EntityOperationCalled is { } eoc)
231244
{
232245
await this.MaybeExternalizeAsync(v => eoc.Input = v, eoc.Input, cancellation);
233246
}
247+
234248
break;
235249
case P.HistoryEvent.EventTypeOneofCase.EntityOperationCompleted:
236250
if (e.EntityOperationCompleted is { } ecomp)
237251
{
238252
await this.MaybeExternalizeAsync(v => ecomp.Output = v, ecomp.Output, cancellation);
239253
}
254+
240255
break;
241256
case P.HistoryEvent.EventTypeOneofCase.HistoryState:
242257
if (e.HistoryState is { } hs && hs.OrchestrationState is { } os)
@@ -245,10 +260,12 @@ async Task ExternalizeHistoryEventAsync(P.HistoryEvent e, CancellationToken canc
245260
await this.MaybeExternalizeAsync(v => os.Output = v, os.Output, cancellation);
246261
await this.MaybeExternalizeAsync(v => os.CustomStatus = v, os.CustomStatus, cancellation);
247262
}
263+
248264
break;
249265
}
250266
}
251267

268+
/// <inheritdoc/>
252269
protected override async Task ResolveResponsePayloadsAsync<TResponse>(TResponse response, CancellationToken cancellation)
253270
{
254271
// Backend Service -> Azure Managed Backend
@@ -267,6 +284,7 @@ protected override async Task ResolveResponsePayloadsAsync<TResponse>(TResponse
267284
{
268285
await this.ResolveEventPayloadsAsync(e, cancellation);
269286
}
287+
270288
break;
271289
case P.QueryInstancesResponse r:
272290
foreach (P.OrchestrationState s in r.OrchestrationState)
@@ -275,6 +293,7 @@ protected override async Task ResolveResponsePayloadsAsync<TResponse>(TResponse
275293
await this.MaybeResolveAsync(v => s.Output = v, s.Output, cancellation);
276294
await this.MaybeResolveAsync(v => s.CustomStatus = v, s.CustomStatus, cancellation);
277295
}
296+
278297
break;
279298
case P.GetEntityResponse r when r.Entity is { } em:
280299
await this.MaybeResolveAsync(v => em.SerializedState = v, em.SerializedState, cancellation);
@@ -284,6 +303,7 @@ protected override async Task ResolveResponsePayloadsAsync<TResponse>(TResponse
284303
{
285304
await this.MaybeResolveAsync(v => em.SerializedState = v, em.SerializedState, cancellation);
286305
}
306+
287307
break;
288308
case P.WorkItem wi:
289309
// Resolve activity input
@@ -331,6 +351,7 @@ protected override async Task ResolveResponsePayloadsAsync<TResponse>(TResponse
331351
}
332352
}
333353
}
354+
334355
break;
335356
}
336357
}
@@ -344,96 +365,112 @@ async Task ResolveEventPayloadsAsync(P.HistoryEvent e, CancellationToken cancell
344365
{
345366
await this.MaybeResolveAsync(v => es.Input = v, es.Input, cancellation);
346367
}
368+
347369
break;
348370
case P.HistoryEvent.EventTypeOneofCase.ExecutionCompleted:
349371
if (e.ExecutionCompleted is { } ec)
350372
{
351373
await this.MaybeResolveAsync(v => ec.Result = v, ec.Result, cancellation);
352374
}
375+
353376
break;
354377
case P.HistoryEvent.EventTypeOneofCase.EventRaised:
355378
if (e.EventRaised is { } er)
356379
{
357380
await this.MaybeResolveAsync(v => er.Input = v, er.Input, cancellation);
358381
}
382+
359383
break;
360384
case P.HistoryEvent.EventTypeOneofCase.TaskScheduled:
361385
if (e.TaskScheduled is { } ts)
362386
{
363387
await this.MaybeResolveAsync(v => ts.Input = v, ts.Input, cancellation);
364388
}
389+
365390
break;
366391
case P.HistoryEvent.EventTypeOneofCase.TaskCompleted:
367392
if (e.TaskCompleted is { } tc)
368393
{
369394
await this.MaybeResolveAsync(v => tc.Result = v, tc.Result, cancellation);
370395
}
396+
371397
break;
372398
case P.HistoryEvent.EventTypeOneofCase.SubOrchestrationInstanceCreated:
373399
if (e.SubOrchestrationInstanceCreated is { } soc)
374400
{
375401
await this.MaybeResolveAsync(v => soc.Input = v, soc.Input, cancellation);
376402
}
403+
377404
break;
378405
case P.HistoryEvent.EventTypeOneofCase.SubOrchestrationInstanceCompleted:
379406
if (e.SubOrchestrationInstanceCompleted is { } sox)
380407
{
381408
await this.MaybeResolveAsync(v => sox.Result = v, sox.Result, cancellation);
382409
}
410+
383411
break;
384412
case P.HistoryEvent.EventTypeOneofCase.EventSent:
385413
if (e.EventSent is { } esent)
386414
{
387415
await this.MaybeResolveAsync(v => esent.Input = v, esent.Input, cancellation);
388416
}
417+
389418
break;
390419
case P.HistoryEvent.EventTypeOneofCase.GenericEvent:
391420
if (e.GenericEvent is { } ge)
392421
{
393422
await this.MaybeResolveAsync(v => ge.Data = v, ge.Data, cancellation);
394423
}
424+
395425
break;
396426
case P.HistoryEvent.EventTypeOneofCase.ContinueAsNew:
397427
if (e.ContinueAsNew is { } can)
398428
{
399429
await this.MaybeResolveAsync(v => can.Input = v, can.Input, cancellation);
400430
}
431+
401432
break;
402433
case P.HistoryEvent.EventTypeOneofCase.ExecutionTerminated:
403434
if (e.ExecutionTerminated is { } et)
404435
{
405436
await this.MaybeResolveAsync(v => et.Input = v, et.Input, cancellation);
406437
}
438+
407439
break;
408440
case P.HistoryEvent.EventTypeOneofCase.ExecutionSuspended:
409441
if (e.ExecutionSuspended is { } esus)
410442
{
411443
await this.MaybeResolveAsync(v => esus.Input = v, esus.Input, cancellation);
412444
}
445+
413446
break;
414447
case P.HistoryEvent.EventTypeOneofCase.ExecutionResumed:
415448
if (e.ExecutionResumed is { } eres)
416449
{
417450
await this.MaybeResolveAsync(v => eres.Input = v, eres.Input, cancellation);
418451
}
452+
419453
break;
420454
case P.HistoryEvent.EventTypeOneofCase.EntityOperationSignaled:
421455
if (e.EntityOperationSignaled is { } eos)
422456
{
423457
await this.MaybeResolveAsync(v => eos.Input = v, eos.Input, cancellation);
424458
}
459+
425460
break;
426461
case P.HistoryEvent.EventTypeOneofCase.EntityOperationCalled:
427462
if (e.EntityOperationCalled is { } eoc)
428463
{
429464
await this.MaybeResolveAsync(v => eoc.Input = v, eoc.Input, cancellation);
430465
}
466+
431467
break;
432468
case P.HistoryEvent.EventTypeOneofCase.EntityOperationCompleted:
433469
if (e.EntityOperationCompleted is { } ecomp)
434470
{
435471
await this.MaybeResolveAsync(v => ecomp.Output = v, ecomp.Output, cancellation);
436472
}
473+
437474
break;
438475
case P.HistoryEvent.EventTypeOneofCase.HistoryState:
439476
if (e.HistoryState is { } hs && hs.OrchestrationState is { } os)
@@ -442,6 +479,7 @@ async Task ResolveEventPayloadsAsync(P.HistoryEvent e, CancellationToken cancell
442479
await this.MaybeResolveAsync(v => os.Output = v, os.Output, cancellation);
443480
await this.MaybeResolveAsync(v => os.CustomStatus = v, os.CustomStatus, cancellation);
444481
}
482+
445483
break;
446484
}
447485
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
5+
<PackageDescription>The gRPC Protobuf .NET services for Durable Task Framework.</PackageDescription>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
9+
<PackageReference Include="Google.Protobuf" />
10+
</ItemGroup>
11+
12+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
13+
<PackageReference Include="Grpc.Core" />
14+
</ItemGroup>
15+
16+
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
17+
<PackageReference Include="Grpc.Net.Client" />
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<Protobuf Include="backend_service.proto"
22+
GrpcServices="None"
23+
Access="Public"
24+
Namespace="Microsoft.DurableTask.AzureManagedBackend.Protobuf" />
25+
<Protobuf Include="orchestrator_service.proto"
26+
GrpcServices="None"
27+
Access="Public"
28+
Namespace="Microsoft.DurableTask.AzureManagedBackend.Protobuf" />
29+
</ItemGroup>
30+
31+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Durable Task Protobuf
2+
3+
This directory contains the protobuf definitions for the Durable Task SDK, which are used to generate the C# source code for the gRPC service contracts. The official protobuf definitions are maintained in the [Durable Task Protobuf repository](https://github.com/microsoft/durabletask-protobuf).
4+
5+
## Updating the Protobuf Definitions
6+
7+
To update the protobuf definitions in this directory, follow these steps:
8+
9+
1. Make sure you have [PowerShell](https://learn.microsoft.com/powershell/scripting/install/installing-powershell) installed on your machine.
10+
2. Run the following command to download the latest protobuf definitions from the Durable Task SDK repository:
11+
12+
```powershell
13+
.\refresh-protos.ps1
14+
```
15+
16+
This script will download the latest protobuf definitions from the `https://github.com/microsoft/durabletask-protobuf` repository and copy them to this directory.
17+
18+
By default, the latest versions of the protobufs are downloaded from the `main` branch. To specify an alternative branch, use the `-branch` parameter:
19+
20+
```powershell
21+
.\refresh-protos.ps1 -branch <branch-name>
22+
```
23+
24+
The `versions.txt` file in this directory contains the list of protobuf files and their commit hashes that were last downloaded. It is updated automatically by the `refresh-protos.ps1` script.

src/Grpc/backend_service.proto renamed to src/Grpc.AzureManagedBackend/backend_service.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ syntax = "proto3";
55

66
package durabletask.protos.backend.v1;
77

8-
option csharp_namespace = "Microsoft.DurableTask.Protobuf";
8+
option csharp_namespace = "Microsoft.DurableTask.AzureManagedBackend.Protobuf";
99
option java_package = "com.microsoft.durabletask.implementation.protobuf";
1010
option go_package = "github.com/microsoft/durabletask-protobuf/internal/protos";
1111

0 commit comments

Comments
 (0)