JustBash.FS.POSIX protocol (JustBash v0.4.0)

View Source

POSIX filesystem extensions that are not part of VFS.Mountable.

The vfs protocol deliberately keeps its surface to ten universal operations; symlinks, hard links, permission bits, and append are POSIX-specific concepts that most virtual backends (git trees, S3 objects, DB rows) cannot express. This secondary protocol carries them for the backends that can — today JustBash.FS.Memory — while every other VFS.Mountable gets graceful degradation through the Any fallback:

A %VFS{} mount table implements this protocol by routing to the backend that owns the path, exactly as it routes the core operations.

All returns follow the vfs conventions: state threads back on success, errors are %VFS.Error{} structs.

Summary

Types

t()

All the types that implement this protocol.

Types

path()

@type path() :: String.t()

t()

@type t() :: term()

All the types that implement this protocol.

Functions

append_file(fs, path, content)

@spec append_file(t(), path(), binary()) :: {:ok, t()} | {:error, VFS.Error.t()}

chmod(fs, path, mode)

@spec chmod(t(), path(), non_neg_integer()) :: {:ok, t()} | {:error, VFS.Error.t()}

link(fs, existing_path, new_path)

@spec link(t(), path(), path()) :: {:ok, t()} | {:error, VFS.Error.t()}

lstat(fs, path)

@spec lstat(t(), path()) :: {:ok, VFS.Stat.t(), t()} | {:error, VFS.Error.t()}

readlink(fs, path)

@spec readlink(t(), path()) :: {:ok, String.t(), t()} | {:error, VFS.Error.t()}

symlink(fs, target, link_path)

@spec symlink(t(), String.t(), path()) :: {:ok, t()} | {:error, VFS.Error.t()}