Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions openapi/openapiv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -17525,9 +17525,11 @@
"NAMESPACE_STATE_UNSPECIFIED",
"NAMESPACE_STATE_REGISTERED",
"NAMESPACE_STATE_DEPRECATED",
"NAMESPACE_STATE_DELETED"
"NAMESPACE_STATE_DELETED",
"NAMESPACE_STATE_SOFT_DELETED"
],
"default": "NAMESPACE_STATE_UNSPECIFIED"
"default": "NAMESPACE_STATE_UNSPECIFIED",
"description": " - NAMESPACE_STATE_SOFT_DELETED: Set by OperatorService.SoftDeleteNamespace. Executions make no progress, but no data is\nremoved until the namespace is restored or deleted."
},
"v1NewWorkflowExecutionInfo": {
"type": "object",
Expand Down
2 changes: 2 additions & 0 deletions openapi/openapiv3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13619,6 +13619,7 @@ components:
- NAMESPACE_STATE_REGISTERED
- NAMESPACE_STATE_DEPRECATED
- NAMESPACE_STATE_DELETED
- NAMESPACE_STATE_SOFT_DELETED
type: string
format: enum
description:
Expand Down Expand Up @@ -18856,6 +18857,7 @@ components:
- NAMESPACE_STATE_REGISTERED
- NAMESPACE_STATE_DEPRECATED
- NAMESPACE_STATE_DELETED
- NAMESPACE_STATE_SOFT_DELETED
type: string
description: |-
New namespace state, server will reject if transition is not allowed.
Expand Down
11 changes: 11 additions & 0 deletions temporal/api/enums/v1/namespace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ enum NamespaceState {
NAMESPACE_STATE_REGISTERED = 1;
NAMESPACE_STATE_DEPRECATED = 2;
NAMESPACE_STATE_DELETED = 3;
// Set by OperatorService.SoftDeleteNamespace. Executions make no progress, but no data is
// removed until the namespace is restored or deleted.
NAMESPACE_STATE_SOFT_DELETED = 4;
}

// State of a restore started by OperatorService.RestoreNamespace.
enum NamespaceRestoreState {
NAMESPACE_RESTORE_STATE_UNSPECIFIED = 0;
NAMESPACE_RESTORE_STATE_RUNNING = 1;
NAMESPACE_RESTORE_STATE_COMPLETED = 2;
NAMESPACE_RESTORE_STATE_FAILED = 3;
}

enum ArchivalState {
Expand Down
42 changes: 42 additions & 0 deletions temporal/api/operatorservice/v1/request_response.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ option ruby_package = "Temporalio::Api::OperatorService::V1";
option csharp_namespace = "Temporalio.Api.OperatorService.V1";

import "temporal/api/enums/v1/common.proto";
import "temporal/api/enums/v1/namespace.proto";
import "temporal/api/nexus/v1/message.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

// (-- Search Attribute --)

Expand Down Expand Up @@ -60,6 +62,46 @@ message DeleteNamespaceResponse {
string deleted_namespace = 1;
}

message SoftDeleteNamespaceRequest {
// Only one of namespace or namespace_id must be specified to identify namespace.
string namespace = 1;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @yycptt should we still include this as an option?

string namespace_id = 2;
}

message SoftDeleteNamespaceResponse {
}

message RestoreNamespaceRequest {
// Only one of namespace or namespace_id must be specified to identify namespace.
string namespace = 1;
string namespace_id = 2;
}

message RestoreNamespaceResponse {
}

message DescribeNamespaceRestoreRequest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option here is RestoreNamespaceRequest returning a job token(maybe the runID of restore workflow) and DescribeNamespaceRestoreRequest passing that job token. That will help us query the status of multiple past operations. But maybe that is not very important since we only have on Restore operation per namespace at a time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I figured most of the time you wouldn't care about previous restore workflows. If you think this would be useful we can include this in another change.

// Only one of namespace or namespace_id must be specified to identify namespace.
string namespace = 1;
string namespace_id = 2;
}

message DescribeNamespaceRestoreResponse {
temporal.api.enums.v1.NamespaceRestoreState state = 1;
// Cluster that runs the restore job.
string host_cluster = 2;
google.protobuf.Timestamp start_time = 3;
// Unset while the restore is running.
google.protobuf.Timestamp close_time = 4;
// Run ID of the restore job.
string run_id = 5;
// Estimated when the refresh starts.
int64 total_execution_count = 6;
// Executions processed on every cluster.
int64 processed_execution_count = 7;
google.protobuf.Timestamp estimated_completion_time = 8;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if server should calculate this. Can the client calculate this based on start_time, current_time and the progress?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it can, I just included it so client wouldn't need to do this, and I suppose mostly irrelevant but it'd be calculated based off the clock of the server.

If it's something that might be useful to OSS users I figured might as well just have server provide this.

}

message AddOrUpdateRemoteClusterRequest {
// Frontend Address is a cross cluster accessible address for gRPC traffic. This field is required.
string frontend_address = 1;
Expand Down
17 changes: 17 additions & 0 deletions temporal/api/operatorservice/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ service OperatorService {
rpc DeleteNamespace (DeleteNamespaceRequest) returns (DeleteNamespaceResponse) {
}

// SoftDeleteNamespace moves a namespace to NAMESPACE_STATE_SOFT_DELETED on every cluster in its
// replication config. Executions stop making progress, but no data is removed. A running restore
// is marked failed. Idempotent.
rpc SoftDeleteNamespace (SoftDeleteNamespaceRequest) returns (SoftDeleteNamespaceResponse) {
}

// RestoreNamespace moves a soft-deleted namespace back to NAMESPACE_STATE_REGISTERED on every
// cluster in its replication config, then starts a job that refreshes every execution so they
// resume. Returns UNAVAILABLE until every cluster has the new state; retry until it succeeds.
// Idempotent.
rpc RestoreNamespace (RestoreNamespaceRequest) returns (RestoreNamespaceResponse) {
}

// DescribeNamespaceRestore reports the state and progress of the namespace's most recent restore.
rpc DescribeNamespaceRestore (DescribeNamespaceRestoreRequest) returns (DescribeNamespaceRestoreResponse) {
}

// AddOrUpdateRemoteCluster adds or updates remote cluster.
rpc AddOrUpdateRemoteCluster(AddOrUpdateRemoteClusterRequest) returns (AddOrUpdateRemoteClusterResponse) {
}
Expand Down
Loading