Documentation
¶
Index ¶
- func ErrorContext(err error, op string) string
- type CommandError
- type Driver
- type DriverError
- type DriverRegistry
- type Manager
- func (m *Manager) DetectDriver(entry *config.MountEntry) (Driver, error)
- func (m *Manager) GetDriver(driverType string) (Driver, error)
- func (m *Manager) GetMount(name string) (*config.MountEntry, error)
- func (m *Manager) GetMounts() []config.MountEntry
- func (m *Manager) GetRegisteredDrivers() []string
- func (m *Manager) Mount(ctx context.Context, entryName string) error
- func (m *Manager) RefreshAllStatus(ctx context.Context) error
- func (m *Manager) RegisterDriver(d Driver)
- func (m *Manager) Status(ctx context.Context, entryName string) (*MountStatus, error)
- func (m *Manager) Unmount(ctx context.Context, entryName string) error
- type MountStatus
- type TunnelError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorContext ¶
Types ¶
type CommandError ¶
func (*CommandError) Error ¶
func (e *CommandError) Error() string
func (*CommandError) Unwrap ¶
func (e *CommandError) Unwrap() error
type Driver ¶
type Driver interface {
// Type 返回驱动类型标识
// 例如: "smb", "sshfs"
Type() string
// Mount 执行挂载操作
// ctx: 上下文,用于取消和超时控制
// entry: 挂载条目配置
Mount(ctx context.Context, entry *config.MountEntry) error
// Unmount 执行卸载操作
// ctx: 上下文
// entry: 挂载条目配置
Unmount(ctx context.Context, entry *config.MountEntry) error
// Status 检查挂载状态
// 返回挂载状态详情
Status(ctx context.Context, entry *config.MountEntry) (*MountStatus, error)
// Validate 验证配置是否有效
// 在加载配置时调用,提前发现配置错误
Validate(entry *config.MountEntry) error
// NeedsSudo 返回该驱动是否需要 root 权限执行挂载/卸载
NeedsSudo() bool
}
Driver 驱动接口,所有挂载驱动必须实现
type DriverError ¶
type DriverError struct {
// Driver 驱动类型
Driver string
// Op 操作类型: mount, unmount, status
Op string
// Entry 挂载条目名称
Entry string
// Err 原始错误
Err error
}
DriverError 驱动操作错误
func (*DriverError) CoreMessage ¶
func (e *DriverError) CoreMessage() string
func (*DriverError) Error ¶
func (e *DriverError) Error() string
func (*DriverError) Unwrap ¶
func (e *DriverError) Unwrap() error
type DriverRegistry ¶
type DriverRegistry struct {
// contains filtered or unexported fields
}
DriverRegistry 驱动注册表
func (*DriverRegistry) Detect ¶
func (r *DriverRegistry) Detect(entry *config.MountEntry) (Driver, error)
Detect 根据type字段返回对应的驱动
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 驱动管理器
func (*Manager) DetectDriver ¶
func (m *Manager) DetectDriver(entry *config.MountEntry) (Driver, error)
DetectDriver 自动检测条目对应的驱动
func (*Manager) GetMount ¶
func (m *Manager) GetMount(name string) (*config.MountEntry, error)
GetMount 获取指定名称的挂载条目
func (*Manager) GetRegisteredDrivers ¶
GetRegisteredDrivers 获取所有已注册的驱动类型
func (*Manager) RefreshAllStatus ¶
RefreshAllStatus 刷新所有条目的挂载状态
type MountStatus ¶
type MountStatus struct {
// Mounted 是否已挂载
Mounted bool
// Message 状态描述信息
Message string
// Details 驱动特定的详细信息
// 例如:SMB可能包含服务器地址,SSHFS可能包含连接状态
Details map[string]string
}
MountStatus 挂载状态信息
type TunnelError ¶
func (*TunnelError) Error ¶
func (e *TunnelError) Error() string
func (*TunnelError) Unwrap ¶
func (e *TunnelError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.