Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global attribute api protocols #8

Merged
merged 3 commits into from
Oct 30, 2023
Merged
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
111 changes: 109 additions & 2 deletions api-schema/xdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ components:
$ref: '#/components/schemas/EncodedObject'
commandResults:
$ref: '#/components/schemas/CommandResults'
loadedGlobalAttributes:
$ref: '#/components/schemas/LoadGlobalAttributeResponse'
CommandResults:
type: object
properties:
Expand Down Expand Up @@ -350,6 +352,10 @@ components:
type: array
items:
$ref: '#/components/schemas/LocalQueueMessage'
upsertGlobalAttributes:
type: array
items:
$ref: '#/components/schemas/GlobalAttributeValue'
StateDecision:
type: object
description: the decision at the end of state execution, either nextStates or threadCloseDecision is needed
Expand Down Expand Up @@ -414,8 +420,7 @@ components:
recoverFromStateExecutionId:
description: for async state API only, state id + sequence number
type: string
recoverFromApi:
description: if last execution failed, WAIT_UNTIL or EXECUTE, otherwise NONE
recoverFromApi: # if last execution failed, WAIT_UNTIL or EXECUTE, otherwise NONE
$ref: '#/components/schemas/StateApiType'
StateApiType:
type: string
Expand Down Expand Up @@ -488,6 +493,106 @@ components:
type: integer
idReusePolicy:
$ref: '#/components/schemas/ProcessIdReusePolicy'
globalAttributeConfig:
$ref: '#/components/schemas/GlobalAttributeConfig'
GlobalAttributeConfig:
type: object
properties:
defaultDbTable:
type: string
primaryGlobalAttribute:
$ref: '#/components/schemas/GlobalAttributeValue'
initialGlobalAttributes: # initial upsert global attribute -- create the new row if not exists
type: array
items:
$ref: '#/components/schemas/GlobalAttributeValue'
initialGlobalAttributeWriteMode:
$ref: '#/components/schemas/AttributeWriteConflictMode'
AttributeWriteConflictMode:
type: string
enum:
- ReturnErrorOnConflict # default behavior for initial global attributes
- IgnoreConflict
- OverrideOnConflict
GlobalAttributeValue:
type: object
description: the value of a global attribute (from SDK to server or from server to SDK)
required:
- dbColumn
- dbQueryValue
properties:
dbColumn:
type: string
description: the column name that can be used in the database query, see below for example
dbQueryValue:
type: string
description: the plain string value that can be used in the database query(e.g. for SQL SELECT ... WHERE $Column=$dbQueryValue or UPDATE/INSERT)
alternativeTable:
type: string
description: if not empty, the global attribute is mapped to a different table name than the default table. Must be used with alternativeTableForeignKeyColumn
alternativeTableForeignKeyColumn:
type: string
description: Must present when alternativeTable is not empty. It means the foreign key column to join with the primary key of the default table
# dbHint:
# type: string
# description: some additional info for how to use the dbColumn and dbQueryValue
GlobalAttributeKey:
type: object
description: the definition(key) for getting value of a global attribute
required:
- dbColumn
properties:
dbColumn:
type: string
description: the column name that can be used in the database query, see below for example
alternativeTable:
type: string
description: if not empty, the global attribute is mapped to a different table name than the default table. Must be used with alternativeTableForeignKeyColumn
alternativeTableForeignKeyColumn:
type: string
description: Must present when alternativeTable is not empty. It means the foreign key column to join with the primary key of the default table
# dbHint:
# type: string
# description: some additional info for how to use the dbColumn and dbQueryValue
LoadGlobalAttributesRequest:
type: object
description: the request to load global attributes
properties:
attributes:
type: array
items:
$ref: '#/components/schemas/GlobalAttributeKey'
defaultReadLockingType:
$ref: '#/components/schemas/AttributeReadLockingType'
tableReadLockingPolicyOverrides:
type: array
description: set a different read policy per table to override the default locking type
items:
$ref: '#/components/schemas/TableReadLockingPolicy'
LoadGlobalAttributeResponse:
type: object
description: the response for loading global attributes
properties:
attributes:
type: array
items:
$ref: '#/components/schemas/GlobalAttributeValue'
TableReadLockingPolicy:
type: object
required:
- readLockingType
- tableName
properties:
readLockingType:
$ref: '#/components/schemas/AttributeReadLockingType'
tableName:
type: string
AttributeReadLockingType:
type: string
enum:
- NO_LOCKING
- SHARE_LOCK
- EXCLUSIVE_LOCK
ProcessIdReusePolicy:
type: string
enum:
Expand All @@ -512,6 +617,8 @@ components:
$ref: '#/components/schemas/RetryPolicy'
stateFailureRecoveryOptions:
$ref: '#/components/schemas/StateFailureRecoveryOptions'
loadGlobalAttributesRequest:
$ref: '#/components/schemas/LoadGlobalAttributesRequest'
StateFailureRecoveryPolicy:
type: string
enum:
Expand Down
16 changes: 16 additions & 0 deletions goapi/xdbapi/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ docs/AsyncStateExecuteRequest.md
docs/AsyncStateExecuteResponse.md
docs/AsyncStateWaitUntilRequest.md
docs/AsyncStateWaitUntilResponse.md
docs/AttributeReadLockingType.md
docs/AttributeWriteConflictMode.md
docs/CommandRequest.md
docs/CommandResults.md
docs/CommandWaitingType.md
docs/Context.md
docs/DefaultAPI.md
docs/EncodedObject.md
docs/GlobalAttributeConfig.md
docs/GlobalAttributeKey.md
docs/GlobalAttributeValue.md
docs/LoadGlobalAttributeResponse.md
docs/LoadGlobalAttributesRequest.md
docs/LocalQueueCommand.md
docs/LocalQueueMessage.md
docs/NotifyImmediateTasksRequest.md
Expand All @@ -38,6 +45,7 @@ docs/StateDecision.md
docs/StateFailureRecoveryOptions.md
docs/StateFailureRecoveryPolicy.md
docs/StateMovement.md
docs/TableReadLockingPolicy.md
docs/ThreadCloseDecision.md
docs/ThreadCloseType.md
docs/TimerCommand.md
Expand All @@ -53,11 +61,18 @@ model_async_state_execute_request.go
model_async_state_execute_response.go
model_async_state_wait_until_request.go
model_async_state_wait_until_response.go
model_attribute_read_locking_type.go
model_attribute_write_conflict_mode.go
model_command_request.go
model_command_results.go
model_command_waiting_type.go
model_context.go
model_encoded_object.go
model_global_attribute_config.go
model_global_attribute_key.go
model_global_attribute_value.go
model_load_global_attribute_response.go
model_load_global_attributes_request.go
model_local_queue_command.go
model_local_queue_message.go
model_notify_immediate_tasks_request.go
Expand All @@ -78,6 +93,7 @@ model_state_decision.go
model_state_failure_recovery_options.go
model_state_failure_recovery_policy.go
model_state_movement.go
model_table_read_locking_policy.go
model_thread_close_decision.go
model_thread_close_type.go
model_timer_command.go
Expand Down
8 changes: 8 additions & 0 deletions goapi/xdbapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,18 @@ Class | Method | HTTP request | Description
- [AsyncStateExecuteResponse](docs/AsyncStateExecuteResponse.md)
- [AsyncStateWaitUntilRequest](docs/AsyncStateWaitUntilRequest.md)
- [AsyncStateWaitUntilResponse](docs/AsyncStateWaitUntilResponse.md)
- [AttributeReadLockingType](docs/AttributeReadLockingType.md)
- [AttributeWriteConflictMode](docs/AttributeWriteConflictMode.md)
- [CommandRequest](docs/CommandRequest.md)
- [CommandResults](docs/CommandResults.md)
- [CommandWaitingType](docs/CommandWaitingType.md)
- [Context](docs/Context.md)
- [EncodedObject](docs/EncodedObject.md)
- [GlobalAttributeConfig](docs/GlobalAttributeConfig.md)
- [GlobalAttributeKey](docs/GlobalAttributeKey.md)
- [GlobalAttributeValue](docs/GlobalAttributeValue.md)
- [LoadGlobalAttributeResponse](docs/LoadGlobalAttributeResponse.md)
- [LoadGlobalAttributesRequest](docs/LoadGlobalAttributesRequest.md)
- [LocalQueueCommand](docs/LocalQueueCommand.md)
- [LocalQueueMessage](docs/LocalQueueMessage.md)
- [NotifyImmediateTasksRequest](docs/NotifyImmediateTasksRequest.md)
Expand All @@ -120,6 +127,7 @@ Class | Method | HTTP request | Description
- [StateFailureRecoveryOptions](docs/StateFailureRecoveryOptions.md)
- [StateFailureRecoveryPolicy](docs/StateFailureRecoveryPolicy.md)
- [StateMovement](docs/StateMovement.md)
- [TableReadLockingPolicy](docs/TableReadLockingPolicy.md)
- [ThreadCloseDecision](docs/ThreadCloseDecision.md)
- [ThreadCloseType](docs/ThreadCloseType.md)
- [TimerCommand](docs/TimerCommand.md)
Expand Down
Loading