- Add WriteFile method to mock filesystem (non-atomic path, creates files) - Implement WriteFileAtomic in mock with temp file + rename pattern using .tmp/ directory, matching real filesystem semantics - Update WriteFileTask.Execute() to use WriteFileAtomic - Update FlushAll() to use WriteFileAtomic - Fix mock to create files on write (matching os.WriteFile behavior) - Update tests to match new semantics (create-if-not-exists)
17 lines
476 B
Go
17 lines
476 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
|
|
WriteFileAtomic(path string, content []byte) error
|
|
DeleteFile(path string) error
|
|
CreateDir(path string) error
|
|
}
|