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

Copy Markdown View Source

Injectable boundary for the New File command's fallible effects.

The command owns operation ordering and editor-state transitions. A backend only performs the requested filesystem or buffer operation so failures remain deterministic in tests.

Summary

Types

t()

@type t() :: module()

Callbacks

mkdir_p(t)

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

open_buffer(t, server, registry)

@callback open_buffer(String.t(), Minga.Config.Options.server(), Minga.Events.registry()) ::
  {:ok, pid()} | {:error, term()}

touch(t)

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