Jido.VFS.Adapter.ETS (Jido.VFS v1.0.0)

View Source

Jido.VFS adapter using ETS (Erlang Term Storage) for in-memory storage.

Direct usage

iex> filesystem = Jido.VFS.Adapter.ETS.configure(name: ETSFileSystem)
iex> start_supervised(filesystem)
iex> :ok = Jido.VFS.write(filesystem, "test.txt", "Hello World")
iex> {:ok, "Hello World"} = Jido.VFS.read(filesystem, "test.txt")

Direct usage with eternal tables

iex> filesystem = Jido.VFS.Adapter.ETS.configure(name: ETSFileSystem, eternal: true)
iex> start_supervised(filesystem)
iex> :ok = Jido.VFS.write(filesystem, "test.txt", "Hello World")
iex> {:ok, "Hello World"} = Jido.VFS.read(filesystem, "test.txt")

Usage with a module

defmodule ETSFileSystem do
  use Jido.VFS.Filesystem,
    adapter: Jido.VFS.Adapter.ETS
end

start_supervised(ETSFileSystem)

ETSFileSystem.write("test.txt", "Hello World")
{:ok, "Hello World"} = ETSFileSystem.read("test.txt")

Configuration Options

  • :name - Required. The name of the ETS table
  • :eternal - Optional. When true, uses the Eternal library to make the ETS table survive process crashes. Defaults to false.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(config)