Filesystem Backend Interface (backend/backend.go)

ragflow · internal/harness/core/backend/backend.go · go · Apache-2.0
files, lang:go, lang:shell, tag:interface, tag:abstraction

Defines Go interfaces and FileInfo struct abstracting file system and shell operations (read, write, edit, glob, grep, exec) for agent tooling.

// Source: https://github.com/infiniflow/ragflow | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Package filesystem provides file system abstractions for agent file operations.
package backend

// FileInfo provides information about a file.
type FileInfo struct {
	Name    string `json:"name"`
	Size    int64  `json:"size"`
	IsDir   bool   `json:"is_dir"`
	ModTime string `json:"mod_time"`
}

// Backend defines the interface for file system operations.
type Backend interface {
	Read(path string) (string, error)
	Write(path, content string) error
	Edit(path, old, new string) error
	Glob(pattern string) ([]string, error)
	Grep(pattern, path string) (string, error)
	Stat(path string)

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key