Jido. VFS. Filesystem behaviour
(Jido.VFS v1.0.1)
View Source
Behaviour and delegation helpers for a Jido.VFS filesystem module.
Summary
Callbacks
Checks access for the given relative path.
Appends contents to the given relative path.
Clears the configured filesystem.
Commits changes in version-aware filesystems.
Copies a file from one relative path to another.
Creates a directory at the given relative path.
Deletes the file at the given relative path.
Deletes a directory at the given relative path.
Checks whether the given relative path exists.
Lists the directory entries for the given relative path.
Moves a file from one relative path to another.
Reads the file at the given relative path.
Reads a file as it existed at a specific revision.
Opens a readable stream for the file at the given relative path.
Lists revisions for a relative path in version-aware filesystems.
Rolls a version-aware filesystem back to a revision.
Sets public/private visibility for the given relative path.
Reads file or directory metadata for the given relative path.
Truncates the file at the given relative path.
Updates the modification time for the given relative path.
Reads public/private visibility for the given relative path.
Writes contents to the given relative path.
Opens a writable stream for the given relative path.
Functions
Injects a filesystem wrapper module backed by a configured adapter.
Merges adapter options with application environment overrides when :otp_app is present.
Merges compile-time options with module-specific runtime configuration and extracts the adapter.
Callbacks
Checks access for the given relative path.
@callback append(path :: Path.t(), contents :: iodata(), opts :: keyword()) :: :ok | {:error, term()}
Appends contents to the given relative path.
Clears the configured filesystem.
Commits changes in version-aware filesystems.
@callback copy(source :: Path.t(), destination :: Path.t(), opts :: keyword()) :: :ok | {:error, term()}
Copies a file from one relative path to another.
Creates a directory at the given relative path.
Deletes the file at the given relative path.
Deletes a directory at the given relative path.
@callback file_exists(path :: Path.t(), opts :: keyword()) :: {:ok, :exists | :missing} | {:error, term()}
Checks whether the given relative path exists.
@callback list_contents(path :: Path.t(), opts :: keyword()) :: {:ok, [ %Jido.VFS.Stat.Dir{ mtime: term(), name: term(), size: term(), visibility: term() } | %Jido.VFS.Stat.File{ mtime: term(), name: term(), size: term(), visibility: term() } ]} | {:error, term()}
Lists the directory entries for the given relative path.
@callback move(source :: Path.t(), destination :: Path.t(), opts :: keyword()) :: :ok | {:error, term()}
Moves a file from one relative path to another.
Reads the file at the given relative path.
@callback read_revision(path :: Path.t(), revision :: String.t(), opts :: keyword()) :: {:ok, binary()} | {:error, term()}
Reads a file as it existed at a specific revision.
@callback read_stream(path :: Path.t(), opts :: keyword()) :: {:ok, Enumerable.t()} | {:error, term()}
Opens a readable stream for the file at the given relative path.
@callback revisions(path :: Path.t(), opts :: keyword()) :: {:ok, [Jido.VFS.Revision.t()]} | {:error, term()}
Lists revisions for a relative path in version-aware filesystems.
Rolls a version-aware filesystem back to a revision.
@callback set_visibility(path :: Path.t(), visibility :: Jido.VFS.Visibility.t()) :: :ok | {:error, term()}
Sets public/private visibility for the given relative path.
@callback stat(path :: Path.t()) :: {:ok, %Jido.VFS.Stat.File{ mtime: term(), name: term(), size: term(), visibility: term() } | %Jido.VFS.Stat.Dir{ mtime: term(), name: term(), size: term(), visibility: term() }} | {:error, term()}
Reads file or directory metadata for the given relative path.
@callback truncate(path :: Path.t(), new_size :: non_neg_integer()) :: :ok | {:error, term()}
Truncates the file at the given relative path.
@callback utime(path :: Path.t(), mtime :: DateTime.t()) :: :ok | {:error, term()}
Updates the modification time for the given relative path.
@callback visibility(path :: Path.t()) :: {:ok, Jido.VFS.Visibility.t()} | {:error, term()}
Reads public/private visibility for the given relative path.
@callback write(path :: Path.t(), contents :: iodata(), opts :: keyword()) :: :ok | {:error, term()}
Writes contents to the given relative path.
@callback write_stream(path :: Path.t(), opts :: keyword()) :: {:ok, Collectable.t()} | {:error, term()}
Opens a writable stream for the given relative path.
Functions
Injects a filesystem wrapper module backed by a configured adapter.
Merges adapter options with application environment overrides when :otp_app is present.
Merges compile-time options with module-specific runtime configuration and extracts the adapter.