ContentsFoundations to FrontierBezhig

code/starters/retry_lab.py

All lab code. Download this file.

# STARTER: function bodies intentionally omitted.
"""C13.05: an explicit simulation; not durable distributed storage."""

class Ledger:

    def __init__(self, balance: int):
        raise NotImplementedError('Implement __init__ from the contract in the book')

    def debit(self, key: str, amount: int, lose_reply: bool=False) -> int:
        raise NotImplementedError('Implement debit from the contract in the book')
if __name__ == '__main__':
    ledger = Ledger(10)
    try:
        ledger.debit('request-1', 3, lose_reply=True)
    except TimeoutError:
        pass
    print(ledger.debit('request-1', 3), ledger.balance)