Skip to content

Instantly share code, notes, and snippets.

@autrilla
Last active January 16, 2016 10:23
Show Gist options
  • Select an option

  • Save autrilla/312d16926e9bd892359b to your computer and use it in GitHub Desktop.

Select an option

Save autrilla/312d16926e9bd892359b to your computer and use it in GitHub Desktop.
X marks intersection points
Cliens want to write to a shared file
All acceptors and learners start with no one ('null') having access
ClientA ClientB Proposer Acceptor1 Acceptor2 Acceptor3 LearnerX LearnerY
| | | | | | | |
X------------------>| | | | | | Request(ClientA)
| | X--------->|----------->|---------->| | | Prepare(transaction_id=1)
| | |<---------X------------X-----------X | | Promise(transaction_id=1, {null, null, null}) // Acceptors answer with their current value, i.e. who currently has write access
| | X--------->|----------->|---------->| | | Accept(transaction_id=1, ClientA) // The proposer decides to let ClientA access the file
| | |<---------X------------X-----------X---------->|-------->| Accepted(transaction_id=1, ClientA)
|<------------------------------------------------------------------X---------X Reponse(accepted) // Convey the information to ClientA
| | | | | | | |
| X-------->| | | | | | Request(ClientB)
| | X--------->|----------->|---------->| | | Prepare(transaction_id=2)
| | |<---------X------------X-----------X | | Promise(transaction_id=2, {ClientA, ClientA, ClientA})
| | X--------->|----------->|---------->| | | Accept(transaction_id=2, ClientA) // The proposer decides ClientA still has access to the file
| | |<---------X------------X-----------X---------->|-------->| Accepted(transaction_id=2, ClientA)
| |<--------------------------------------------------------X---------X Reponse(denied) // Convey the information to ClientA
| | | | | | | |
X------------------>| | | | | | Request(null) // ClientA doesn't want the file anymore
| | X--------->|----------->|---------->| | | Prepare(transaction_id=3)
| | |<---------X------------X-----------X | | Promise(transaction_id=3, {ClientA, ClientA, ClientA})
| | X--------->|----------->|---------->| | | Accept(transaction_id=3, null)
| | |<---------X------------X-----------X---------->|-------->| Accepted(transaction_id=3, null)
|<------------------------------------------------------------------X---------X Reponse(accept) // Convey the information to ClientA
| | | | | | | |
| X-------->| | | | | | Request(ClientB)
| | X--------->|----------->|---------->| | | Prepare(transaction_id=4)
| | |<---------X------------X-----------X | | Promise(transaction_id=4, {null, null, null})
| | X--------->|----------->|---------->| | | Accept(transaction_id=4, ClientB) // The proposer decides ClientB can now access the file
| | |<---------X------------X-----------X---------->|-------->| Accepted(transaction_id=4, ClientB)
| |<--------------------------------------------------------X---------X Reponse(accept) // Convey the information to ClientA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment