Skip to content

Commit

Permalink
add wait-for-process-completion
Browse files Browse the repository at this point in the history
  • Loading branch information
zklgame committed Apr 10, 2024
1 parent ae652fc commit caaf70a
Show file tree
Hide file tree
Showing 39 changed files with 4,326 additions and 1 deletion.
99 changes: 98 additions & 1 deletion api-schema/xcherry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,27 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ApiErrorResponse'
/api/v1/xcherry/service/process-execution/wait-for-process-completion:
post:
summary: wait for a process completion
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionRequest'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionResponse'
default:
description: "400: Invalid request, 404: Process execution not exists"
content:
application/json:
schema:
$ref: '#/components/schemas/ApiErrorResponse'
# workers APIs are hosted by applications via SDKs, for server to call back
/api/v1/xcherry/worker/async-state/wait-until:
post:
Expand Down Expand Up @@ -222,7 +243,34 @@ paths:
responses:
'200':
description: successful operation
content: {}
content: {}
/internal/api/v1/xcherry/wait-for-process-completion:
post:
summary: "for api service to ask async service to wait for process completion"
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionRequest'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionResponse'
/internal/api/v1/xcherry/signal-process-completion:
post:
summary: "for async service to signal for process completion"
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SignalProcessCompletionRequest'
responses:
'200':
description: successful operation
content: {}
components:
schemas:
ProcessExecutionDescribeRequest:
Expand Down Expand Up @@ -812,6 +860,33 @@ components:
processExecutionId:
type: string
description: optional field for distributed database without global secondary index, to pull for specific task rather than a page
WaitForProcessCompletionRequest:
required:
- shardId
- processExecutionId
type: object
properties:
shardId:
type: integer
processExecutionId:
type: string
WaitForProcessCompletionResponse:
type: object
properties:
timeout:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
SignalProcessCompletionRequest:
required:
- shardId
- processExecutionId
type: object
properties:
shardId:
type: integer
processExecutionId:
type: string
ProcessExecutionStopRequest:
type: object
description: the request for stopping a process execution
Expand Down Expand Up @@ -872,6 +947,28 @@ components:
properties:
output:
$ref: '#/components/schemas/EncodedObject'
ProcessExecutionWaitForCompletionRequest:
type: object
description: the request for waiting for a process completion
required:
- namespace
- processId
properties:
namespace:
type: string
processId:
type: string
timeoutSeconds:
type: integer
description: the timeout for the waiting operation
ProcessExecutionWaitForCompletionResponse:
type: object
description: the response for waiting for a process completion
properties:
timeout:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
ProcessRpcWorkerRequest:
type: object
description: the request of the worker RPC API
Expand Down
10 changes: 10 additions & 0 deletions goapi/xcapi/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ docs/ProcessExecutionStartRequest.md
docs/ProcessExecutionStartResponse.md
docs/ProcessExecutionStopRequest.md
docs/ProcessExecutionStopType.md
docs/ProcessExecutionWaitForCompletionRequest.md
docs/ProcessExecutionWaitForCompletionResponse.md
docs/ProcessIdFilter.md
docs/ProcessIdReusePolicy.md
docs/ProcessRpcWorkerRequest.md
Expand All @@ -65,6 +67,7 @@ docs/ProcessStatus.md
docs/ProcessTypeFilter.md
docs/PublishToLocalQueueRequest.md
docs/RetryPolicy.md
docs/SignalProcessCompletionRequest.md
docs/StateDecision.md
docs/StateFailureRecoveryOptions.md
docs/StateFailureRecoveryPolicy.md
Expand All @@ -74,6 +77,8 @@ docs/ThreadCloseType.md
docs/TimeRangeFilter.md
docs/TimerCommand.md
docs/TimerResult.md
docs/WaitForProcessCompletionRequest.md
docs/WaitForProcessCompletionResponse.md
docs/WorkerApiType.md
docs/WorkerErrorResponse.md
docs/WriteConflictMode.md
Expand Down Expand Up @@ -129,6 +134,8 @@ model_process_execution_start_request.go
model_process_execution_start_response.go
model_process_execution_stop_request.go
model_process_execution_stop_type.go
model_process_execution_wait_for_completion_request.go
model_process_execution_wait_for_completion_response.go
model_process_id_filter.go
model_process_id_reuse_policy.go
model_process_rpc_worker_request.go
Expand All @@ -138,6 +145,7 @@ model_process_status.go
model_process_type_filter.go
model_publish_to_local_queue_request.go
model_retry_policy.go
model_signal_process_completion_request.go
model_state_decision.go
model_state_failure_recovery_options.go
model_state_failure_recovery_policy.go
Expand All @@ -147,6 +155,8 @@ model_thread_close_type.go
model_time_range_filter.go
model_timer_command.go
model_timer_result.go
model_wait_for_process_completion_request.go
model_wait_for_process_completion_response.go
model_worker_api_type.go
model_worker_error_response.go
model_write_conflict_mode.go
Expand Down
8 changes: 8 additions & 0 deletions goapi/xcapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,14 @@ Class | Method | HTTP request | Description
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionRpcPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionrpcpost) | **Post** /api/v1/xcherry/service/process-execution/rpc | execute a RPC method of a process execution
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionStartPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionstartpost) | **Post** /api/v1/xcherry/service/process-execution/start | start a process execution
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionStopPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionstoppost) | **Post** /api/v1/xcherry/service/process-execution/stop | stop a process execution
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionWaitForProcessCompletionPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionwaitforprocesscompletionpost) | **Post** /api/v1/xcherry/service/process-execution/wait-for-process-completion | wait for a process completion
*DefaultAPI* | [**ApiV1XcherryWorkerAsyncStateExecutePost**](docs/DefaultAPI.md#apiv1xcherryworkerasyncstateexecutepost) | **Post** /api/v1/xcherry/worker/async-state/execute | invoking AsyncState.execute API
*DefaultAPI* | [**ApiV1XcherryWorkerAsyncStateWaitUntilPost**](docs/DefaultAPI.md#apiv1xcherryworkerasyncstatewaituntilpost) | **Post** /api/v1/xcherry/worker/async-state/wait-until | invoking AsyncState.waitUntil API
*DefaultAPI* | [**ApiV1XcherryWorkerProcessRpcPost**](docs/DefaultAPI.md#apiv1xcherryworkerprocessrpcpost) | **Post** /api/v1/xcherry/worker/process/rpc | execute a RPC method of a process execution in the worker
*DefaultAPI* | [**InternalApiV1XcherryNotifyImmediateTasksPost**](docs/DefaultAPI.md#internalapiv1xcherrynotifyimmediatetaskspost) | **Post** /internal/api/v1/xcherry/notify-immediate-tasks | for api service to tell async service that there are new immediate tasks added to the queue
*DefaultAPI* | [**InternalApiV1XcherryNotifyTimerTasksPost**](docs/DefaultAPI.md#internalapiv1xcherrynotifytimertaskspost) | **Post** /internal/api/v1/xcherry/notify-timer-tasks | for api service to tell async service that there are new timer tasks added to the queue
*DefaultAPI* | [**InternalApiV1XcherrySignalProcessCompletionPost**](docs/DefaultAPI.md#internalapiv1xcherrysignalprocesscompletionpost) | **Post** /internal/api/v1/xcherry/signal-process-completion | for async service to signal for process completion
*DefaultAPI* | [**InternalApiV1XcherryWaitForProcessCompletionPost**](docs/DefaultAPI.md#internalapiv1xcherrywaitforprocesscompletionpost) | **Post** /internal/api/v1/xcherry/wait-for-process-completion | for api service to ask async service to wait for process completion


## Documentation For Models
Expand Down Expand Up @@ -141,6 +144,8 @@ Class | Method | HTTP request | Description
- [ProcessExecutionStartResponse](docs/ProcessExecutionStartResponse.md)
- [ProcessExecutionStopRequest](docs/ProcessExecutionStopRequest.md)
- [ProcessExecutionStopType](docs/ProcessExecutionStopType.md)
- [ProcessExecutionWaitForCompletionRequest](docs/ProcessExecutionWaitForCompletionRequest.md)
- [ProcessExecutionWaitForCompletionResponse](docs/ProcessExecutionWaitForCompletionResponse.md)
- [ProcessIdFilter](docs/ProcessIdFilter.md)
- [ProcessIdReusePolicy](docs/ProcessIdReusePolicy.md)
- [ProcessRpcWorkerRequest](docs/ProcessRpcWorkerRequest.md)
Expand All @@ -150,6 +155,7 @@ Class | Method | HTTP request | Description
- [ProcessTypeFilter](docs/ProcessTypeFilter.md)
- [PublishToLocalQueueRequest](docs/PublishToLocalQueueRequest.md)
- [RetryPolicy](docs/RetryPolicy.md)
- [SignalProcessCompletionRequest](docs/SignalProcessCompletionRequest.md)
- [StateDecision](docs/StateDecision.md)
- [StateFailureRecoveryOptions](docs/StateFailureRecoveryOptions.md)
- [StateFailureRecoveryPolicy](docs/StateFailureRecoveryPolicy.md)
Expand All @@ -159,6 +165,8 @@ Class | Method | HTTP request | Description
- [TimeRangeFilter](docs/TimeRangeFilter.md)
- [TimerCommand](docs/TimerCommand.md)
- [TimerResult](docs/TimerResult.md)
- [WaitForProcessCompletionRequest](docs/WaitForProcessCompletionRequest.md)
- [WaitForProcessCompletionResponse](docs/WaitForProcessCompletionResponse.md)
- [WorkerApiType](docs/WorkerApiType.md)
- [WorkerErrorResponse](docs/WorkerErrorResponse.md)
- [WriteConflictMode](docs/WriteConflictMode.md)
Expand Down
113 changes: 113 additions & 0 deletions goapi/xcapi/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,27 @@ paths:
description: |
400: Invalid request, 404: Process execution not exists, or not running to accept write operation, 424: app database write failure or worker RPC execution failure, see ErrorSubType for details
summary: execute a RPC method of a process execution
/api/v1/xcherry/service/process-execution/wait-for-process-completion:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionRequest'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionResponse'
description: successful operation
default:
content:
application/json:
schema:
$ref: '#/components/schemas/ApiErrorResponse'
description: "400: Invalid request, 404: Process execution not exists"
summary: wait for a process completion
/api/v1/xcherry/worker/async-state/wait-until:
post:
requestBody:
Expand Down Expand Up @@ -224,6 +245,33 @@ paths:
description: successful operation
summary: for api service to tell async service that there are new timer tasks
added to the queue
/internal/api/v1/xcherry/wait-for-process-completion:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionRequest'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionResponse'
description: successful operation
summary: for api service to ask async service to wait for process completion
/internal/api/v1/xcherry/signal-process-completion:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SignalProcessCompletionRequest'
responses:
"200":
content: {}
description: successful operation
summary: for async service to signal for process completion
components:
schemas:
ProcessExecutionDescribeRequest:
Expand Down Expand Up @@ -1654,6 +1702,42 @@ components:
- fireTimestamps
- shardId
type: object
WaitForProcessCompletionRequest:
example:
processExecutionId: processExecutionId
shardId: 0
properties:
shardId:
type: integer
processExecutionId:
type: string
required:
- processExecutionId
- shardId
type: object
WaitForProcessCompletionResponse:
example:
timeout: true
status: null
properties:
timeout:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
type: object
SignalProcessCompletionRequest:
example:
processExecutionId: processExecutionId
shardId: 0
properties:
shardId:
type: integer
processExecutionId:
type: string
required:
- processExecutionId
- shardId
type: object
ProcessExecutionStopRequest:
description: the request for stopping a process execution
example:
Expand Down Expand Up @@ -1757,6 +1841,35 @@ components:
output:
$ref: '#/components/schemas/EncodedObject'
type: object
ProcessExecutionWaitForCompletionRequest:
description: the request for waiting for a process completion
example:
processId: processId
namespace: namespace
timeoutSeconds: 0
properties:
namespace:
type: string
processId:
type: string
timeoutSeconds:
description: the timeout for the waiting operation
type: integer
required:
- namespace
- processId
type: object
ProcessExecutionWaitForCompletionResponse:
description: the response for waiting for a process completion
example:
timeout: true
status: null
properties:
timeout:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
type: object
ProcessRpcWorkerRequest:
description: the request of the worker RPC API
example:
Expand Down
Loading

0 comments on commit caaf70a

Please sign in to comment.