Skip to content

Commit cfd509c

Browse files
authored
Feat/long running operations (#42)
Changed the return value of simulation-type calls from stream to long-running operation.
1 parent cf435a4 commit cfd509c

File tree

12 files changed

+1041
-12
lines changed

12 files changed

+1041
-12
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,7 @@ To publicly release the packages, ensure your branch is up-to-date and then push
7373
git tag v0.5.0
7474
git push --tags
7575
```
76+
77+
#### Google protobuf files
78+
79+
The Google third-party protobuf files were obtained from [googleapis](https://github.com/googleapis/googleapis).

ansys/api/additive/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.7.0-dev7
1+
2.0.0-dev0

ansys/api/additive/v0/additive_materials.proto

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package ansys.api.additive.v0.materials;
66
option csharp_namespace = "Ansys.Api.Additive.Materials";
77

88
import "ansys/api/additive/v0/additive_domain.proto";
9+
import "google/longrunning/operations.proto";
910
import "google/protobuf/empty.proto";
1011

1112
service MaterialsService {
@@ -18,7 +19,12 @@ service MaterialsService {
1819

1920
rpc GetMaterial (GetMaterialRequest) returns (AdditiveMaterial);
2021

21-
rpc TuneMaterial (TuneMaterialRequest) returns (stream TuneMaterialResponse);
22+
rpc TuneMaterial (TuneMaterialRequest) returns (google.longrunning.Operation) {
23+
option (google.longrunning.operation_info) = {
24+
response_type: "TuneMaterialResponse"
25+
metadata_type: "OperationMetadata"
26+
};
27+
}
2228
}
2329

2430
message AddMaterialRequest {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2024 ANSYS, Inc.
2+
3+
syntax = "proto3";
4+
5+
package ansys.api.additive.v0;
6+
7+
option csharp_namespace = "Ansys.Api.Additive";
8+
9+
import "ansys/api/additive/v0/additive_domain.proto";
10+
import "google/protobuf/timestamp.proto";
11+
12+
// Metadata for a long running operation
13+
message OperationMetadata {
14+
google.protobuf.Timestamp creation_time = 1;
15+
google.protobuf.Timestamp end_time = 2;
16+
string simulation_id = 3;
17+
string context = 4;
18+
string message = 5;
19+
float percent_complete = 6;
20+
ProgressState state = 7;
21+
}

ansys/api/additive/v0/additive_simulation.proto

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,26 @@ package ansys.api.additive.v0.simulation;
66
option csharp_namespace = "Ansys.Api.Additive.Simulation";
77

88
import "ansys/api/additive/v0/additive_domain.proto";
9+
import "google/longrunning/operations.proto";
910

1011
service SimulationService {
11-
rpc Simulate(SimulationRequest) returns (stream SimulationResponse);
12+
rpc Simulate(SimulationRequest) returns (google.longrunning.Operation) {
13+
option (google.longrunning.operation_info) = {
14+
response_type: "SimulationResponse"
15+
metadata_type: "OperationMetadata"
16+
};
17+
}
18+
1219
rpc UploadFile(stream UploadFileRequest) returns (stream UploadFileResponse);
20+
1321
rpc DownloadFile(DownloadFileRequest) returns (stream DownloadFileResponse);
14-
rpc Mesh(MeshRequest) returns (stream MeshResponse);
22+
23+
rpc Mesh(MeshRequest) returns (google.longrunning.Operation) {
24+
option (google.longrunning.operation_info) = {
25+
response_type: "MeshResponse"
26+
metadata_type: "OperationMetadata"
27+
};
28+
}
1529
}
1630

1731
message SimulationResponse {

csharp/Ansys.Api.Additive.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<Protobuf Include="../google/**/*.proto" ProtoRoot=".." GrpcServices="both" />
1515
</ItemGroup>
1616
<ItemGroup>
17-
<PackageReference Include="Google.Protobuf" Version="3.21.9" />
18-
<PackageReference Include="Grpc" Version="2.46.5" />
17+
<PackageReference Include="Google.Protobuf" Version="3.26.1" />
18+
<PackageReference Include="Grpc" Version="2.46.6" />
1919
<PackageReference Include="Grpc.Tools" Version="2.50.0">
2020
<PrivateAssets>all</PrivateAssets>
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

0 commit comments

Comments
 (0)