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

tagObject Clean-up on Unexpected Failure #83

Closed
doulikecookiedough opened this issue Jul 3, 2024 · 2 comments
Closed

tagObject Clean-up on Unexpected Failure #83

doulikecookiedough opened this issue Jul 3, 2024 · 2 comments

Comments

@doulikecookiedough
Copy link
Contributor

If tagObject fails to tag a pid with a cid, we should try to remove orphaned files and revert any changes. Currently, only specific scenarios of whether reference files exist or not are accounted for.

@doulikecookiedough
Copy link
Contributor Author

doulikecookiedough commented Jul 8, 2024

To make this process transparent, we will refactor tagObject by having it only synchronize the tagging process. When it is safe to proceed with tagging, we will call a new protected method: storeHashStoreRefs. This method will absorb the main functionality of tagObject.

Should any exception be raised, tagObject will have a new protected method to call: unTagObject. This will revert the process (remove the pid & then attempt to delete the cid refs file, and then delete the pid refs file).

So tagObject itself will handle any clean-up work related to refs files for an unexpected exception raised, before re-raising it to the client.

image
plantUML Syntax
Actor "Client" as DOU
Participant "tagObject" as TO
Participant "storeHashStoreRefs" as TOS
Participant "untagObject" as UO

DOU -> TO: tagObject(pid, cid)
activate TO
TO -> TO: Start synchronization code
TO -> TOS: storeHashStoreRefs(pid, cid)
deactivate TO

Alt There are no issues
activate TOS
note over TOS: \nNormal Process\n
TOS --[#green]> TO: return
deactivate TOS
activate TO
TO -> TO: Exit synchronization code
TO --[#green]> DOU: return
deactivate TO
Else Something happens which we have no control over
activate TOS
note over TOS: \nUnexpected Exception\n
TOS --[#red]> TO: Raise Exception
deactivate TOS
activate TO
TO -> UO: untagObject(pid, cid)
deactivate TO
activate UO
UO -> UO: Revert the tagging process
UO --> TO: return
deactivate UO
activate TO
TO -> TO: Exit synchronization code
TO --[#red]> DOU: Raise Exception
deactivate TO

End


' change the default styles   
skinparam shadowing false   
skinparam roundcorner 5
skinparam padding 2
skinparam linetype ortho
skinparam bbackgroundColor #000000
skinparam stereotypeCBackgroundColor #C3D3E3


' style sequences
skinparam sequence {
	ArrowColor #1F4260
	LifeLineBorderColor #1F4260
	LifeLineBackgroundColor #428BCA
	ParticipantBorderColor #AAAAAA
	ParticipantBackgroundColor #F5F5F5
  ActorBackgroundColor #DDDDDD
  ActorBorderColor #333333
}

' style notes
skinparam noteFontColor #C49858
skinparam note {
  BackgroundColor #FCF8E4
  BorderColor #FCEED6   
}

@doulikecookiedough
Copy link
Contributor Author

This has been completed via Feature-83: tagObject Refactor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant