aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Larisch <james@jameslarisch.com>2016-12-09 23:53:49 -0500
committerJames Larisch <james@jameslarisch.com>2016-12-09 23:53:49 -0500
commit1b7f186b0ce9dd0014e021331f70dc22bb5798ff (patch)
treea9f6a82076fd3705ac1ea194ee776c1f20b15f6b
parent58eb648a4e803c5e015d765ce5914899f1f374b7 (diff)
formatting
-rw-r--r--chapter/7/langs-consistency.md14
1 files changed, 7 insertions, 7 deletions
diff --git a/chapter/7/langs-consistency.md b/chapter/7/langs-consistency.md
index a77110f..b8f013f 100644
--- a/chapter/7/langs-consistency.md
+++ b/chapter/7/langs-consistency.md
@@ -124,13 +124,13 @@ cart.items // the cart's items
```
Here is an (almost) fully functional shopping cart program. You can imagine this code running across multiple nodes scattered over the world. The meat of the program lies in the `run()` method. Let's walk through that:
-1. Program receives an addition to the cart from the user.
-2. Program adds that item to the current local state if it exists.
-3. Program checks its UDP socket for any messages.
-4. If it received one, it's means another instance of this program has sent us its state. What is state in this case? Simply a set of cart items. Let's handle this set of items by unioning it with our current set.
-5. Synchronize our current state by sending our state to every peer that we know about.
-6. Sleep for 10 seconds.
-7. Repeat!
+ 1. Program receives an addition to the cart from the user.
+ 2. Program adds that item to the current local state if it exists.
+ 3. Program checks its UDP socket for any messages.
+ 4. If it received one, it's means another instance of this program has sent us its state. What is state in this case? Simply a set of cart items. Let's handle this set of items by unioning it with our current set.
+ 5. Synchronize our current state by sending our state to every peer that we know about.
+ 6. Sleep for 10 seconds.
+ 7. Repeat!
Hopefully it's clear that if a client adds an item to her cart in Beijing and then 10 seconds later checks her cart in Paris, she should see the same thing. Well, not exactly - remember, the network is unreliable, and Beijing's `synchronize` messages might have been dropped. But no worries! Beijing is `synchronizing` again in another 10 seconds. This should remind you of Dynamo's gossiping: nodes are constantly attempting to converge.