amnesia v0.2.2 Amnesia.Backup behaviour

This module provides a behavior to implement a backup module and helpers to use backups.

Summary

Functions

Create a checkpoint, see mnesia:activate_checkpoint

Create a checkpoint with the given name, see mnesia:activate_checkpoint

Install a fallback with the default backup module, see mnesia:install_fallback

Install a fallback with the given backup module, see mnesia:install_fallback

Install a fallback with the given backup module and options, see mnesia:install_fallback

Restore a backup, see mnesia:restore

Restore a backup with the given module, see mnesia:restore

Start a backup with the default backup module, see mnesia:backup

Start a backup of a given checkpoint, see mnesia:backup_checkpoint

Traverse a backup, see mnesia:traverse_backup

Traverse a backup with custom backup modules, see mnesia:traverse_backup

Uninstall a fallback, see mnesia:uninstall_fallback

Uninstall a fallback, see mnesia:uninstall_fallback

Uninstall a fallback, see mnesia:uninstall_fallback

Callbacks

Close the backup if the backup is interrupted

Close the backup

Commit the write to the backup

Open the backup for reading

Open the backup for writing

Read terms from the backup

Write the given terms to the backup

Types

i ::
  {:module, atom} |
  {:scope, :global | :local} |
  {:directory, String.t}
o :: {:ok, any} | {:error, any}
r :: [{:module, atom} | {:keep | :skip | :clear | :recreate, atom | [atom]} | {:default, :keep | :skip | :clear | :recreate}]

Functions

checkpoint(options)

Specs

checkpoint(Keyword.t) ::
  {:ok, any, [node]} |
  {:error, any}

Create a checkpoint, see mnesia:activate_checkpoint.

checkpoint(name, options)

Specs

checkpoint(any, Keyword.t) ::
  {:ok, any, [node]} |
  {:error, any}

Create a checkpoint with the given name, see mnesia:activate_checkpoint.

install(data)

Specs

install(any) :: :ok | {:error, any}
install(atom | any) :: :ok | {:error, any}

Install a fallback with the default backup module, see mnesia:install_fallback.

install(module, data)

Install a fallback with the given backup module, see mnesia:install_fallback.

install(module, data, options)

Specs

install(atom, any, i) :: :ok | {:error, any}

Install a fallback with the given backup module and options, see mnesia:install_fallback.

restore(data, options)

Specs

restore(any, r) :: [atom] | {:error, any}

Restore a backup, see mnesia:restore.

restore(module, data, options)

Specs

restore(atom, any, r) ::
  {:atomic, [atom]} |
  {:aborted, any}

Restore a backup with the given module, see mnesia:restore.

start(data)

Specs

start(any) :: :ok | {:error, any}

Start a backup with the default backup module, see mnesia:backup.

start(name, data)

Specs

start(any, any) :: :ok | {:error, any}

Start a backup of a given checkpoint, see mnesia:backup_checkpoint.

traverse(source, target, acc, fun)

Specs

traverse(any, any, any, ([tuple], any -> any)) ::
  {:ok, any} |
  {:error, any}

Traverse a backup, see mnesia:traverse_backup.

traverse(source, source_data, target, target_data, acc, fun)

Specs

traverse(atom, any, atom, any, any, ([tuple], any -> any)) ::
  {:ok, any} |
  {:error, any}

Traverse a backup with custom backup modules, see mnesia:traverse_backup.

uninstall()

Specs

uninstall :: :ok | {:error, any}

Uninstall a fallback, see mnesia:uninstall_fallback.

uninstall(options)

Specs

uninstall(i) :: :ok | {:error, any}

Uninstall a fallback, see mnesia:uninstall_fallback.

uninstall(module, options)

Specs

uninstall(atom, i) :: :ok | {:error, any}

Uninstall a fallback, see mnesia:uninstall_fallback.

Callbacks

abort_write(any)

Specs

abort_write(any) :: o

Close the backup if the backup is interrupted.

close_read(any)

Specs

close_read(any) :: o

Close the backup.

commit_write(any)

Specs

commit_write(any) :: o

Commit the write to the backup.

open_read(any)

Specs

open_read(any) :: o

Open the backup for reading.

open_write(any)

Specs

open_write(any) :: o

Open the backup for writing.

read(any)

Specs

read(any) :: {:ok, any, [any]} | {:error, any}

Read terms from the backup.

write(any, list)

Specs

write(any, [any]) :: o

Write the given terms to the backup.