Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Wallet service example

Sumit Rawal answered on May 21, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


Wallet service example

0

Let us assume the state (the account balance) is stored in a relational database. The state machine examines each command one by one in FIFO order. For each command, it checks whether the account has a sufficient balance. If yes, the state machine generates an event for each account. For example, if the command is “A->


1−C”,thestatemachinegeneratestwoevents:“A:−1” and “C:+$1”.

Figure 17 shows how the state machine works in 5 steps.

Read commands from the command queue.

Read balance state from the database.

Validate the command. If it is valid, generate two events for each of the accounts.

Read the next Event.

Apply the Event by updating the balance in the database. 

https://bytebytego.com/courses/system-design-interview/digital-wallet

Popularity 1/10 Helpfulness 1/10 Language whatever
Source: Grepper
Link to this answer
Share Copy Link
Contributed on May 21 2023
Sumit Rawal
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.