- Define pool.FileSystem interface in internal/io/pool/filesystem.go - Move DirEntry interface to internal/io/pool/types/types.go to break the pool <-> mock import cycle - Implement real.FileSystem with atomic writes (temp file + os.Rename) - Update mock.FileSystem to satisfy pool.FileSystem interface - Update worker pool tasks to accept pool.FileSystem interface - Update main.go to use RealFileSystem by default, with -root flag - Update all browser/editor/test references to types.DirEntry
16 lines
424 B
Go
16 lines
424 B
Go
package pool
|
|
|
|
import "pad/internal/io/pool/types"
|
|
|
|
// FileSystem defines the interface for filesystem operations
|
|
// used by the worker pool.
|
|
type FileSystem interface {
|
|
ReadDir(path string) ([]types.DirEntry, error)
|
|
DirExists(path string) bool
|
|
FileExists(path string) bool
|
|
ReadFile(path string) ([]byte, error)
|
|
WriteFile(path string, content []byte) error
|
|
DeleteFile(path string) error
|
|
CreateDir(path string) error
|
|
}
|