Skip to content

Commit 9bb5bc9

Browse files
committed
add thrift
1 parent 1d5806a commit 9bb5bc9

File tree

2 files changed

+109
-9
lines changed

2 files changed

+109
-9
lines changed

thrift/cadence.thrift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,32 @@ service WorkflowService {
126126
4: shared.AccessDeniedError accessDeniedError,
127127
)
128128

129+
/**
130+
* ListFailoverHistory returns the history of failover events for a domain.
131+
**/
132+
shared.ListFailoverHistoryResponse ListFailoverHistory(1: shared.ListFailoverHistoryRequest listRequest)
133+
throws (
134+
1: shared.BadRequestError badRequestError,
135+
2: shared.ServiceBusyError serviceBusyError,
136+
3: shared.ClientVersionNotSupportedError clientVersionNotSupportedError,
137+
4: shared.AccessDeniedError accessDeniedError,
138+
)
139+
140+
/**
141+
* GetFailoverEvent returns the cluster failovers that occurred as part of a specific failover event.
142+
* To construct the request, use:
143+
* - domain_id: the id of the domain to fetch the failover event for.
144+
* - failover_event_id: the id of the failover event to fetch.
145+
* - created_time: the time the failover event was created.
146+
**/
147+
shared.GetFailoverEventResponse GetFailoverEvent(1: shared.GetFailoverEventRequest getRequest)
148+
throws (
149+
1: shared.BadRequestError badRequestError,
150+
2: shared.ServiceBusyError serviceBusyError,
151+
3: shared.ClientVersionNotSupportedError clientVersionNotSupportedError,
152+
4: shared.AccessDeniedError accessDeniedError,
153+
)
154+
129155
/**
130156
* RestartWorkflowExecution restarts a previous workflow
131157
* If the workflow is currently running it will terminate and restart

thrift/shared.thrift

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,16 +1115,16 @@ struct ClusterAttributeScope {
11151115
// activeClustersByClusterAttribute is a map of whatever subdivision of the domain chosen
11161116
// to active cluster info for active-active domains. The key refers to the type of
11171117
// cluster attribute and the value refers to its cluster mappings.
1118-
//
1118+
//
11191119
// For example, a request to update the domain for two locations
1120-
//
1120+
//
11211121
// UpdateDomainRequest{
11221122
// ReplicationConfiguration: {
11231123
// ActiveClusters: {
11241124
// ActiveClustersByClusterAttribute: {
11251125
// "location": ClusterAttributeScope{
1126-
// "Tokyo": {ActiveClusterInfo: "cluster0, FailoverVersion: 123},
1127-
// "Morocco": {ActiveClusterInfo: "cluster1", FailoverVersion: 100},
1126+
// "Tokyo": {ActiveClusterInfo: "cluster0, FailoverVersion: 123},
1127+
// "Morocco": {ActiveClusterInfo: "cluster1", FailoverVersion: 100},
11281128
// }
11291129
// }
11301130
// }
@@ -1232,6 +1232,64 @@ struct DeleteDomainRequest {
12321232
20: optional string securityToken
12331233
}
12341234

1235+
struct ListFailoverHistoryRequest {
1236+
// ListFailoverHistoryRequestFilters specifies the filters to apply to the request.
1237+
// If not provided all failover events will be returned.
1238+
10: optional ListFailoverHistoryRequestFilters filters
1239+
// PaginationOptions will be used to paginate the results.
1240+
// If not provided the first 5 events will be returned.
1241+
20: optional PaginationOptions pagination
1242+
}
1243+
1244+
struct ListFailoverHistoryRequestFilters {
1245+
// domain_id is the id of the domain to list failover history for.
1246+
10: optional string domainID
1247+
// attributes specifies every attribute type that should be returned on the request. If none are specified, defaults to all ClusterAttributes.
1248+
// If multiple attributes are specified all failover events containing any of the attributes will be returned.
1249+
20: optional list<ClusterAttribute> attributes
1250+
// default_active_cluster: when true, retrieves the domain wide ActiveClusterName failover events.
1251+
30: optional bool defaultActiveCluster
1252+
}
1253+
1254+
struct ListFailoverHistoryResponse {
1255+
10: optional list<FailoverEvent> failoverEvents
1256+
// next_page_token can be passed in a subsequent request to fetch the next set of events.
1257+
20: optional binary nextPageToken
1258+
}
1259+
1260+
struct FailoverEvent {
1261+
// id of the failover event
1262+
// Can be passed with the created time to fetch a specific event.
1263+
10: optional string id
1264+
// created_time is the time the failover event was created.
1265+
// Can be passed with the ID to fetch a specific event.
1266+
20: optional i64 (js.type = "Long") createdTime
1267+
30: optional FailoverType failoverType
1268+
}
1269+
1270+
struct ClusterFailover {
1271+
10: optional ActiveClusterInfo fromCluster
1272+
20: optional ActiveClusterInfo toCluster
1273+
// cluster_attribute is the scope and name for the attribute that was failed over.
1274+
// It will not be defined when is_default_cluster is true.
1275+
30: optional ClusterAttribute clusterAttribute
1276+
// If the failover was for the default domain-wide active cluster name.
1277+
40: optional bool isDefaultCluster
1278+
}
1279+
1280+
// GetFailoverEventRequest is used to fetch a specific failover event by id and created time.
1281+
struct GetFailoverEventRequest {
1282+
10: optional string domainID
1283+
20: optional string failoverEventID
1284+
30: optional i64 (js.type = "Long") createdTime
1285+
}
1286+
1287+
// GetFailoverEventResponse contains the cluster failovers that occurred as part of the failover event.
1288+
// It may be a large response if 1000s of ClusterAttributes were failed over as part of the event.
1289+
struct GetFailoverEventResponse {
1290+
10: optional list<ClusterFailover> clusterFailovers
1291+
}
1292+
12351293
struct StartWorkflowExecutionRequest {
12361294
10: optional string domain
12371295
20: optional string workflowId
@@ -2169,26 +2227,42 @@ struct ActiveClusterSelectionPolicy {
21692227
// ClusterAttribute is used for subdividing workflows in a domain into their active
21702228
// and passive clusters. Examples of this might be 'region' and 'cluster1' as
21712229
// respective region and scope fields.
2172-
//
2230+
//
21732231
// for example, a workflow may specify this in it's start request:
2174-
//
2232+
//
21752233
// StartWorkflowRequest{
21762234
// ActiveClusterSelectionPolicy: {
21772235
// ClusterAttribute: {
21782236
// Scope: "cityID",
2179-
// Name: "Lisbon"
2237+
// Name: "Lisbon"
21802238
// }
21812239
// }
21822240
// }
2183-
//
2241+
//
21842242
// and this means that this workflow will be associate with the domain's cluster attribute 'Lisbon',
2185-
// be active in the cluster that has Lisbon active and
2243+
// be active in the cluster that has Lisbon active and
21862244
// failover when that cluster-attribute is set to failover.
21872245
struct ClusterAttribute {
21882246
1: optional string scope
21892247
2: optional string name
21902248
}
21912249

2250+
// FailoverType describes how a failover operation will be performed.
2251+
enum FailoverType {
2252+
INVALID,
2253+
FORCE,
2254+
GRACEFUL,
2255+
}
2256+
2257+
// PaginationOptions provides common options for paginated RPCs.
2258+
struct PaginationOptions {
2259+
// page_size configures the number of results to be returned as part of each page
2260+
10: optional i32 pageSize
2261+
// next_page_token should be provided from a previous response to fetch the next page.
2262+
// if empty, the first page will be returned.
2263+
20: optional binary nextPageToken
2264+
}
2265+
21922266
// todo (david.porter) Remove this, as it's no longer needed
21932267
// with the active/active configuration we have
21942268
enum ActiveClusterSelectionStrategy {

0 commit comments

Comments
 (0)