filewriter

package
v0.76.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func (b *BackupManager) CreateBackup(ctx context.Context, originalPath string) (string, error)

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

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

WriteChunk writes a chunk to the session's temp file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL