nofs

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package nofs implements tool.Workspace for a session that has NO filesystem at all (the "no-fs" session profile). It is the HONEST empty workspace, not an in-memory one: memfs would accept writes into a tree nobody can ever read back outside the process — silently losing data the model believes it saved — whereas nofs tells the truth on every operation: nothing exists (reads fail with fs.ErrNotExist, searches return empty) and nothing can be created (writes fail loudly with ErrNoFilesystem). Nothing exists that can be lost.

It is a reference adapter in the importable engine tree (stdlib + engine/tool only — see the engine-adapter-nofs depguard rule), constructed by the server adapter as the per-session workspace OVERRIDE for a no-FS session so the osfs workspace factory is never consulted for it.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFilesystem = errors.New("no filesystem in this session: the no-fs session profile has no workspace to create or replace files in")

ErrNoFilesystem is returned by CreateFile/ReplaceFile: a no-FS session has no filesystem to create or replace files in. The message is model-readable (a tool surfaces it verbatim). The legacy unconditional Write method is removed; the agent-facing tools use the version-bearing CreateFile/ReplaceFile.

Functions

This section is empty.

Types

type Workspace

type Workspace struct{}

Workspace is the no-filesystem tool.Workspace. The zero value is ready to use; it is stateless and safe for concurrent use.

func New

func New() Workspace

New returns the no-filesystem Workspace.

func (Workspace) CreateFile

CreateFile fails loudly with ErrNoFilesystem: nothing can be created in a no-FS session.

func (Workspace) Glob

Glob returns no matches: there is nothing to match against.

func (Workspace) Grep

Grep returns no matches: there is nothing to search.

func (Workspace) Read

func (Workspace) Read(_ context.Context, path string) ([]byte, error)

Read reports that the file does not exist: there is no filesystem, so no path ever resolves. The error wraps fs.ErrNotExist so callers' errors.Is checks behave exactly as on an absent file.

func (Workspace) ReadVersion

func (Workspace) ReadVersion(_ context.Context, path string) ([]byte, tool.FileVersion, error)

ReadVersion reports the same as Read: no file exists, so there is no content and no version. The error wraps fs.ErrNotExist.

func (Workspace) ReplaceFile

ReplaceFile fails loudly with ErrNoFilesystem: nothing can be replaced in a no-FS session.

func (Workspace) Root

func (Workspace) Root() string

Root returns "" — a no-FS session has no session root.

func (Workspace) Stat

func (Workspace) Stat(_ context.Context, path string) (tool.FileInfo, error)

Stat reports that the file does not exist, wrapping fs.ErrNotExist (see Read).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL