Skip to content

Instantly share code, notes, and snippets.

@chrismeyersfsu
Last active June 3, 2021 12:55
Show Gist options
  • Save chrismeyersfsu/d699265f7fbd323b45ed0d3e64f530cd to your computer and use it in GitHub Desktop.
Save chrismeyersfsu/d699265f7fbd323b45ed0d3e64f530cd to your computer and use it in GitHub Desktop.
receptor work distributed protocol

Receptor Remote Work Protocol

The diagrams do not capture the current state of the code in Receptor. They are to start a conversation that moves towards desired behavior of Receptor.

Happy Path

Receptor work protocol for work submitted to Bob destined for Alice.

uncached image

Crash Scenarios

  1. The first work unit 123 never makes it to Alice. Upon restart, Bob will resubmit work unit 123 request to Alice.

uncached image

  1. Bob submits work that is already known to Alice. In this case, Alice ignores the work and replies to Bob informing him of this case. Bob then records this for efficiency sake. If Bob were to crash any time after RemoteStarted 123, he would know that work has already been submitted to Alice. Note that even if Bob lost his recording of RemoteStarted 123; it would be fine for him to re-submit work unit 123. The RemoteStarted is a nicety.

uncached image

Note that the above 2 crash scenarios are really the same scenario; a crash of Bob or Alice occuring before RemoteStarted 123 will result in re-submitting work unit 123 to Alice. This is idempotent behavior.

@startuml happy
Bob->Alice : work unit 123
create "work unit 123"
Alice -> "work unit 123" : work unit 123
Bob->Alice : payload
Alice->"work unit 123" : payload
Bob->Bob: RemoteStarted 123
@enduml
@startuml crash1
Bob ->x Alice : work unit 123
Bob -> Bob : CRASH, RESTART
Bob -> Alice : work unit 123
create "work unit 123"
Alice -> "work unit 123" : work unit 123
Bob->Alice : payload
Alice->"work unit 123" : payload
Bob->Bob: RemoteStarted 123
@enduml
@startuml crash2
Bob->Alice : work unit 123
create "work unit 123"
Alice -> "work unit 123" : work unit 123
Bob->Alice : payload
Alice->"work unit 123" : payload
Bob->Bob: CRASH, RESTART
Bob->Alice: work unit 123
Alice->Bob: work already submited
Bob->Bob: RemoteStarted 123
@enduml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment