feat: submitStreaming + detached-invocation client (T2/T3)
Some checks failed
Security / Security check (push) Failing after 2s
Some checks failed
Security / Security check (push) Failing after 2s
Regenerates the gRPC stubs from the updated proto and adds: - HubClient.submitStreaming(...) -> Stream<SubmitStreamEvent>: follow a flow execution live (step markers, module emit-events, terminal result/error). Works over native gRPC and, on web, gRPC-Web (the same conditional channel factory the rest of the SDK uses). - submit(..., detach: true) and getInvocationStatus / getInvocationResult / cancelInvocation wrappers (T3). - SubmitStreamEvent + InvocationStatus re-exported as typedefs. Shared _buildSubmitRequest between submit + submitStreaming. analyze clean, tests pass. Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
parent
0d2e939867
commit
c46dc58ac3
5 changed files with 1038 additions and 5 deletions
|
|
@ -17,6 +17,7 @@ import 'package:grpc/service_api.dart' as $grpc;
|
|||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
import 'package:protobuf/well_known_types/google/protobuf/empty.pb.dart' as $1;
|
||||
|
||||
import 'common.pb.dart' as $2;
|
||||
import 'hub.pb.dart' as $0;
|
||||
|
||||
export 'hub.pb.dart';
|
||||
|
|
@ -42,6 +43,20 @@ class HubClient extends $grpc.Client {
|
|||
return $createUnaryCall(_$submit, request, options: options);
|
||||
}
|
||||
|
||||
/// Submit a flow and follow its execution live (added 1.1). Same
|
||||
/// request as unary Submit; the response is a stream of step markers,
|
||||
/// ephemeral module events (host.emit-event), and finally the result
|
||||
/// or an error. Works over native gRPC and gRPC-Web (server
|
||||
/// streaming). Unary Submit is unchanged for clients that don't care.
|
||||
$grpc.ResponseStream<$0.SubmitStreamEvent> submitStream(
|
||||
$0.SubmitRequest request, {
|
||||
$grpc.CallOptions? options,
|
||||
}) {
|
||||
return $createStreamingCall(
|
||||
_$submitStream, $async.Stream.fromIterable([request]),
|
||||
options: options);
|
||||
}
|
||||
|
||||
/// List modules known to this hub.
|
||||
$grpc.ResponseFuture<$0.ModuleList> listModules(
|
||||
$1.Empty request, {
|
||||
|
|
@ -50,6 +65,31 @@ class HubClient extends $grpc.Client {
|
|||
return $createUnaryCall(_$listModules, request, options: options);
|
||||
}
|
||||
|
||||
/// Detached-invocation lifecycle (added 1.1). Only invocations
|
||||
/// submitted with detach=true are tracked; results are retained under
|
||||
/// hard operator limits (size/count/TTL) and NOT persisted across a
|
||||
/// hub restart.
|
||||
$grpc.ResponseFuture<$0.InvocationStatus> getInvocationStatus(
|
||||
$2.InvocationId request, {
|
||||
$grpc.CallOptions? options,
|
||||
}) {
|
||||
return $createUnaryCall(_$getInvocationStatus, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.SubmitResponse> getInvocationResult(
|
||||
$2.InvocationId request, {
|
||||
$grpc.CallOptions? options,
|
||||
}) {
|
||||
return $createUnaryCall(_$getInvocationResult, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.CancelInvocationResponse> cancelInvocation(
|
||||
$2.InvocationId request, {
|
||||
$grpc.CallOptions? options,
|
||||
}) {
|
||||
return $createUnaryCall(_$cancelInvocation, request, options: options);
|
||||
}
|
||||
|
||||
/// Liveness / readiness probe.
|
||||
$grpc.ResponseFuture<$0.HealthStatus> health(
|
||||
$1.Empty request, {
|
||||
|
|
@ -65,10 +105,30 @@ class HubClient extends $grpc.Client {
|
|||
'/chain.v1.Hub/Submit',
|
||||
($0.SubmitRequest value) => value.writeToBuffer(),
|
||||
$0.SubmitResponse.fromBuffer);
|
||||
static final _$submitStream =
|
||||
$grpc.ClientMethod<$0.SubmitRequest, $0.SubmitStreamEvent>(
|
||||
'/chain.v1.Hub/SubmitStream',
|
||||
($0.SubmitRequest value) => value.writeToBuffer(),
|
||||
$0.SubmitStreamEvent.fromBuffer);
|
||||
static final _$listModules = $grpc.ClientMethod<$1.Empty, $0.ModuleList>(
|
||||
'/chain.v1.Hub/ListModules',
|
||||
($1.Empty value) => value.writeToBuffer(),
|
||||
$0.ModuleList.fromBuffer);
|
||||
static final _$getInvocationStatus =
|
||||
$grpc.ClientMethod<$2.InvocationId, $0.InvocationStatus>(
|
||||
'/chain.v1.Hub/GetInvocationStatus',
|
||||
($2.InvocationId value) => value.writeToBuffer(),
|
||||
$0.InvocationStatus.fromBuffer);
|
||||
static final _$getInvocationResult =
|
||||
$grpc.ClientMethod<$2.InvocationId, $0.SubmitResponse>(
|
||||
'/chain.v1.Hub/GetInvocationResult',
|
||||
($2.InvocationId value) => value.writeToBuffer(),
|
||||
$0.SubmitResponse.fromBuffer);
|
||||
static final _$cancelInvocation =
|
||||
$grpc.ClientMethod<$2.InvocationId, $0.CancelInvocationResponse>(
|
||||
'/chain.v1.Hub/CancelInvocation',
|
||||
($2.InvocationId value) => value.writeToBuffer(),
|
||||
$0.CancelInvocationResponse.fromBuffer);
|
||||
static final _$health = $grpc.ClientMethod<$1.Empty, $0.HealthStatus>(
|
||||
'/chain.v1.Hub/Health',
|
||||
($1.Empty value) => value.writeToBuffer(),
|
||||
|
|
@ -87,6 +147,13 @@ abstract class HubServiceBase extends $grpc.Service {
|
|||
false,
|
||||
($core.List<$core.int> value) => $0.SubmitRequest.fromBuffer(value),
|
||||
($0.SubmitResponse value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$0.SubmitRequest, $0.SubmitStreamEvent>(
|
||||
'SubmitStream',
|
||||
submitStream_Pre,
|
||||
false,
|
||||
true,
|
||||
($core.List<$core.int> value) => $0.SubmitRequest.fromBuffer(value),
|
||||
($0.SubmitStreamEvent value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$1.Empty, $0.ModuleList>(
|
||||
'ListModules',
|
||||
listModules_Pre,
|
||||
|
|
@ -94,6 +161,28 @@ abstract class HubServiceBase extends $grpc.Service {
|
|||
false,
|
||||
($core.List<$core.int> value) => $1.Empty.fromBuffer(value),
|
||||
($0.ModuleList value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$2.InvocationId, $0.InvocationStatus>(
|
||||
'GetInvocationStatus',
|
||||
getInvocationStatus_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $2.InvocationId.fromBuffer(value),
|
||||
($0.InvocationStatus value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$2.InvocationId, $0.SubmitResponse>(
|
||||
'GetInvocationResult',
|
||||
getInvocationResult_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $2.InvocationId.fromBuffer(value),
|
||||
($0.SubmitResponse value) => value.writeToBuffer()));
|
||||
$addMethod(
|
||||
$grpc.ServiceMethod<$2.InvocationId, $0.CancelInvocationResponse>(
|
||||
'CancelInvocation',
|
||||
cancelInvocation_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $2.InvocationId.fromBuffer(value),
|
||||
($0.CancelInvocationResponse value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$1.Empty, $0.HealthStatus>(
|
||||
'Health',
|
||||
health_Pre,
|
||||
|
|
@ -111,6 +200,14 @@ abstract class HubServiceBase extends $grpc.Service {
|
|||
$async.Future<$0.SubmitResponse> submit(
|
||||
$grpc.ServiceCall call, $0.SubmitRequest request);
|
||||
|
||||
$async.Stream<$0.SubmitStreamEvent> submitStream_Pre($grpc.ServiceCall $call,
|
||||
$async.Future<$0.SubmitRequest> $request) async* {
|
||||
yield* submitStream($call, await $request);
|
||||
}
|
||||
|
||||
$async.Stream<$0.SubmitStreamEvent> submitStream(
|
||||
$grpc.ServiceCall call, $0.SubmitRequest request);
|
||||
|
||||
$async.Future<$0.ModuleList> listModules_Pre(
|
||||
$grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async {
|
||||
return listModules($call, await $request);
|
||||
|
|
@ -119,6 +216,30 @@ abstract class HubServiceBase extends $grpc.Service {
|
|||
$async.Future<$0.ModuleList> listModules(
|
||||
$grpc.ServiceCall call, $1.Empty request);
|
||||
|
||||
$async.Future<$0.InvocationStatus> getInvocationStatus_Pre(
|
||||
$grpc.ServiceCall $call, $async.Future<$2.InvocationId> $request) async {
|
||||
return getInvocationStatus($call, await $request);
|
||||
}
|
||||
|
||||
$async.Future<$0.InvocationStatus> getInvocationStatus(
|
||||
$grpc.ServiceCall call, $2.InvocationId request);
|
||||
|
||||
$async.Future<$0.SubmitResponse> getInvocationResult_Pre(
|
||||
$grpc.ServiceCall $call, $async.Future<$2.InvocationId> $request) async {
|
||||
return getInvocationResult($call, await $request);
|
||||
}
|
||||
|
||||
$async.Future<$0.SubmitResponse> getInvocationResult(
|
||||
$grpc.ServiceCall call, $2.InvocationId request);
|
||||
|
||||
$async.Future<$0.CancelInvocationResponse> cancelInvocation_Pre(
|
||||
$grpc.ServiceCall $call, $async.Future<$2.InvocationId> $request) async {
|
||||
return cancelInvocation($call, await $request);
|
||||
}
|
||||
|
||||
$async.Future<$0.CancelInvocationResponse> cancelInvocation(
|
||||
$grpc.ServiceCall call, $2.InvocationId request);
|
||||
|
||||
$async.Future<$0.HealthStatus> health_Pre(
|
||||
$grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async {
|
||||
return health($call, await $request);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue