重构:文件系统模块化架构,优化应用启动流程
This commit is contained in:
27
internal/filesystem/service_interfaces.go
Normal file
27
internal/filesystem/service_interfaces.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package filesystem
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// FileService 文件操作核心接口
|
||||
// 定义所有文件操作的基本功能,便于mock测试
|
||||
type FileService interface {
|
||||
// 基本操作
|
||||
Read(path string) (string, error)
|
||||
Write(path, content string) error
|
||||
Delete(path string) error
|
||||
List(path string) ([]map[string]interface{}, error)
|
||||
CreateDir(path string) error
|
||||
CreateFile(path string) error
|
||||
GetInfo(path string) (map[string]interface{}, error)
|
||||
Open(path string) error
|
||||
|
||||
// 配置
|
||||
GetConfig() *Config
|
||||
Close(ctx context.Context) error
|
||||
}
|
||||
|
||||
// 确保实现接口
|
||||
var _ FileService = (*FileSystemService)(nil)
|
||||
|
||||
Reference in New Issue
Block a user