3 ms·
You would write Mutex<HashMap<CustomerID, Account>> Instead of HashMap<CustomerID, Mutex<Account>> Using a singleton is kind of overkill. But in th
by duped 2y ago
You would write
Mutex<HashMap<CustomerID, Account>>
Instead of
HashMap<CustomerID, Mutex<Account>>
Using a singleton is kind of overkill.
But in the real world you'd probably use a transactional database for this (there are a few in memory options) with retries.