Abstraction layer for instance storage using DETS.
Summary
Functions
Gets all instances.
Gets all instances for a specific specification.
Closes the DETS table.
Deletes an instance by hash.
Deletes instances matching the given filter function.
Checks if an instance exists for the given hash.
Gets an instance by hash.
Initializes the DETS table for storing instances.
Stores an instance with the given hash.
Traverses all instances with the given function.
Deletes all instances from the DETS table.
Types
@type instance_hash() :: non_neg_integer()
Functions
@spec all(:dets.tab_name()) :: {:ok, list()} | {:error, Spex.Errors.DetsError.t()}
Gets all instances.
@spec all(:dets.tab_name(), module()) :: {:ok, list()} | {:error, Spex.Errors.DetsError.t()}
Gets all instances for a specific specification.
@spec close(:dets.tab_name()) :: :ok | {:error, Spex.Errors.DetsError.t()}
Closes the DETS table.
@spec delete(:dets.tab_name(), Spex.InstanceManager.Instance.instance_identifier()) :: :ok | {:error, Spex.Errors.DetsError.t()}
Deletes an instance by hash.
@spec delete_matching(:dets.tab_name(), (Spex.InstanceManager.Instance.t() -> as_boolean(term()))) :: :ok | {:error, Spex.Errors.DetsError.t()}
Deletes instances matching the given filter function.
@spec exists?(:dets.tab_name(), Spex.InstanceManager.Instance.instance_identifier()) :: {:ok, boolean()} | {:error, Spex.Errors.DetsError.t()}
Checks if an instance exists for the given hash.
@spec get(:dets.tab_name(), Spex.InstanceManager.Instance.instance_identifier()) :: {:ok, Spex.InstanceManager.Instance.t()} | {:error, Spex.Errors.InstanceError.t()} | {:error, Spex.Errors.DetsError.t()}
Gets an instance by hash.
@spec init(:dets.tab_name(), Path.t()) :: :ok | {:error, Spex.Errors.DetsError.t() | Spex.Errors.FileError.t()}
Initializes the DETS table for storing instances.
@spec put(:dets.tab_name(), Spex.InstanceManager.Instance.t()) :: :ok | {:error, Spex.Errors.DetsError.t()}
Stores an instance with the given hash.
@spec traverse(:dets.tab_name(), (Spex.InstanceManager.Instance.t() -> term())) :: :ok | {:error, Spex.Errors.DetsError.t()}
Traverses all instances with the given function.
@spec truncate(:dets.tab_name()) :: :ok | {:error, Spex.Errors.DetsError.t()}
Deletes all instances from the DETS table.