@@ -44,7 +44,7 @@ In your `mix.exs`:
4444
4545``` elixir
4646def deps do
47- [{:shards , " ~> 0.4.0 " }]
47+ [{:shards , " ~> 0.4" }]
4848end
4949```
5050
@@ -231,23 +231,23 @@ If any microsecond matters to you, you can skip the call to the control ETS tabl
231231 ` shards:new/2 ` by first time, or you can call ` shards:state/1 ` , ` shards_state:get/1 ` or
232232 ` shards_state:new/0,1,2,3,4 ` at any time you want, and then it might be stored within
233233 the calling process, or wherever you want. E.g.:
234-
234+
235235 ``` erlang
236236 % take a look at the 2nd element of the returned tuple, that is the state
237237 > shards :new (mytab , [{n_shards , 4 }]).
238238 mytab
239-
239+
240240 % remember you can get the state at any time you want
241241 > State = shards :state (mytab ).
242242 {state ,shards_local ,4 ,#Fun < shards_local .pick .3 > ,
243243 #Fun < shards_local .pick .3 > }
244-
244+
245245 % now you can call shards_local directly
246246 > shards_local :insert (mytab , {1 , 1 }, State ).
247247 true
248248 > shards_local :lookup (mytab , 1 , State ).
249249 [{1 ,1 }]
250-
250+
251251 % in this case, only the n_shards is different from default, so you
252252 % can do this:
253253 > shards_local :lookup (mytab , 1 , shards_state :new (4 )).
@@ -260,12 +260,12 @@ If any microsecond matters to you, you can skip the call to the control ETS tabl
260260 better , since in this case no additional calls are needed , not even to recover the `state `
261261 (like in the previous option ), because a new `state ` is created with default values .
262262 Therefore , the call is mapped directly to an ** ETS ** function . E .g .:
263-
263+
264264 ```erlang
265265 % create a table without set n_shards, pick_shard_fun or pick_node_fun
266266 > shards :new (mytab , []).
267267 mytab
268-
268+
269269 % call shards_local without the state
270270 > shards_local :insert (mytab , {1 , 1 }).
271271 true
@@ -308,42 +308,42 @@ $ rebar3 shell --sname c@localhost
308308There are two ways to achieve this :
309309
310310 1 . Manually , create the table on each node and then from any of them , join the rest .
311-
311+
312312 Create the table on each node :
313-
313+
314314 ```erlang
315315 % when a tables is created with {scope, g}, the module shards_dist is used
316316 % internally by shards
317317 > shards :new (mytab , [{scope , g }]).
318318 mytab
319319 ```
320-
320+
321321 Join them . From node `a `, join `b ` and `c ` nodes :
322-
322+
323323 ```erlang
324324 > shards :join (mytab , ['b@localhost' , 'c@localhost' ]).
325325 [a@localhost ,b@localhost ,c@localhost ]
326326 ```
327-
327+
328328 Let 's check that all nodes have the same nodes running next function on each node:
329-
329+
330330 ```erlang
331331 > shards:get_nodes(mytab).
332332 [a@localhost,b@localhost,c@localhost]
333333 ```
334-
334+
335335 2. The easier way, call `shards:new/3` but passing the option `{nodes, Nodes}`,
336336 where `Nodes` is the list of nodes you want to join.
337-
337+
338338 From Node `a`:
339-
339+
340340 ```erlang
341341 > shards:new(mytab, [{scope, g}, {nodes, [' b@localhost ', ' c@localhost ']}]).
342342 mytab
343343 ```
344-
344+
345345 Let' s check again on all nodes :
346-
346+
347347 ```erlang
348348 > shards :get_nodes (mytab ).
349349 [a@localhost ,b@localhost ,c@localhost ]
@@ -406,7 +406,7 @@ And again, let's check it out from any node:
406406
407407## Examples and/or Projects using Shards
408408
409- * [ExShards](https://github.com/cabol/exshards ) is an **Elixir** wrapper for `shards`.
409+ * [ExShards](https://github.com/cabol/ex_shards ) is an **Elixir** wrapper for `shards` – with extra and nicer functions .
410410
411411* [KVX](https://github.com/cabol/kvx) – Simple/basic **Elixir** in-memory Key/Value Store using `shards` (default adapter).
412412
0 commit comments