Search documentation of ash

# View Source Ash.Type.File.Implementation behaviour (ash v3.4.30)

Behaviour for file implementations that are compatible with `Ash.Type.File`.

# Summary

## Types

error()

Errors returned by the implementation.

source()

The source of the file the implementation operates on.

t()

Any `module()` implementing the `Ash.Type.File.Implementation` behaviour.

## Callbacks

open(file, modes)

Open `IO.device()` for the file.

path(file)

Return path of the file on disk.

# Types

Link to this type

# error()

View Source

    @type error() :: term()

Errors returned by the implementation.

Link to this type

# source()

View Source

    @type source() :: term()

The source of the file the implementation operates on.

Link to this type

# t()

View Source

    @type t() :: module()

Any `module()` implementing the `Ash.Type.File.Implementation` behaviour.

# Callbacks

Link to this callback

# open(file, modes)

View Source

    @callback open(file :: source(), modes :: [File.mode()]) ::
      {:ok, IO.device()} | {:error, error()}

Open `IO.device()` for the file.

See `Ash.Type.File.open/2`

The return pid must point to a process following the Erlang I/O Protocol like `StringIO` or `File`.

Link to this callback

# path(file)

View Source (optional)

    @callback path(file :: source()) :: {:ok, Path.t()} | {:error, error()}

Return path of the file on disk.

See: `Ash.Type.File.path/1`

This callback is optional. If the file is not stored on disk, this callback can be omitted.