fs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MacheFS

type MacheFS struct {
	fuse.FileSystemBase
	Schema *api.Topology
	Graph  graph.Graph

	// Write-back support (nil Engine = read-only)
	Writable bool
	Engine   *ingest.Engine
	// contains filtered or unexported fields
}

MacheFS implements the FUSE interface from cgofuse. It delegates all file/directory decisions to the Graph — no heuristics.

func NewMacheFS

func NewMacheFS(schema *api.Topology, g graph.Graph) *MacheFS

func (*MacheFS) Chmod

func (fs *MacheFS) Chmod(path string, mode uint32) int

Chmod stub

func (*MacheFS) Chown

func (fs *MacheFS) Chown(path string, uid, gid uint32) int

Chown stub

func (*MacheFS) Create

func (fs *MacheFS) Create(path string, flags int, mode uint32) (int, uint64)

func (*MacheFS) Flush

func (fs *MacheFS) Flush(path string, fh uint64) int

Flush is a no-op — we commit on Release.

func (*MacheFS) Getattr

func (fs *MacheFS) Getattr(path string, stat *fuse.Stat_t, fh uint64) int

Getattr trusts the node's declared Mode.

func (*MacheFS) Mkdir

func (fs *MacheFS) Mkdir(path string, mode uint32) int

func (*MacheFS) Open

func (fs *MacheFS) Open(path string, flags int) (int, uint64)

Open validates that the path is a file node. For writable mounts, write flags allocate a writeHandle backed by the node's current content.

func (*MacheFS) Opendir

func (fs *MacheFS) Opendir(path string) (int, uint64)

Opendir fetches the directory listing once and caches it by handle.

func (*MacheFS) Read

func (fs *MacheFS) Read(path string, buff []byte, ofst int64, fh uint64) int

Read returns the Data of a file node. If a writeHandle exists for this fh, reads from the in-progress buffer instead.

func (*MacheFS) Readdir

func (fs *MacheFS) Readdir(path string, fill func(name string, stat *fuse.Stat_t, ofst int64) bool, ofst int64, fh uint64) int

Readdir serves entries from the cached handle with inline stats (ReaddirPlus). Auto-mode (offset=0 to fill): fuse-t requires all results in the first pass. The NFS translation layer handles pagination to the macOS NFS client. cgofuse fill() convention: true = accepted, false = buffer full.

Stats are populated for each entry to enable ReaddirPlus — this eliminates the N+1 LOOKUP storm where the kernel would issue a separate Getattr call for every directory entry. With fuse-t's NFS translation, this maps to NFS READDIRPLUS which returns attributes inline.

func (fs *MacheFS) Readlink(path string) (int, string)

Readlink returns the symlink target for callers/, callees/ entries and /.query/<name>/<entry>.

func (*MacheFS) Release

func (fs *MacheFS) Release(path string, fh uint64) int

Release is THE COMMIT POINT for write-back. On close: splice new content into source → goimports → re-ingest → graph updated.

func (*MacheFS) Releasedir

func (fs *MacheFS) Releasedir(path string, fh uint64) int

Releasedir frees the cached directory listing.

func (*MacheFS) Rmdir

func (fs *MacheFS) Rmdir(path string) int

Rmdir removes a query directory (/.query/<name>).

func (*MacheFS) SetPromptContent added in v0.2.0

func (fs *MacheFS) SetPromptContent(content []byte)

SetPromptContent sets the content for the /PROMPT.txt virtual file (agent mode).

func (*MacheFS) SetQueryFunc

func (fs *MacheFS) SetQueryFunc(fn func(string, ...any) (*sql.Rows, error))

SetQueryFunc enables the /.query/ magic directory. Pass the SQLiteGraph's QueryRefs method. If never called, /.query is not exposed.

func (*MacheFS) SetWritable added in v0.6.0

func (fs *MacheFS) SetWritable(writable bool, diagStatus *sync.Map)

SetWritable enables write-back mode and wires the diagnostics handler.

func (*MacheFS) Truncate

func (fs *MacheFS) Truncate(path string, size int64, fh uint64) int

Truncate resizes the writeHandle buffer (called via ftruncate).

func (fs *MacheFS) Unlink(path string) int

Unlink removes a stored query result (/.query/<name>) or a file node.

func (*MacheFS) Utimens

func (fs *MacheFS) Utimens(path string, tmsp []fuse.Timespec) int

Utimens stub

func (*MacheFS) Write

func (fs *MacheFS) Write(path string, buff []byte, ofst int64, fh uint64) int

Write appends/overwrites data in the writeHandle buffer.

Jump to

Keyboard shortcuts

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