mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed?
Migrating the `component/callbacks/statemachine{_test}.go` to
`chasm/lib/callback` using the `CHASM` framework
## Why?
Part 2 of X for migrating callback to CHASM.
## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [X] added new unit test(s)
- [ ] added new functional test(s)
## Potential risks
None
---------
Co-authored-by: Roey Berman <[email protected]>
72 lines
2.4 KiB
Protocol Buffer
72 lines
2.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package temporal.server.chasm.lib.callbacks.proto.v1;
|
|
|
|
option go_package = "go.temporal.io/server/chasm/lib/callbacks/gen/callbackspb;callbackspb";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
import "temporal/api/common/v1/message.proto";
|
|
import "temporal/api/failure/v1/message.proto";
|
|
|
|
message CallbackState {
|
|
// Trigger for when the workflow is closed.
|
|
message WorkflowClosed {}
|
|
|
|
// Information on how this callback should be invoked (e.g. its URL and type).
|
|
Callback callback = 1;
|
|
// The time when the callback was registered.
|
|
google.protobuf.Timestamp registration_time = 3;
|
|
|
|
CallbackStatus status = 4;
|
|
// The number of attempts made to deliver the callback.
|
|
// This number represents a minimum bound since the attempt is incremented after the callback request completes.
|
|
int32 attempt = 5;
|
|
|
|
// The time when the last attempt completed.
|
|
google.protobuf.Timestamp last_attempt_complete_time = 6;
|
|
// The last attempt's failure, if any.
|
|
temporal.api.failure.v1.Failure last_attempt_failure = 7;
|
|
// The time when the next attempt is scheduled.
|
|
// NOTE (seankane): this field might go away in the future, discussion:
|
|
// https://github.com/temporalio/temporal/pull/8473#discussion_r2427348436
|
|
google.protobuf.Timestamp next_attempt_schedule_time = 8;
|
|
|
|
// Request ID that added the callback.
|
|
string request_id = 9;
|
|
}
|
|
|
|
|
|
// Status of a callback.
|
|
enum CallbackStatus {
|
|
// Default value, unspecified state.
|
|
CALLBACK_STATUS_UNSPECIFIED = 0;
|
|
// Callback is standing by, waiting to be triggered.
|
|
CALLBACK_STATUS_STANDBY = 1;
|
|
// Callback is in the queue waiting to be executed or is currently executing.
|
|
CALLBACK_STATUS_SCHEDULED = 2;
|
|
// Callback has failed with a retryable error and is backing off before the next attempt.
|
|
CALLBACK_STATUS_BACKING_OFF = 3;
|
|
// Callback has failed.
|
|
CALLBACK_STATUS_FAILED = 4;
|
|
// Callback has succeeded.
|
|
CALLBACK_STATUS_SUCCEEDED = 5;
|
|
}
|
|
|
|
message Callback {
|
|
message Nexus {
|
|
// Callback URL.
|
|
// (-- api-linter: core::0140::uri=disabled
|
|
// aip.dev/not-precedent: Not respecting aip here. --)
|
|
string url = 1;
|
|
// Header to attach to callback request.
|
|
map<string, string> header = 2;
|
|
}
|
|
|
|
reserved 1; // For a generic callback mechanism to be added later.
|
|
oneof variant {
|
|
Nexus nexus = 2;
|
|
}
|
|
|
|
repeated temporal.api.common.v1.Link links = 100;
|
|
}
|