Skip to content

Commit 47e26cb

Browse files
committed
add state transition diagrams
1 parent 21e7829 commit 47e26cb

4 files changed

Lines changed: 26 additions & 28 deletions

File tree

docs/ota_status_transition.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
```mermaid
2+
stateDiagram-v2
3+
[*] --> INITIALIZED : wake up
4+
INITIALIZED --> UPDATING : update API called
5+
INITIALIZED --> ROLLBACKING : rollback API called
6+
INITIALIZED --> CLIENT_UPDATING : client update API called
7+
INITIALIZED --> FAILURE : initialization failure
8+
UPDATING --> FAILURE : error has occurred in update
9+
CLIENT_UPDATING --> FAILURE : error has occurred in client update
10+
ROLLBACKING --> ROLLBACK_FAILURE : error has occurred in rollback
11+
UPDATING --> SUCCESS : success update
12+
ROLLBACKING --> SUCCESS : success rollback

docs/update_phase_transition.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
```mermaid
2+
stateDiagram-v2
3+
[*] --> INITIALIZING : update or client update API called
4+
INITIALIZING --> PROCESSING_METADATA : metadata processing is started
5+
PROCESSING_METADATA --> CALCULATING_DELTA : delta calculation is started
6+
CALCULATING_DELTA --> DOWNLOADING_OTA_FILES : delta resource downloading is started
7+
DOWNLOADING_OTA_FILES --> APPLYING_UPDATE : update applying is started
8+
APPLYING_UPDATE --> PROCESSING_POSTUPDATE : post update processing is started
9+
PROCESSING_POSTUPDATE --> FINALIZING_UPDATE : finalizing update is started
10+
PROCESSING_METADATA --> DOWNLOADING_OTA_CLIENT : client downloading is started

src/otaclient/ota_core.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
UpdateProgressReport,
6060
)
6161
from otaclient._types import (
62-
ClientUpdateRequestV2,
6362
FailureType,
6463
IPCRequest,
6564
IPCResEnum,
@@ -963,14 +962,6 @@ def update(self, request: UpdateRequestV2) -> None:
963962
failure_type=e.failure_type,
964963
)
965964

966-
def client_update(self, request: ClientUpdateRequestV2) -> None:
967-
"""
968-
NOTE that client update API will not raise any exceptions. The failure information
969-
is available via status API.
970-
"""
971-
# TODO: implement core part later
972-
pass
973-
974965
def rollback(self, request: RollbackRequestV2) -> None:
975966
self._live_ota_status = OTAStatus.ROLLBACKING
976967
new_session_id = request.session_id
@@ -1044,24 +1035,6 @@ def main(
10441035
)
10451036
_allow_request_after = _now + HOLD_REQ_HANDLING_ON_ACK_REQUEST
10461037

1047-
elif isinstance(request, ClientUpdateRequestV2):
1048-
1049-
_client_update_thread = threading.Thread(
1050-
target=self.client_update,
1051-
args=[request],
1052-
daemon=True,
1053-
name="ota_client_update_executor",
1054-
)
1055-
_client_update_thread.start()
1056-
1057-
resp_queue.put_nowait(
1058-
IPCResponse(
1059-
res=IPCResEnum.ACCEPT,
1060-
session_id=request.session_id,
1061-
)
1062-
)
1063-
_allow_request_after = _now + HOLD_REQ_HANDLING_ON_ACK_REQUEST
1064-
10651038
elif (
10661039
isinstance(request, RollbackRequestV2)
10671040
and self._live_ota_status == OTAStatus.SUCCESS

src/otaclient_api/v2/api_stub.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@ async def Rollback(
3636
response = await self._stub.rollback(_types.RollbackRequest.convert(request))
3737
return response.export_pb()
3838

39+
"""
40+
TODO: Uncomment when the client_update is implemented in the server.
3941
async def ClientUpdate(
4042
self, request: pb2.UpdateRequest, context
4143
) -> pb2.UpdateResponse:
4244
response = await self._stub.client_update(
4345
_types.ClientUpdateRequest.convert(request)
4446
)
45-
return response.export_pb()
47+
return response.export_pb()"
48+
"""
4649

4750
async def Status(self, request: pb2.StatusRequest, context) -> pb2.StatusResponse:
4851
response = await self._stub.status(_types.StatusRequest.convert(request))

0 commit comments

Comments
 (0)