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 ¶
- Variables
- type Workspace
- func (Workspace) CreateFile(context.Context, string, []byte) (tool.FileVersion, error)
- func (Workspace) Glob(context.Context, string) ([]string, error)
- func (Workspace) Grep(context.Context, string, string) ([]tool.GrepMatch, error)
- func (Workspace) Read(_ context.Context, path string) ([]byte, error)
- func (Workspace) ReadVersion(_ context.Context, path string) ([]byte, tool.FileVersion, error)
- func (Workspace) ReplaceFile(context.Context, string, tool.FileVersion, []byte) (tool.FileVersion, error)
- func (Workspace) Root() string
- func (Workspace) Stat(_ context.Context, path string) (tool.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
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 (Workspace) CreateFile ¶
CreateFile fails loudly with ErrNoFilesystem: nothing can be created in a no-FS session.
func (Workspace) Read ¶
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 ¶
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 ¶
func (Workspace) ReplaceFile(context.Context, string, tool.FileVersion, []byte) (tool.FileVersion, error)
ReplaceFile fails loudly with ErrNoFilesystem: nothing can be replaced in a no-FS session.