Documentation
¶
Index ¶
- func NewBackupManager(baseDir string) filewriter.BackupManager
- func NewPathValidator(cfg *config.Config) filewriter.PathValidator
- func NewSafeFileWriter(validator filewriter.PathValidator, backupManager filewriter.BackupManager) filewriter.FileWriter
- func NewStreamingChunkManager(tempDir string, writer filewriter.FileWriter) filewriter.ChunkManager
- type BackupManager
- type ChunkSession
- type PathValidator
- type SafeFileWriter
- type StreamingChunkManager
- func (cm *StreamingChunkManager) CleanupSession(sessionID string) error
- func (cm *StreamingChunkManager) FinalizeChunks(ctx context.Context, sessionID string, targetPath string) (*filewriter.WriteResult, error)
- func (cm *StreamingChunkManager) GetSessionInfo(sessionID string) (*filewriter.ChunkSessionInfo, error)
- func (cm *StreamingChunkManager) WriteChunk(ctx context.Context, req filewriter.ChunkWriteRequest) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBackupManager ¶
func NewBackupManager(baseDir string) filewriter.BackupManager
NewBackupManager creates a new BackupManager
func NewPathValidator ¶
func NewPathValidator(cfg *config.Config) filewriter.PathValidator
NewPathValidator creates a new PathValidator
func NewSafeFileWriter ¶
func NewSafeFileWriter(validator filewriter.PathValidator, backupManager filewriter.BackupManager) filewriter.FileWriter
NewSafeFileWriter creates a new SafeFileWriter
func NewStreamingChunkManager ¶
func NewStreamingChunkManager(tempDir string, writer filewriter.FileWriter) filewriter.ChunkManager
NewStreamingChunkManager creates a new StreamingChunkManager
Types ¶
type BackupManager ¶
type BackupManager struct {
// contains filtered or unexported fields
}
BackupManager implements filewriter.BackupManager
func (*BackupManager) CleanupBackup ¶
func (b *BackupManager) CleanupBackup(backupPath string) error
CleanupBackup removes a backup file
func (*BackupManager) CreateBackup ¶
CreateBackup creates a backup of the original file
func (*BackupManager) RestoreBackup ¶
func (b *BackupManager) RestoreBackup(ctx context.Context, backupPath string, originalPath string) error
RestoreBackup restores a backup to the original location
type ChunkSession ¶
type ChunkSession struct {
// contains filtered or unexported fields
}
ChunkSession represents an active chunked writing session
type PathValidator ¶
type PathValidator struct {
// contains filtered or unexported fields
}
PathValidator implements filewriter.PathValidator
func (*PathValidator) IsInSandbox ¶
func (v *PathValidator) IsInSandbox(path string) bool
IsInSandbox checks if a path is within configured sandbox directories
func (*PathValidator) IsWritable ¶
func (v *PathValidator) IsWritable(path string) bool
IsWritable checks if a path can be written to
func (*PathValidator) Validate ¶
func (v *PathValidator) Validate(path string) error
Validate checks if a path is valid and secure for file operations
type SafeFileWriter ¶
type SafeFileWriter struct {
// contains filtered or unexported fields
}
SafeFileWriter implements filewriter.FileWriter with atomic operations
func (*SafeFileWriter) ValidatePath ¶
func (w *SafeFileWriter) ValidatePath(path string) error
ValidatePath validates if a path is safe for writing
func (*SafeFileWriter) Write ¶
func (w *SafeFileWriter) Write(ctx context.Context, req filewriter.WriteRequest) (*filewriter.WriteResult, error)
Write performs an atomic file write operation
type StreamingChunkManager ¶
type StreamingChunkManager struct {
// contains filtered or unexported fields
}
StreamingChunkManager implements filewriter.ChunkManager with safe streaming
func (*StreamingChunkManager) CleanupSession ¶
func (cm *StreamingChunkManager) CleanupSession(sessionID string) error
CleanupSession removes an active session and cleans up resources
func (*StreamingChunkManager) FinalizeChunks ¶
func (cm *StreamingChunkManager) FinalizeChunks(ctx context.Context, sessionID string, targetPath string) (*filewriter.WriteResult, error)
FinalizeChunks completes a chunked write session and moves to target location
func (*StreamingChunkManager) GetSessionInfo ¶
func (cm *StreamingChunkManager) GetSessionInfo(sessionID string) (*filewriter.ChunkSessionInfo, error)
GetSessionInfo returns information about an active session
func (*StreamingChunkManager) WriteChunk ¶
func (cm *StreamingChunkManager) WriteChunk(ctx context.Context, req filewriter.ChunkWriteRequest) error
WriteChunk writes a chunk to the session's temp file