|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package temporal.api.stream.v1; |
| 4 | + |
| 5 | +option go_package = "go.temporal.io/api/stream/v1;stream"; |
| 6 | +option java_package = "io.temporal.api.stream.v1"; |
| 7 | +option java_multiple_files = true; |
| 8 | +option java_outer_classname = "MessageProto"; |
| 9 | +option ruby_package = "Temporalio::Api::Stream::V1"; |
| 10 | +option csharp_namespace = "Temporalio.Api.Stream.V1"; |
| 11 | + |
| 12 | +import "google/protobuf/timestamp.proto"; |
| 13 | + |
| 14 | +import "temporal/api/common/v1/message.proto"; |
| 15 | +import "temporal/api/enums/v1/stream.proto"; |
| 16 | +import "temporal/api/failure/v1/message.proto"; |
| 17 | + |
| 18 | +// Experimental. Might change in the future. |
| 19 | +// Identifies one Stream. The id is opaque to callers. |
| 20 | +message StreamRef { |
| 21 | + string id = 1; |
| 22 | + // Unset for a client's Stream. For a Workflow, business_id is the Workflow ID and run_id is |
| 23 | + // the first execution run id of its run chain. For a Standalone Activity, business_id is the |
| 24 | + // activity ID and run_id is its run id. A create and a close of a Workflow-owned Stream must |
| 25 | + // name its owner. |
| 26 | + temporal.api.common.v1.Execution owner = 2; |
| 27 | + // The name of the backend that holds the Stream, as the Worker and client config register |
| 28 | + // it, so every process routes a ref it receives. Empty is the default backend. The Store |
| 29 | + // never reads it. |
| 30 | + string backend = 3; |
| 31 | +} |
| 32 | + |
| 33 | +// Experimental. Might change in the future. |
| 34 | +// The ordered attempt of a Producer. Compared in this order: task_started_event_id, |
| 35 | +// task_attempt, task_started_time, attempt_scheduled_time, attempt. A field that a kind does |
| 36 | +// not use is empty and compares as zero. A timestamp compares seconds, then nanos. |
| 37 | +message ProducerEpoch { |
| 38 | + // The Workflow Task of a Workflow, or the one that dispatched a Local Activity. |
| 39 | + int64 task_started_event_id = 1; |
| 40 | + int32 task_attempt = 2; |
| 41 | + // Tells a reused started event id apart, for example after a dropped speculative task. |
| 42 | + google.protobuf.Timestamp task_started_time = 5; |
| 43 | + // When the server scheduled an Activity's attempt. A reset makes it later. |
| 44 | + google.protobuf.Timestamp attempt_scheduled_time = 3; |
| 45 | + // Activity, Local Activity and client attempt. |
| 46 | + int32 attempt = 4; |
| 47 | +} |
| 48 | + |
| 49 | +// Experimental. Might change in the future. |
| 50 | +message Producer { |
| 51 | + temporal.api.enums.v1.StreamProducerKind kind = 1; |
| 52 | + string id = 2; |
| 53 | + ProducerEpoch epoch = 3; |
| 54 | + // The run of the Producer, so nobody parses the id. Empty for a client. |
| 55 | + string run_id = 4; |
| 56 | +} |
| 57 | + |
| 58 | +// Experimental. Might change in the future. |
| 59 | +message WorkflowTaskEpoch { |
| 60 | + int64 started_event_id = 1; |
| 61 | + int32 attempt = 2; |
| 62 | + google.protobuf.Timestamp started_time = 3; |
| 63 | +} |
| 64 | + |
| 65 | +// Experimental. Might change in the future. |
| 66 | +message AppendRecord { |
| 67 | + reserved 1; |
| 68 | + reserved "topic"; |
| 69 | + temporal.api.common.v1.Payload body = 2; |
| 70 | +} |
| 71 | + |
| 72 | +// Experimental. Might change in the future. |
| 73 | +message Supersession { |
| 74 | + temporal.api.enums.v1.StreamProducerKind producer_kind = 1; |
| 75 | + string producer_id = 2; |
| 76 | + ProducerEpoch epoch = 3; |
| 77 | + // Workflow only. |
| 78 | + WorkflowTaskEpoch previous_completed_task = 4; |
| 79 | + repeated int64 failed_tasks = 5; |
| 80 | + // Workflow retry only. The previous run. Every Record whose Producer carries it is withdrawn. |
| 81 | + string withdraw_run = 6; |
| 82 | + // The run of the Producer, so nobody parses the id. Empty for a client. |
| 83 | + string run_id = 7; |
| 84 | +} |
| 85 | + |
| 86 | +// Experimental. Might change in the future. |
| 87 | +// One Record that a Producer appended. |
| 88 | +message StreamData { |
| 89 | + reserved 1; |
| 90 | + reserved "topic"; |
| 91 | + Producer producer = 2; |
| 92 | + temporal.api.common.v1.Payload body = 3; |
| 93 | +} |
| 94 | + |
| 95 | +// Experimental. Might change in the future. |
| 96 | +// The close of a Stream. A Stream has at most one, and a read returns it last. |
| 97 | +message StreamClose { |
| 98 | + // The Producer that closed the Stream. |
| 99 | + Producer producer = 1; |
| 100 | + temporal.api.common.v1.Payload result = 2; |
| 101 | + temporal.api.failure.v1.Failure failure = 3; |
| 102 | + // The result or the failure stays next to it. |
| 103 | + temporal.api.enums.v1.StreamCloseStatus status = 4; |
| 104 | +} |
| 105 | + |
| 106 | +// Experimental. Might change in the future. |
| 107 | +// An offset is ordered and unique in one Stream, and it is sparse. Offsets have gaps, so they |
| 108 | +// don't count Records. Zero is never an offset. A read names its Stream, so the read checks the |
| 109 | +// offset against that Stream. |
| 110 | +message StreamRecord { |
| 111 | + int64 offset = 1; |
| 112 | + // A read item is a Record, a Superseded item or the close. |
| 113 | + oneof item { |
| 114 | + StreamData data = 2; |
| 115 | + // The first batch of a higher epoch carries it. It withdraws the earlier Records that its |
| 116 | + // facts name, and a reader drops them. |
| 117 | + Supersession superseded = 3; |
| 118 | + StreamClose close = 4; |
| 119 | + } |
| 120 | +} |
| 121 | + |
| 122 | +// Experimental. Might change in the future. |
| 123 | +// The details of a failed Stream call, in the gRPC status details and in the details of the |
| 124 | +// application failure of a Nexus operation. |
| 125 | +message StreamErrorDetails { |
| 126 | + temporal.api.enums.v1.StreamErrorReason reason = 1; |
| 127 | +} |
0 commit comments