# `Supertester.ETSIsolation`
[🔗](https://github.com/nshkrdotcom/supertester/blob/v0.6.0/lib/supertester/ets_isolation.ex#L1)

Per-test ETS table management for async-safe isolation.

# `create_opt`

```elixir
@type create_opt() ::
  {:name, atom()}
  | {:copy_from, table_ref()}
  | {:owner, pid()}
  | {:cleanup, boolean()}
```

# `create_opts`

```elixir
@type create_opts() :: [table_option() | create_opt()]
```

# `inject_opt`

```elixir
@type inject_opt() ::
  {:create, boolean()} | {:table_opts, [table_option()]} | {:cleanup, boolean()}
```

# `inject_opts`

```elixir
@type inject_opts() :: [inject_opt()]
```

# `mirror_opt`

```elixir
@type mirror_opt() ::
  {:include_data, boolean()} | {:access, table_access()} | {:cleanup, boolean()}
```

# `mirror_opts`

```elixir
@type mirror_opts() :: [mirror_opt()]
```

# `table_access`

```elixir
@type table_access() :: :public | :protected | :private
```

# `table_name`

```elixir
@type table_name() :: atom()
```

# `table_option`

```elixir
@type table_option() ::
  table_type()
  | table_access()
  | :named_table
  | {:keypos, pos_integer()}
  | {:heir, pid(), term()}
  | {:write_concurrency, boolean()}
  | {:read_concurrency, boolean()}
  | :compressed
```

# `table_ref`

```elixir
@type table_ref() :: :ets.tid() | atom()
```

# `table_type`

```elixir
@type table_type() :: :set | :ordered_set | :bag | :duplicate_bag
```

# `create_isolated`

```elixir
@spec create_isolated(table_type(), create_opts()) :: {:ok, table_ref()}
```

Create an isolated ETS table with automatic cleanup.

# `get_mirror`

```elixir
@spec get_mirror(table_name()) :: {:ok, table_ref()} | {:error, :not_mirrored}
```

Get the mirror table for a source table.

# `get_mirror!`

```elixir
@spec get_mirror!(table_name()) :: table_ref()
```

Get the mirror table or raise if not found.

# `inject_table`

```elixir
@spec inject_table(module(), atom(), table_name() | table_ref(), inject_opts()) ::
  {:ok, (-&gt; :ok)}
```

Temporarily replace a module's table reference.

# `mirror_table`

```elixir
@spec mirror_table(table_name(), mirror_opts()) ::
  {:ok, table_ref()} | {:error, {:table_not_found, table_name()}}
```

Create an isolated copy of an existing named table.

# `setup_ets_isolation`

```elixir
@spec setup_ets_isolation() :: :ok
```

Initialize ETS isolation for the current process.

# `setup_ets_isolation`

```elixir
@spec setup_ets_isolation([table_name()]) :: :ok
@spec setup_ets_isolation(Supertester.IsolationContext.t()) ::
  {:ok, Supertester.IsolationContext.t()}
```

Initialize ETS isolation and optionally auto-mirror tables or update context.

# `setup_ets_isolation`

```elixir
@spec setup_ets_isolation(Supertester.IsolationContext.t(), [table_name()]) ::
  {:ok, Supertester.IsolationContext.t()}
```

Initialize ETS isolation, auto-mirror tables, and update context.

# `with_table`

```elixir
@spec with_table(table_type(), (table_ref() -&gt; term())) :: term()
```

Execute a function with a temporary ETS table that is deleted after scope.

# `with_table`

```elixir
@spec with_table(table_type(), create_opts(), (table_ref() -&gt; term())) :: term()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
