Documentation
¶
Index ¶
- type Manager
- func (m *Manager) CleanStaleFiles(maxAge time.Duration) int
- func (m *Manager) CreateTempFile(fileSize uint64, prefix string) (*os.File, error)
- func (m *Manager) GetAllPaths() []string
- func (m *Manager) GetPrimaryPath() string
- func (m *Manager) GetStats() []Stats
- func (m *Manager) SelectWorkspace(fileSize uint64) (*Workspace, error)
- type Stats
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple workspaces and selects the best one for each upload
func NewManager ¶
NewManager creates a new workspace manager from a comma-separated list of directories capacityThreshold specifies the safety margin multiplier (e.g., 4.0 requires 4x file size available)
func (*Manager) CleanStaleFiles ¶ added in v1.0.0
CleanStaleFiles removes temporary upload files older than maxAge from all workspaces. It targets files with the "filebin-" prefix that were left behind by interrupted uploads. Returns the number of files removed.
func (*Manager) CreateTempFile ¶
CreateTempFile creates a temporary file in the selected workspace
func (*Manager) GetAllPaths ¶
GetAllPaths returns all workspace paths
func (*Manager) GetPrimaryPath ¶
GetPrimaryPath returns the fastest workspace path (used for non-upload temp files)
type Stats ¶
type Stats struct {
Path string
WriteMBps float64
AvailableBytes uint64
TotalBytes uint64
LastChecked time.Time
}
Stats returns statistics about all workspaces
type Workspace ¶
type Workspace struct {
Path string
WriteMBps float64 // Write throughput in MB/s
LastChecked time.Time
AvailableBytes uint64
TotalBytes uint64
// contains filtered or unexported fields
}
Workspace represents a temporary file storage location with its performance characteristics
func (*Workspace) GetAvailableBytes ¶
GetAvailableBytes returns the currently known available space (thread-safe)
func (*Workspace) UpdateCapacity ¶
UpdateCapacity checks the available disk space for this workspace