Blanket

This is the facade of the Blanket application. Handles starting/stopping the application and defines the client API.

Summary

abandon_table(tab, heir)

Removes the :heir option from the table, stops the heir process

new(module, owner, tab_def, opts \\ [])

Creates a new ETS table and a new heir attached to it

receive_table(timeout \\ 5000)

Awaits for an :'ETS-TRANSFER' message from the heir. The heir must find the calling process by calling module.get_owner_pid(name) with the module and owner values provided in Blanket.new/4

Types

opts :: [{atom, function | boolean} | atom]

Blanket heir options are a proplist.

owner :: atom | any

An owner is a value used to retrieve a process. Typically it’s an atom manipulated with Process.register and Process.whereis. But it can be any value used with a custom pid-store.

Functions

abandon_table(tab, heir)

Specs:

  • abandon_table(:ets.tid, pid) :: :ok

Removes the :heir option from the table, stops the heir process.

new(module, owner, tab_def, opts \\ [])

Specs:

Creates a new ETS table and a new heir attached to it.

opts is either a function for populating the ets table (or any other operation), or a list containing zero or more options from :

  • :transient (true | false) : wether the heir will stop if the table process exits with :normal.
  • :populate : the same function as above.

The table is created in the current process, as is called the populate function.

receive_table(timeout \\ 5000)

Specs:

  • receive_table(timeout) :: {:ok, :ets.tid} | {:error, :transfer_timeout}

Awaits for an :'ETS-TRANSFER' message from the heir. The heir must find the calling process by calling module.get_owner_pid(name) with the module and owner values provided in Blanket.new/4.