MingaEditor.Commands.FileTree.DuplicateBackend behaviour (Minga v0.1.0)

Copy Markdown View Source

Injectable boundary for the Duplicate command's owned filesystem effects.

The command claims a destination before copying so cleanup can remove only output owned by that operation. The backend keeps filesystem failures deterministic in tests.

Summary

Types

cleanup_result()

@type cleanup_result() :: {:ok, [String.t()]} | {:error, File.posix(), String.t()}

copy_result()

@type copy_result() ::
  :ok
  | {:ok, [String.t()]}
  | {:error, File.posix()}
  | {:error, File.posix(), String.t()}

entry_type()

@type entry_type() :: :directory | :file

t()

@type t() :: module()

Callbacks

claim_destination(t, entry_type)

@callback claim_destination(String.t(), entry_type()) :: :ok | {:error, File.posix()}

cleanup(t)

@callback cleanup(String.t()) :: cleanup_result()

copy(t, t, entry_type)

@callback copy(String.t(), String.t(), entry_type()) :: copy_result()