An algorithm over TCP (reliable, ordered, error-checked delivery):
- A sends the data to B
- B saves the data
- B sends OK to A
- A deletes the data permanently
- B just keep the data (doesn't delete it).
Exceptions:
- If some of the steps fails, do not execute the next.
- If B doesn't receive OK from A, B doesn't save data permanently.
- If A doesn't receive OK from B, A doesn't delete data permanently.
Detailing by node:
A
- Sends data to B
- Waits for OK
- Receives OK
- Delete data
B
- Receives data
- Saves data
- Sends OK
- Receives OK