diff --git a/docs/client-architecture.md b/docs/client-architecture.md index 90ee6b7e..1afa2ceb 100644 --- a/docs/client-architecture.md +++ b/docs/client-architecture.md @@ -46,6 +46,9 @@ The diagrams below show the high level process flow and decision making when run ### Processing a potentially changed local item ![applyPotentiallyChangedItem](./puml/applyPotentiallyChangedItem.png) +### Download a file +![downloadFile](./puml/downloadFile.png) + ### Determining if an 'item' is syncronised between Microsoft OneDrive and the local file system ![Item Sync Determination](./puml/is_item_in_sync.png) @@ -93,7 +96,7 @@ Due to this factor, when using `--resync` the online source is always going to b ## Client Functional Component Architecture Relationships -The diagram below shows the functional relationship of application code components, and how these relate to each relevant code module within this application: +The diagram below shows the main functional relationship of application code components, and how these relate to each relevant code module within this application: ![Functional Code Components](./puml/code_functional_component_relationships.png) diff --git a/docs/puml/downloadFile.png b/docs/puml/downloadFile.png new file mode 100644 index 00000000..4ab2322e Binary files /dev/null and b/docs/puml/downloadFile.png differ diff --git a/docs/puml/downloadFile.puml b/docs/puml/downloadFile.puml new file mode 100644 index 00000000..e61aab6c --- /dev/null +++ b/docs/puml/downloadFile.puml @@ -0,0 +1,63 @@ +@startuml +start + +partition "Download File" { + + :Get item specifics from JSON; + :Calculate item's path; + + if (Is item malware?) then (yes) + :Log malware detected; + stop + else (no) + :Check for file size in JSON; + if (File size missing) then (yes) + :Log error; + stop + endif + + :Configure hashes for comparison; + if (Hashes missing) then (yes) + :Log error; + stop + endif + + if (Does file exist locally?) then (yes) + :Check DB for item; + if (DB hash match?) then (no) + :Log modification; Perform safe backup; + note left: Local data loss prevention + endif + endif + + :Check local disk space; + if (Insufficient space?) then (yes) + :Log insufficient space; + stop + else (no) + if (Dry run?) then (yes) + :Fake download process; + else (no) + :Attempt to download file; + if (Download exception occurs?) then (yes) + :Handle exceptions; Retry download or log error; + endif + + if (File downloaded successfully?) then (yes) + :Validate download; + if (Validation passes?) then (yes) + :Log success; Update DB; + else (no) + :Log validation failure; Remove file; + endif + else (no) + :Log download failed; + endif + endif + endif + endif + +} + +stop +@enduml diff --git a/docs/puml/main_activity_flows.png b/docs/puml/main_activity_flows.png index 939f47e6..2205109c 100644 Binary files a/docs/puml/main_activity_flows.png and b/docs/puml/main_activity_flows.png differ diff --git a/docs/puml/main_activity_flows.puml b/docs/puml/main_activity_flows.puml index 9399a5ea..d5465d7a 100644 --- a/docs/puml/main_activity_flows.puml +++ b/docs/puml/main_activity_flows.puml @@ -9,7 +9,7 @@ note right: Query Microsoft OneDrive /delta API :Receive JSON responses; :Process JSON Responses; -partition "Process JSON Responses" { +partition "Process /delta JSON Responses" { while (for each JSON response) is (yes) :Determine if JSON is 'root'\nor 'deleted' item; if ('root' or 'deleted') then (yes) @@ -30,7 +30,6 @@ partition "Process JSON Responses" { :Discard JSON; else (no) :Process JSON (create dir/download file); - if (Is the 'JSON' item in the local cache) then (yes) :Process JSON as a potentially changed local item; note left: Run 'applyPotentiallyChangedItem' function @@ -38,25 +37,28 @@ partition "Process JSON Responses" { :Process JSON as potentially new local item; note right: Run 'applyPotentiallyNewLocalItem' function endif - :Process objects in download queue; + :Download File; + note left: Download file from Microsoft OneDrive (Multi Threaded Download) :Save in local database cache; endif endif endwhile } -:Process local cache database\nto check local data integrity and for differences; -if (difference found) then (yes) - :Upload file/folder change including deletion; - note right: Upload to Microsoft OneDrive - :Receive response with item metadata; - :Save response to local cache database; -else (no) -endif +partition "Perform data integrity check based on local cache database" { + :Process local cache database\nto check local data integrity and for differences; + if (difference found) then (yes) + :Upload file/folder change including deletion; + note right: Upload local change to Microsoft OneDrive + :Receive response with item metadata; + :Save response to local cache database; + else (no) + endif +} -:Scan local filesystem\nfor new files/folders; partition "Local Filesystem Scanning" { + :Scan local filesystem\nfor new files/folders; while (for each new item) is (yes) :Check item against 'Client Side Filtering' rules; if (item passes filtering) then (yes) @@ -70,9 +72,10 @@ partition "Local Filesystem Scanning" { endwhile } -:Query /delta link for true-up; -note right: Final Data True-Up -:Process further online JSON changes if required; - +partition "Final True-Up" { + :Query /delta link for true-up; + note right: Final Data True-Up + :Process further online JSON changes if required; +} stop @enduml