XEts
A partitioned ETS implementation.
This is a wrapper around the shards
library as well as a key-value store
implementation.
See XEts.KV
for the key-value store implementation.
Installation
If available in Hex, the package can be installed
by adding x_ets
to your list of dependencies in mix.exs
:
def deps do
[
{:x_ets, "~> 0.1.0"}
]
end
Usage
XEts
iex> tab = XEts.new(:table_name, [:named_table])
iex> tab |> XEts.insert(x: 1, y: %{}) |> put_in([:y, :z], 1) |>
...> update_in([:y, :z], & &1 + 1) |> XEts.to_list()
[x: 1, y: %{z: 2}]
XEts.KV
iex> tab = XEts.KV.new(:table_name, [])
iex> tab |> XEts.KV.put(:x, 1) |> XEts.KV.put(:y, %{z: 1}) |> XEts.KV.get(:x)
1
iex> tab |> update_in([:y, :z], & &1 + 1) |> get_in([:y, :z])
2
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/x_ets.