Documentation
¶
Overview ¶
Package filesystem is the swappable file-store contract used by file tools and runtime plugins (memory, schedule, skills, credentials, …).
Paths are slash-separated and interpreted by the backend (workspace-relative for local disk, object keys for S3, remote paths for SSH/FUSE, etc.). Empty path or "." is the backend root. Implementations should honor the workspace scope prefixes "global:" / "local:" (see cap/workspace.ParseScoped) so one instance can serve both tenant-local and shared-global files.
Not-found errors must match errors.Is(err, os.ErrNotExist). Writes create parent prefixes as needed and must be atomic (temp file + rename on local disk; a single PUT on object stores). Implementations may ignore .gitignore (local disk respects it; object stores typically do not).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FindRequest ¶
type GrepRequest ¶
type GrepResult ¶
type ReadFS ¶ added in v0.3.33
type ReadFS interface {
Read(ctx context.Context, path string) ([]byte, error)
Stat(ctx context.Context, path string) (Info, error)
List(ctx context.Context, path string) ([]DirEntry, error)
}
ReadFS is the read/list surface. Remote and object-store backends implement directories as prefixes.
type SearchFS ¶ added in v0.3.33
type SearchFS interface {
Grep(ctx context.Context, req GrepRequest) (GrepResult, error)
Find(ctx context.Context, req FindRequest) (FindResult, error)
}
SearchFS is content and name search. Local disk walks the tree; S3 may list by prefix; a remote host may shell out to rg/find.
type Service ¶
Service is the file store injected into tool/fs-workspace and runtime plugins. Standard kind: filesystem/local. Alternate backends (memory, S3, remote) register as filesystem/<name> and are wired through deps.fs.
type WriteFS ¶ added in v0.3.33
type WriteFS interface {
Write(ctx context.Context, path string, data []byte, opts ...WriteOption) error
// Append adds data to the end of path, creating it when missing. Object
// stores may implement it as read-modify-write.
Append(ctx context.Context, path string, data []byte) error
}
WriteFS creates or replaces a file. Parent prefixes are created as needed (no-op on stores without directories).
type WriteOption ¶ added in v0.3.33
type WriteOption func(*WriteOptions)
WriteOption customizes a single Write call.
func WithPerm ¶ added in v0.3.33
func WithPerm(perm os.FileMode) WriteOption
WithPerm sets the file permission (e.g. 0o600 for secrets files).
type WriteOptions ¶ added in v0.3.33
type WriteOptions struct {
// Perm is the permission for newly created files. Zero keeps an existing
// file's mode, or 0o644 for new files. Object stores ignore it.
Perm os.FileMode
}
WriteOptions customizes a single Write call.