ets v0.1.2 Ets.Table.New View Source
Provides functionality to create :ets
tables. Type of table is specified by picking the appropriate
function. Specifying an atom as the first parameter will result in a named table, not specifying will
result in an unnamed table. All functions return {:ok, return} | {:error, reason} tuples, and have a bang version (ending in !)
which returns the raw value or raises on :error. Named versions return the name of the table, unnamed versions return a
reference to the table.
Examples
iex> {:ok, ref} = Ets.Table.New.bag()
iex> is_reference(ref)
true
iex> Ets.Table.New.bag(:my_ets_table)
{:ok, :my_ets_table}
Options
All variations take keyword options:
protection: :private, :protected, :public
heir: :none | {heir_pid, heir_data}
keypos: integer
read_concurrency: boolean
write_concurrency: boolean
compressed: boolean
Examples
iex> {:ok, ref} = Ets.Table.New.bag(protection: :private, heir: {self(), :data}, keypos: 5)
iex> is_reference(ref)
true
iex> Ets.Table.New.bag(:my_ets_table, protection: :public, heir: :none, keypos: 2)
{:ok, :my_ets_table}
Link to this section Summary
Functions
Same as bag/1
but raises on :error
Same as bag/2
but raises on :error
Creates a new unnamed :ets
table with the type :bag
and default options
Creates a new unnamed :ets
table with the type :bag
and specified options
Creates a new named :ets
table with the type :bag
and any specified options
Same as duplicate_bag/0
but raises on :error
Same as duplicate_bag/1
but raises on :error
Same as duplicate_bag/2
but raises on :error
Creates a new unnamed :ets
table with the type :duplicate_bag
and default options
Creates a new unnamed :ets
table with the type :duplicate_bag
and specified options
Creates a new named :ets
table with the type :duplicate_bag
and any specified options
Same as ordered_set/0
but raises on :error
Same as ordered_set/1
but raises on :error
Same as ordered_set/2
but raises on :error
Creates a new unnamed :ets
table with the type :ordered_set
and default options
Creates a new unnamed :ets
table with the type :ordered_set
and specified options
Creates a new named :ets
table with the type :ordered_set
and any specified options
Same as set/1
but raises on :error
Same as set/2
but raises on :error
Creates a new unnamed :ets
table with the type :set
and default options
Creates a new unnamed :ets
table with the type :set
and specified options
Creates a new named :ets
table with the type :set
and any specified options
Link to this section Types
new_return() :: {:ok, Ets.ets_table_reference()} | {:error, {:invalid_options, any()} | :unknown_error}
protection_types() :: :public | :protected | :private
table_types() :: :bag | :duplicate_bag | :ordered_set | :set
Link to this section Functions
Same as bag/0
but raises on :error.
Returns reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.bag()
iex> is_reference(ref)
true
Same as bag/1
but raises on :error.
Returns reference of newly created table.
bag!(Ets.table_name(), options()) :: Ets.table_name()
Same as bag/2
but raises on :error.
Returns reference of newly created table.
Creates a new unnamed :ets
table with the type :bag
and default options.
Returns :ok/:error tuple. :ok tuple contains table reference
Creates a new unnamed :ets
table with the type :bag
and specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.bag(protection: :private)
iex> is_reference(ref)
true
bag(Ets.table_name(), options()) :: new_named_return()
Creates a new named :ets
table with the type :bag
and any specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table
Examples
iex> Ets.Table.New.bag(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.bag(:my_ets_table, protection: :private)
{:ok, :my_ets_table}
iex> Ets.Table.New.bag(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.bag(:my_ets_table)
{:error, :table_already_exists}
Same as duplicate_bag/0
but raises on :error.
Returns reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.duplicate_bag()
iex> is_reference(ref)
true
duplicate_bag!(options()) :: Ets.ets_table_reference()
Same as duplicate_bag/1
but raises on :error.
Returns reference of newly created table.
duplicate_bag!(Ets.table_name(), options()) :: Ets.table_name()
Same as duplicate_bag/2
but raises on :error.
Returns reference of newly created table.
Creates a new unnamed :ets
table with the type :duplicate_bag
and default options.
Returns :ok/:error tuple. :ok tuple contains table reference
Creates a new unnamed :ets
table with the type :duplicate_bag
and specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.duplicate_bag(protection: :private)
iex> is_reference(ref)
true
duplicate_bag(Ets.table_name(), options()) :: new_named_return()
Creates a new named :ets
table with the type :duplicate_bag
and any specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table
Examples
iex> Ets.Table.New.duplicate_bag(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.duplicate_bag(:my_ets_table, protection: :private)
{:ok, :my_ets_table}
iex> Ets.Table.New.duplicate_bag(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.duplicate_bag(:my_ets_table)
{:error, :table_already_exists}
Same as ordered_set/0
but raises on :error.
Returns reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.ordered_set()
iex> is_reference(ref)
true
ordered_set!(options()) :: Ets.ets_table_reference()
Same as ordered_set/1
but raises on :error.
Returns reference of newly created table.
ordered_set!(Ets.table_name(), options()) :: Ets.table_name()
Same as ordered_set/2
but raises on :error.
Returns reference of newly created table.
Creates a new unnamed :ets
table with the type :ordered_set
and default options.
Returns :ok/:error tuple. :ok tuple contains table reference
Creates a new unnamed :ets
table with the type :ordered_set
and specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.ordered_set(protection: :private)
iex> is_reference(ref)
true
ordered_set(Ets.table_name(), options()) :: new_named_return()
Creates a new named :ets
table with the type :ordered_set
and any specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table
Examples
iex> Ets.Table.New.ordered_set(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.ordered_set(:my_ets_table, protection: :private)
{:ok, :my_ets_table}
iex> Ets.Table.New.ordered_set(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.ordered_set(:my_ets_table)
{:error, :table_already_exists}
Same as set/0
but raises on :error.
Returns reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.set()
iex> is_reference(ref)
true
Same as set/1
but raises on :error.
Returns reference of newly created table.
set!(Ets.table_name(), options()) :: Ets.table_name()
Same as set/2
but raises on :error.
Returns reference of newly created table.
Creates a new unnamed :ets
table with the type :set
and default options.
Returns :ok/:error tuple. :ok tuple contains table reference
Creates a new unnamed :ets
table with the type :set
and specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table.
Examples
iex> {:ok, ref} = Ets.Table.New.set(protection: :private)
iex> is_reference(ref)
true
set(Ets.table_name(), options()) :: new_named_return()
Creates a new named :ets
table with the type :set
and any specified options.
Returns :ok/:error tuple. :ok tuple contains reference of newly created table
Examples
iex> Ets.Table.New.set(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.set(:my_ets_table, protection: :private)
{:ok, :my_ets_table}
iex> Ets.Table.New.set(:my_ets_table)
{:ok, :my_ets_table}
iex> Ets.Table.New.set(:my_ets_table)
{:error, :table_already_exists}
table_named(Ets.table_name(), table_types(), options()) :: new_named_return()