ex_shards v0.2.1 ExShards

Shards API – This is the equivalent module to shards.

To build match specs for select functions, you can use Ex2ms library – it is included in ExShards.

Examples

# this is required to build match specs for select operations
iex> require Ex2ms

# create a table with default options
iex> ExShards.new :mytab
:mytab

iex> ExShards.insert :mytab, [k1: 1, k2: 2, k3: 3]
true

iex> for k <- [:k1, :k2, :k3] do
[{_, v}] = ExShards.lookup(:mytab, k)
v
end
[1, 2, 3]

iex> ms = Ex2ms.fun do {_, v} -> v end
[{{:_, :"$1"}, [], [:"$1"]}]
iex> ExShards.select :mytab, ms
[1, 2, 3]

iex> ExShards.delete :mytab, :k3
true
iex> ExShards.lookup :mytab, :k3
[]

# let's create another table
iex> ExShards.new :mytab2, [{:n_shards, 4}]
:mytab2

# start the observer so you can see how shards behaves
iex> :observer.start
:ok

Link to this section Summary

Functions

i()

Link to this section Types

Link to this type key()
key() :: term
Link to this type tab()
tab() :: atom
Link to this type value()
value() :: term

Link to this section Functions

Link to this function delete(Elixir.arg1)
Link to this function delete(Elixir.arg1, Elixir.arg2)
Link to this function delete_all_objects(Elixir.arg1)
Link to this function delete_object(Elixir.arg1, Elixir.arg2)
Link to this function drop(tab, keys)
drop(tab, Enumerable.t) :: tab
Link to this function fetch(tab, key)
fetch(tab, key) :: {:ok, value} | :error
Link to this function fetch!(tab, key)
fetch!(tab, key) :: value | no_return
Link to this function file2tab(Elixir.arg1)
Link to this function file2tab(Elixir.arg1, Elixir.arg2)
Link to this function first(Elixir.arg1)
Link to this function foldl(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function foldr(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function get(tab, key, default \\ nil)
get(tab, key, value) :: value | [value]
Link to this function get_and_update(tab, key, fun)
get_and_update(tab, key, (value -> {get, update} | :pop)) :: {get, update} when get: term, update: term
Link to this function get_and_update!(tab, key, fun)
get_and_update!(tab, key, (value -> {get, update} | :pop)) ::
  {get, update} |
  no_return when get: term, update: term
Link to this function get_nodes(Elixir.arg1)
Link to this function give_away(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function has_key?(tab, key)
has_key?(tab, key) :: boolean
Link to this function info(Elixir.arg1)
Link to this function info(Elixir.arg1, Elixir.arg2)
Link to this function info_shard(Elixir.arg1)
Link to this function info_shard(Elixir.arg1, Elixir.arg2)
Link to this function insert(Elixir.arg1, Elixir.arg2)
Link to this function insert_new(Elixir.arg1, Elixir.arg2)
Link to this function is_compiled_ms(Elixir.arg1)
Link to this function join(Elixir.arg1, Elixir.arg2)
Link to this function keys(tab)
keys(tab) :: [key]
Link to this function last(Elixir.arg1)
Link to this function leave(Elixir.arg1, Elixir.arg2)
Link to this function list(Elixir.arg1)
Link to this function lookup(Elixir.arg1, Elixir.arg2)
Link to this function lookup_element(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function match(Elixir.arg1)
Link to this function match(Elixir.arg1, Elixir.arg2)
Link to this function match(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function match_delete(Elixir.arg1, Elixir.arg2)
Link to this function match_object(Elixir.arg1)
Link to this function match_object(Elixir.arg1, Elixir.arg2)
Link to this function match_object(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function match_spec_compile(Elixir.arg1)
Link to this function match_spec_run(Elixir.arg1, Elixir.arg2)
Link to this function member(Elixir.arg1, Elixir.arg2)
Link to this function next(Elixir.arg1, Elixir.arg2)
Link to this function pop(tab, key, default \\ nil)
pop(tab, key, value) :: value | [value]
Link to this function prev(Elixir.arg1, Elixir.arg2)
Link to this function put(tab, key, value)
put(tab, key, value) :: tab
Link to this function put_new(tab, key, value)
put_new(tab, key, value) :: tab
Link to this function remove(tab, key)
remove(tab, key) :: tab
Link to this function rename(Elixir.arg1, Elixir.arg2)
Link to this function safe_fixtable(Elixir.arg1, Elixir.arg2)
Link to this function select(Elixir.arg1)
Link to this function select(Elixir.arg1, Elixir.arg2)
Link to this function select(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function select_count(Elixir.arg1, Elixir.arg2)
Link to this function select_delete(Elixir.arg1, Elixir.arg2)
Link to this function select_reverse(Elixir.arg1)
Link to this function select_reverse(Elixir.arg1, Elixir.arg2)
Link to this function select_reverse(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function set(tab, obj_or_objs)
set(tab, tuple | [tuple]) :: tab
Link to this function setopts(Elixir.arg1, Elixir.arg2)
Link to this function state(Elixir.arg1)
Link to this function tab2file(Elixir.arg1, Elixir.arg2)
Link to this function tab2file(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function tab2list(Elixir.arg1)
Link to this function tabfile_info(Elixir.arg1)
Link to this function table(Elixir.arg1)
Link to this function table(Elixir.arg1, Elixir.arg2)
Link to this function take(Elixir.arg1, Elixir.arg2)
Link to this function take_and_drop(tab, keys)
take_and_drop(tab, Enumerable.t) :: map
Link to this function test_ms(Elixir.arg1, Elixir.arg2)
Link to this function update(tab, key, initial, fun)
update(tab, key, value, (value -> value)) :: tab
Link to this function update!(tab, key, fun)
update!(tab, key, (value -> value)) :: tab | no_return
Link to this function update_counter(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function update_counter(Elixir.arg1, Elixir.arg2, Elixir.arg3, Elixir.arg4)
Link to this function update_elem(tab, key, element_spec)
update_elem(tab, key, term) :: tab
Link to this function update_element(Elixir.arg1, Elixir.arg2, Elixir.arg3)
Link to this function values(tab)
values(tab) :: [value]