Documentation
¶
Overview ¶
Package vfs provides a pluggable virtual handler chain for mache's virtual path types (_schema.json, PROMPT.txt, _diagnostics/, context, callers/, callees/, .query/). Both the FUSE and NFS backends delegate to a shared Resolver instead of duplicating if-chains.
Index ¶
- type CalleesHandler
- func (h *CalleesHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
- func (h *CalleesHandler) ListDir(path string) ([]DirExtra, bool)
- func (h *CalleesHandler) Match(path string) bool
- func (h *CalleesHandler) ReadContent(path string) ([]byte, bool)
- func (h *CalleesHandler) Stat(path string) *VEntry
- type CallersHandler
- func (h *CallersHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
- func (h *CallersHandler) ListDir(path string) ([]DirExtra, bool)
- func (h *CallersHandler) Match(path string) bool
- func (h *CallersHandler) ReadContent(path string) ([]byte, bool)
- func (h *CallersHandler) Stat(path string) *VEntry
- type ContextHandler
- func (h *ContextHandler) DirExtras(parentPath string, node *graph.Node) []DirExtra
- func (h *ContextHandler) ListDir(_ string) ([]DirExtra, bool)
- func (h *ContextHandler) Match(path string) bool
- func (h *ContextHandler) ReadContent(path string) ([]byte, bool)
- func (h *ContextHandler) Stat(path string) *VEntry
- type DiagnosticsHandler
- func (h *DiagnosticsHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
- func (h *DiagnosticsHandler) ListDir(path string) ([]DirExtra, bool)
- func (h *DiagnosticsHandler) Match(path string) bool
- func (h *DiagnosticsHandler) ReadContent(path string) ([]byte, bool)
- func (h *DiagnosticsHandler) Stat(path string) *VEntry
- type DirExtra
- type EntryKind
- type LocationHandler
- func (h *LocationHandler) DirExtras(parentPath string, node *graph.Node) []DirExtra
- func (h *LocationHandler) ListDir(_ string) ([]DirExtra, bool)
- func (h *LocationHandler) Match(path string) bool
- func (h *LocationHandler) ReadContent(path string) ([]byte, bool)
- func (h *LocationHandler) Stat(path string) *VEntry
- type PromptHandler
- func (h *PromptHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
- func (h *PromptHandler) ListDir(_ string) ([]DirExtra, bool)
- func (h *PromptHandler) Match(path string) bool
- func (h *PromptHandler) ReadContent(path string) ([]byte, bool)
- func (h *PromptHandler) Stat(path string) *VEntry
- type QueryHandler
- type Resolver
- func (r *Resolver) DirExtras(parentPath string, node *graph.Node) []DirExtra
- func (r *Resolver) EnableQuery()
- func (r *Resolver) ListDir(path string) ([]DirExtra, bool)
- func (r *Resolver) Match(path string) bool
- func (r *Resolver) ReadContent(path string) ([]byte, bool)
- func (r *Resolver) Resolve(path string) *VEntry
- func (r *Resolver) SetPromptContent(content []byte)
- func (r *Resolver) SetWritable(writable bool, diagStatus *sync.Map)
- type SchemaHandler
- func (h *SchemaHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
- func (h *SchemaHandler) ListDir(_ string) ([]DirExtra, bool)
- func (h *SchemaHandler) Match(path string) bool
- func (h *SchemaHandler) ReadContent(path string) ([]byte, bool)
- func (h *SchemaHandler) Stat(path string) *VEntry
- type VEntry
- type VHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalleesHandler ¶
CalleesHandler serves the virtual callees/ directory and its symlink entries.
func (*CalleesHandler) DirExtras ¶
func (h *CalleesHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
func (*CalleesHandler) Match ¶
func (h *CalleesHandler) Match(path string) bool
func (*CalleesHandler) ReadContent ¶
func (h *CalleesHandler) ReadContent(path string) ([]byte, bool)
func (*CalleesHandler) Stat ¶
func (h *CalleesHandler) Stat(path string) *VEntry
type CallersHandler ¶
CallersHandler serves the virtual callers/ directory and its symlink entries.
func (*CallersHandler) DirExtras ¶
func (h *CallersHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
func (*CallersHandler) Match ¶
func (h *CallersHandler) Match(path string) bool
func (*CallersHandler) ReadContent ¶
func (h *CallersHandler) ReadContent(path string) ([]byte, bool)
func (*CallersHandler) Stat ¶
func (h *CallersHandler) Stat(path string) *VEntry
type ContextHandler ¶
ContextHandler serves the virtual "context" file inside directory nodes.
func (*ContextHandler) DirExtras ¶
func (h *ContextHandler) DirExtras(parentPath string, node *graph.Node) []DirExtra
func (*ContextHandler) Match ¶
func (h *ContextHandler) Match(path string) bool
func (*ContextHandler) ReadContent ¶
func (h *ContextHandler) ReadContent(path string) ([]byte, bool)
func (*ContextHandler) Stat ¶
func (h *ContextHandler) Stat(path string) *VEntry
type DiagnosticsHandler ¶
DiagnosticsHandler serves the /_diagnostics/ virtual directory. Requires Writable=true and a DiagStatus sync.Map (shared with MemoryStore.WriteStatus).
func (*DiagnosticsHandler) DirExtras ¶
func (h *DiagnosticsHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
func (*DiagnosticsHandler) ListDir ¶
func (h *DiagnosticsHandler) ListDir(path string) ([]DirExtra, bool)
func (*DiagnosticsHandler) Match ¶
func (h *DiagnosticsHandler) Match(path string) bool
func (*DiagnosticsHandler) ReadContent ¶
func (h *DiagnosticsHandler) ReadContent(path string) ([]byte, bool)
func (*DiagnosticsHandler) Stat ¶
func (h *DiagnosticsHandler) Stat(path string) *VEntry
type LocationHandler ¶
LocationHandler serves the virtual "location" file inside directory nodes that have a Properties["location"] value (e.g., "internal/ingest/engine.go:142:298"). This bridges the orientation gap between mache's construct-based paths and the original source file coordinates.
func (*LocationHandler) DirExtras ¶
func (h *LocationHandler) DirExtras(parentPath string, node *graph.Node) []DirExtra
func (*LocationHandler) Match ¶
func (h *LocationHandler) Match(path string) bool
func (*LocationHandler) ReadContent ¶
func (h *LocationHandler) ReadContent(path string) ([]byte, bool)
func (*LocationHandler) Stat ¶
func (h *LocationHandler) Stat(path string) *VEntry
type PromptHandler ¶
type PromptHandler struct {
Content []byte
}
PromptHandler serves the /PROMPT.txt virtual file (agent mode). If Content is nil/empty, the handler reports no match.
func (*PromptHandler) DirExtras ¶
func (h *PromptHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
func (*PromptHandler) Match ¶
func (h *PromptHandler) Match(path string) bool
func (*PromptHandler) ReadContent ¶
func (h *PromptHandler) ReadContent(path string) ([]byte, bool)
func (*PromptHandler) Stat ¶
func (h *PromptHandler) Stat(path string) *VEntry
type QueryHandler ¶
type QueryHandler struct {
Enabled bool // true when queryFn is set
}
QueryHandler is a thin wrapper for the /.query/ magic directory. It only handles Match and DirExtras — the stateful lifecycle (Mkdir, Write, Release, queryExecute) stays in the backend.
func (*QueryHandler) DirExtras ¶
func (h *QueryHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
func (*QueryHandler) Match ¶
func (h *QueryHandler) Match(path string) bool
func (*QueryHandler) ReadContent ¶
func (h *QueryHandler) ReadContent(_ string) ([]byte, bool)
func (*QueryHandler) Stat ¶
func (h *QueryHandler) Stat(_ string) *VEntry
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver iterates a chain of VHandlers in registration order. The first handler whose Match returns true wins.
func NewDefaultResolver ¶
NewDefaultResolver builds the standard handler chain for both FUSE and NFS backends. Callers configure behaviour via SetPromptContent, EnableQuery, and SetWritable rather than accessing individual handlers.
func NewResolver ¶
NewResolver creates a Resolver with the given handlers. Order matters — first match wins.
func (*Resolver) DirExtras ¶
DirExtras collects extras from ALL handlers (not just first match). Each handler decides independently whether to inject entries.
func (*Resolver) EnableQuery ¶
func (r *Resolver) EnableQuery()
EnableQuery marks the /.query/ magic directory as active.
func (*Resolver) ReadContent ¶
ReadContent delegates to the first matching handler that returns content.
func (*Resolver) Resolve ¶
Resolve returns a VEntry for the path, or nil if no handler matches. When a handler matches but Stat returns nil (e.g., a node named "context" that has no virtual content), resolution continues to the next handler so the path can fall through to the graph lookup.
func (*Resolver) SetPromptContent ¶
SetPromptContent sets the content for the /PROMPT.txt virtual file.
type SchemaHandler ¶
type SchemaHandler struct {
Content []byte // Serialized schema JSON
}
SchemaHandler serves the /_schema.json virtual file.
func (*SchemaHandler) DirExtras ¶
func (h *SchemaHandler) DirExtras(parentPath string, _ *graph.Node) []DirExtra
func (*SchemaHandler) Match ¶
func (h *SchemaHandler) Match(path string) bool
func (*SchemaHandler) ReadContent ¶
func (h *SchemaHandler) ReadContent(path string) ([]byte, bool)
func (*SchemaHandler) Stat ¶
func (h *SchemaHandler) Stat(path string) *VEntry
type VEntry ¶
type VEntry struct {
Kind EntryKind
Size int64
Perm uint32 // Unix permission bits (e.g. 0o444, 0o555)
Content []byte // File content (KindFile) or symlink target (KindSymlink)
NodeID string // Graph node ID — NFS uses this to create graphFile
}
VEntry is the stat result for a virtual path.
type VHandler ¶
type VHandler interface {
// Match returns true if this handler owns the given path.
Match(path string) bool
// Stat returns a VEntry for the path, or nil if the path does not exist.
Stat(path string) *VEntry
// ReadContent returns the byte content for a virtual file.
// Returns (nil, false) if not applicable.
ReadContent(path string) ([]byte, bool)
// ListDir returns directory entries for a virtual directory.
// Returns (nil, false) if not applicable (i.e. path is not a virtual dir).
ListDir(path string) ([]DirExtra, bool)
// DirExtras returns extra entries to inject into a real directory listing.
// Called for every non-virtual directory to let handlers add their entries
// (e.g., _diagnostics/ added to writable dirs, callers/ added when callers exist).
DirExtras(parentPath string, node *graph.Node) []DirExtra
}
VHandler resolves one family of virtual paths (e.g., callers/, _diagnostics/).