Transaction
Extends:
Constructor Summary
Public Constructor | ||
public |
constructor(arg_app_name: string, arg_svc_name: string, arg_tx_name: string, arg_settings: object, arg_executables: Array, arg_type: string): nothing Create a Transaction. |
Member Summary
Public Members | ||
public |
executables: array Executables array. |
|
public |
Class test flag. |
|
public |
Duration metric instance. |
|
public |
Metrics array. |
|
public |
results: array Results array. |
|
public |
Transaction status. |
|
public |
Transaction type. |
Method Summary
Public Methods | ||
public |
commit(): nothing Commit transaction execution on executables success. |
|
public |
Execute all executables regarding the transaction type. |
|
public |
execute_every(arg_data: anything): Promise Execute every executables without order and fails if one failure appears. |
|
public |
execute_one(arg_data: anything): Promise Execute every executables without order and fulfill on first resolved, fails if one failure appears. |
|
public |
execute_sequence(arg_data: anything): Promise Execute every executables in a fixed order and stop on failure. |
|
public |
finish(): nothing Finish all executables. |
|
public |
Get instance description: {$type:..., $class:..., $id:..., $name:...}. |
|
public |
Get result of the first ended executable which failed. |
|
public |
Get result of the first ended executable. |
|
public |
Get transaction metrics: {id:..., status:..., metrics:...}. |
|
public |
get_results(): Array Get executables results array: {index:..., result:..., has_error:..., error_msg:...}. |
|
public |
Prepare transaction executables. |
|
public |
rollback(): nothing Rollback transaction execution on executables failure. |
|
public |
set_executables(arg_executables: Array): nothing Set transaction executables. |
|
public |
Set the transaction type. |
Public Constructors
Public Members
Public Methods
public commit(): nothing source
Commit transaction execution on executables success. Change status to EXEC_OK.
Return:
nothing |
public execute(arg_data: anything): Promise source
Execute all executables regarding the transaction type.
Params:
Name | Type | Attribute | Description |
arg_data | anything | any parameter |
public execute_every(arg_data: anything): Promise source
Execute every executables without order and fails if one failure appears.
Params:
Name | Type | Attribute | Description |
arg_data | anything | any parameter |
public execute_one(arg_data: anything): Promise source
Execute every executables without order and fulfill on first resolved, fails if one failure appears.
Params:
Name | Type | Attribute | Description |
arg_data | anything | any parameter |
public execute_sequence(arg_data: anything): Promise source
Execute every executables in a fixed order and stop on failure.
Params:
Name | Type | Attribute | Description |
arg_data | anything | any parameter |
public get_descriptor(): object source
Get instance description: {$type:..., $class:..., $id:..., $name:...}.
public get_results(): Array source
Get executables results array: {index:..., result:..., has_error:..., error_msg:...}.
public prepare(arg_context: object): nothing source
Prepare transaction executables. Change status to PREPARED.
Params:
Name | Type | Attribute | Description |
arg_context | object | executables context. |
Return:
nothing |
public rollback(): nothing source
Rollback transaction execution on executables failure. Change status to EXEC_KO.
Return:
nothing |
public set_executables(arg_executables: Array): nothing source
Set transaction executables.
Params:
Name | Type | Attribute | Description |
arg_executables | Array | executables instances array. |
Return:
nothing |
public set_type(arg_type: string): nothing source
Set the transaction type. Value should be choosen from the list:EVERY,SEQUENCE,ONE
- EVERY: transaction is finished when all executables are finished without order.
- SEQUENCE: transaction is finished when all executables are finished in a ordered sequence.
- ONE: transaction is finished when an executable finished without waiting other executables.
Params:
Name | Type | Attribute | Description |
arg_type | string | transaction type value. |
Return:
nothing |