diff --git a/lib/stampede/interact.ex b/lib/stampede/interact.ex index 6569fff..3948400 100644 --- a/lib/stampede/interact.ex +++ b/lib/stampede/interact.ex @@ -2,6 +2,7 @@ defmodule Stampede.Interact do require Logger alias Stampede, as: S alias S.Tables.{Ids, Interactions, ChannelLocks} + import S.Tables, only: [transaction!: 1] use TypeCheck use TypeCheck.Defstruct @@ -303,16 +304,6 @@ defmodule Stampede.Interact do end) end - @spec! transaction!((... -> any())) :: any() - def transaction!(f) do - Memento.Transaction.execute!(f, 10) - end - - @spec! transaction_sync!((... -> any())) :: any() - def transaction_sync!(f) do - Memento.Transaction.execute_sync!(f, 10) - end - @spec! id_exists?(S.interaction_id()) :: boolean() def id_exists?(id) do transaction!(fn -> diff --git a/lib/stampede/tables.ex b/lib/stampede/tables.ex index bdb9db8..2dcf36e 100644 --- a/lib/stampede/tables.ex +++ b/lib/stampede/tables.ex @@ -1,4 +1,7 @@ defmodule Stampede.Tables do + @moduledoc """ + Manage various Mnesia tables. + """ require Logger use TypeCheck alias Stampede, as: S @@ -24,6 +27,16 @@ defmodule Stampede.Tables do :ok end + @spec! transaction!((... -> any())) :: any() + def transaction!(f) do + Memento.Transaction.execute!(f, 10) + end + + @spec! transaction_sync!((... -> any())) :: any() + def transaction_sync!(f) do + Memento.Transaction.execute_sync!(f, 10) + end + def clear_all_tables() do Logger.info("Tables: clearing all tables for #{Mix.env()}")